/* ======================================================================
   東北電力 支払留保 管理システム (モック) 共通スタイル
   ====================================================================== */

:root {
  --beige-50: #fbf7f0;
  --beige-100: #f5efe2;
  --beige-200: #ebe0c8;
  --beige-300: #ddcfa9;
  --beige-400: #c8b485;
  --beige-500: #a89469;
  --beige-600: #8b7853;
  --beige-700: #6e5d3e;

  --red-50: #fdf3f3;
  --red-100: #fbe5e5;
  --red-200: #f5c8c8;
  --red-300: #ec9c9c;
  --red-400: #e06b6b;
  --red-500: #d23f3f;
  --red-600: #c0292c;
  --red-700: #a01e22;

  --grad-primary: linear-gradient(135deg, #d23f3f 0%, #a01e22 100%);
  --grad-primary-hover: linear-gradient(135deg, #db5252 0%, #b1272b 100%);
  --grad-soft: linear-gradient(180deg, #fbf7f0 0%, #f3e9d6 100%);
  --grad-info: linear-gradient(135deg, #fbf7f0 0%, #f0e3c8 100%);

  --purple-50: var(--red-50);
  --purple-100: var(--red-100);
  --purple-200: var(--beige-200);
  --purple-300: var(--red-300);
  --purple-400: var(--red-400);
  --purple-500: var(--red-500);
  --purple-600: var(--red-600);
  --purple-700: var(--red-700);

  --ink-900: #2b1f15;
  --ink-700: #4a3a2c;
  --ink-500: #7a6b5b;
  --ink-400: #9c8e7e;
  --ink-300: #c5b8a6;
  --ink-200: #e6dcc8;
  --ink-100: #f1ebda;
  --ink-50: #fbf7f0;

  --success-bg: #e6f7ee;
  --success-fg: #1f8b50;
  --success-bd: #b6e5cb;

  --warning-bg: #fff2e0;
  --warning-fg: #b86815;
  --warning-bd: #fdd9b0;

  --neutral-bg: #eef0f5;
  --neutral-fg: #5a637a;
  --neutral-bd: #d8dde6;

  --danger-bg: #fdecec;
  --danger-fg: #c53e3e;

  --diff-bg: #fffaf0;
  --diff-bd: #f5e1b8;

  --shadow-sm: 0 1px 2px rgba(80, 50, 30, 0.04);
  --shadow-md: 0 4px 14px rgba(110, 70, 50, 0.07);
  --shadow-lg: 0 12px 32px rgba(110, 70, 50, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --font-jp: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", sans-serif;
  --font-num: "Inter", "Noto Sans JP", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--ink-50);
  color: var(--ink-900);
  font-family: var(--font-jp);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ===== Topbar (admin) ===== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--ink-200);
  padding: 14px 28px;
  display: flex; align-items: center; gap: 24px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 15px; color: var(--ink-900);
}
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--grad-primary);
  display: grid; place-items: center;
  color: white; font-weight: 800; font-size: 13px;
  box-shadow: 0 4px 10px rgba(192, 41, 44, 0.3);
}
.brand-divider { width: 1px; height: 18px; background: var(--ink-200); }
.brand-system { color: var(--ink-500); font-size: 13px; font-weight: 500; }
.topbar-spacer { flex: 1; }
.topbar-nav { display: flex; gap: 4px; }
.topbar-nav a {
  color: var(--ink-700); padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  transition: all .15s ease;
}
.topbar-nav a:hover { background: var(--purple-50); color: var(--purple-700); }
.topbar-nav a.is-active { color: var(--purple-700); background: var(--purple-50); }
.topbar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: var(--radius-pill);
  background: var(--ink-50);
}
.topbar-user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: grid; place-items: center;
  color: white; font-size: 12px; font-weight: 600;
}
.topbar-user-info { font-size: 12px; line-height: 1.3; }
.topbar-user-info b { color: var(--ink-900); font-weight: 600; }
.topbar-user-info span { color: var(--ink-500); display: block; }
.topbar-user-info a { color: var(--purple-700); font-weight: 500; }

/* ===== Form topbar ===== */
.form-topbar {
  background: #fff;
  border-bottom: 1px solid var(--ink-200);
  padding: 14px 28px;
  display: flex; align-items: center; gap: 16px;
}
.form-body { background: var(--grad-soft); min-height: 100vh; }
.form-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 80px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.form-footer { padding: 24px 0; text-align: center; color: var(--ink-400); font-size: 12px; }

/* ===== Page layout ===== */
.page { max-width: 1600px; margin: 0 auto; padding: 24px 28px 100px; }
.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  color: var(--ink-500); font-size: 12px;
  margin-bottom: 6px;
}
.breadcrumb-sep { color: var(--ink-300); }
.page-title {
  font-size: 22px; font-weight: 700;
  color: var(--ink-900);
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 4px;
  letter-spacing: 0.01em;
}
.page-title-tag {
  display: inline-block;
  padding: 3px 10px;
  background: var(--purple-100);
  color: var(--purple-700);
  border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600;
}
.page-meta { color: var(--ink-500); font-size: 13px; margin-bottom: 22px; }
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; flex-wrap: wrap; margin-bottom: 20px;
}
.header-actions { display: flex; gap: 10px; }

/* ===== 申請種別タブ ===== */
.type-tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin: 4px 0 18px;
  border-bottom: 1px solid var(--ink-200);
  flex-wrap: wrap;
}
.type-tab {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-500);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  margin-bottom: -1px;
  transition: all .15s ease;
  white-space: nowrap;
}
.type-tab:hover {
  color: var(--purple-700);
  background: var(--purple-50);
}
.type-tab.is-active {
  color: var(--purple-700);
  background: #fff;
  border-color: var(--ink-200);
  border-bottom-color: #fff;
}
.table-count-type {
  display: inline-block;
  padding: 2px 10px;
  margin-right: 8px;
  background: var(--purple-100);
  color: var(--purple-700);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
}

/* ===== Card ===== */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--ink-200);
  overflow: hidden;
}
.card + .card { margin-top: 18px; }
.card-header {
  padding: 16px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-bottom: 1px solid var(--ink-100);
}
.card-header h2 {
  margin: 0; font-size: 14px; font-weight: 600;
  color: var(--ink-900);
  display: flex; align-items: center; gap: 10px;
}
.card-header h2::before {
  content: ""; width: 3px; height: 16px;
  background: var(--grad-primary); border-radius: 2px;
}
.card-header-meta { color: var(--ink-500); font-size: 12.5px; }
.card-body { padding: 22px; }

/* ===== Inputs =====
   NOTE: クラス名は `.field-input` を使う。CakePHP の Form->control() は
   外側ラッパー <div class="input text"> を自動生成するため、`.input` だと
   ラッパー div にも CSS が当たって枠線が二重になる。衝突回避のため別名にしている。 */
.field-input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 13px;
  color: var(--ink-900);
  transition: all .15s ease;
}
.field-input:hover, .select:hover, .textarea:hover { border-color: var(--purple-300); }
.field-input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(210, 63, 63, 0.15);
}
.field-input::placeholder, .textarea::placeholder { color: var(--ink-400); }
.field-input.is-readonly {
  background: transparent;
  color: var(--ink-700);
  border-color: transparent;
  cursor: default;
  pointer-events: none;
  padding-left: 0;
}
.field-input.is-changed {
  background: var(--diff-bg);
  border-color: var(--diff-bd);
}
.textarea { min-height: 92px; resize: vertical; line-height: 1.65; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23c0292c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Form fields layout */
.form-field { margin-bottom: 16px; }
.form-field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-700);
  margin-bottom: 6px;
}
.form-field-label .required {
  color: var(--red-600);
  font-size: 11px;
  margin-left: 4px;
}
.form-field-error {
  color: var(--red-600);
  font-size: 12px;
  margin-top: 4px;
}
.form-field-help {
  color: var(--ink-500);
  font-size: 11.5px;
  margin-top: 4px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(192, 41, 44, 0.28);
}
.btn-primary:hover {
  background: var(--grad-primary-hover);
  box-shadow: 0 6px 18px rgba(192, 41, 44, 0.36);
  transform: translateY(-1px);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-ghost {
  background: #fff;
  color: var(--purple-700);
  border-color: var(--purple-200);
}
.btn-ghost:hover {
  background: var(--purple-50);
  border-color: var(--purple-400);
}
.btn-subtle {
  background: var(--ink-50);
  color: var(--ink-700);
  border-color: var(--ink-200);
}
.btn-subtle:hover {
  background: var(--ink-100);
  color: var(--ink-900);
}
.btn-lg { padding: 12px 28px; font-size: 14px; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ===== Badge ===== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.badge-success { background: var(--success-bg); color: var(--success-fg); border-color: var(--success-bd); }
.badge-success .badge-dot { background: var(--success-fg); }
.badge-warning { background: var(--warning-bg); color: var(--warning-fg); border-color: var(--warning-bd); }
.badge-warning .badge-dot { background: var(--warning-fg); }
.badge-neutral { background: var(--neutral-bg); color: var(--neutral-fg); border-color: var(--neutral-bd); }
.badge-neutral .badge-dot { background: var(--neutral-fg); }
.badge-danger { background: var(--danger-bg); color: var(--danger-fg); border-color: #f5c2c2; }
.badge-danger .badge-dot { background: var(--danger-fg); }

/* ===== Tables ===== */
.table-card { margin-top: 18px; }
.table-toolbar {
  padding: 14px 22px;
  display: flex; align-items: center; gap: 16px;
  border-bottom: 1px solid var(--ink-100);
  flex-wrap: wrap;
}
.table-count { font-size: 13px; color: var(--ink-700); }
.table-count strong { color: var(--purple-700); font-weight: 700; font-family: var(--font-num); }
.pending-card { border-color: var(--danger-fg); box-shadow: var(--shadow-md); }
.pending-card .pending-toolbar {
  background: var(--danger-bg);
  border-bottom: 1px solid var(--danger-fg);
}
.pending-card .pending-toolbar .table-count {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--danger-fg);
  font-weight: 700;
}
.pending-card .pending-toolbar .table-count strong { color: var(--danger-fg); }
.pending-toolbar-icon { display: inline-flex; align-items: center; }
.toolbar-spacer { flex: 1; }
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%; min-width: 1300px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
table.data thead th {
  position: sticky; top: 0;
  background: #fbf7ee;
  color: var(--ink-500);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ink-200);
  white-space: nowrap;
}
table.data tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--ink-100);
  color: var(--ink-900);
  white-space: nowrap;
}
table.data tbody tr:hover { background: var(--purple-50); }
table.data tbody tr.is-clickable { cursor: pointer; }
.row-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--ink-500);
  transition: all .12s ease;
}
.icon-btn:hover {
  background: var(--purple-50);
  color: var(--purple-700);
  border-color: var(--purple-200);
}
.icon-btn svg { width: 14px; height: 14px; }

/* Detail table */
table.detail {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
table.detail thead th {
  background: #fbf7ee;
  color: var(--ink-500);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  padding: 12px 18px;
  border-bottom: 1px solid var(--ink-200);
}
table.detail tbody td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--ink-100);
  color: var(--ink-900);
  vertical-align: middle;
}
table.detail tbody tr:last-child td { border-bottom: none; }
.col-label { width: 25%; min-width: 180px; color: var(--ink-700); font-weight: 500; }
.col-value { color: var(--ink-900); }
.col-original { color: var(--ink-700); font-family: var(--font-num); }
.col-original.is-empty { color: var(--ink-400); font-style: italic; font-family: var(--font-jp); }
.mono { font-family: var(--font-num); letter-spacing: 0.02em; }

/* Summary card */
.summary-card {
  background: var(--grad-info);
  border: 1px solid var(--purple-200);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px 28px;
}
.summary-item { display: flex; flex-direction: column; gap: 4px; }
.summary-label {
  font-size: 11.5px; color: var(--purple-700);
  text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 600;
}
.summary-value { font-size: 14px; font-weight: 600; color: var(--ink-900); font-family: var(--font-num); }
.summary-value.is-text { font-family: var(--font-jp); }
.summary-value.is-empty { color: var(--ink-400); font-weight: 400; }

/* ===== Pagination ===== */
.pagination {
  padding: 16px 22px;
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--ink-100);
  flex-wrap: wrap; gap: 12px;
}
.pagination-info { color: var(--ink-500); font-size: 12.5px; }
.pages { display: flex; gap: 4px; align-items: center; }
.page-btn {
  min-width: 32px; height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  font-size: 13px; font-weight: 500;
  color: var(--ink-700);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.page-btn:hover { background: var(--purple-50); color: var(--purple-700); }
.page-btn.is-active {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 3px 10px rgba(192, 41, 44, 0.3);
}
.page-btn[disabled] { opacity: .35; cursor: not-allowed; }

/* ===== Flash ===== */
.flash-message {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 13px;
  border: 1px solid transparent;
}
.flash-message.success { background: var(--success-bg); color: var(--success-fg); border-color: var(--success-bd); }
.flash-message.error { background: var(--danger-bg); color: var(--danger-fg); border-color: #f5c2c2; }
.flash-message.warning { background: var(--warning-bg); color: var(--warning-fg); border-color: var(--warning-bd); }

/* ===== Form-specific (顧客向け) ===== */
.form-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--ink-200);
  padding: 28px 24px;
}
.form-card h1 {
  margin: 0 0 8px;
  font-size: 20px;
  color: var(--ink-900);
  display: flex; align-items: center; gap: 8px;
}
.form-card .lead { color: var(--ink-500); font-size: 13px; margin: 0 0 24px; }

.upload-area {
  border: 2px dashed var(--purple-300);
  border-radius: var(--radius-md);
  padding: 28px 20px;
  text-align: center;
  background: var(--purple-50);
  cursor: pointer;
  transition: all .15s ease;
  position: relative;
}
.upload-area:hover { background: var(--red-50); border-color: var(--red-400); }
.upload-area input[type="file"] { display: none; }
.upload-area .icon {
  font-size: 32px;
  margin-bottom: 8px;
  color: var(--purple-600);
}
.upload-area .label { font-weight: 600; color: var(--purple-700); font-size: 14px; }
.upload-area .help { color: var(--ink-500); font-size: 11.5px; margin-top: 4px; }
.upload-preview {
  margin-top: 14px;
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px;
  background: var(--ink-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--ink-200);
}
.upload-preview img { max-width: 140px; max-height: 180px; border-radius: var(--radius-sm); object-fit: contain; background: #fff; border: 1px solid var(--ink-200); }
.upload-preview .meta { font-size: 12px; color: var(--ink-700); line-height: 1.6; }
.upload-preview .meta b { color: var(--ink-900); }

.ocr-status {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  border: 1px solid transparent;
  display: none;
}
.section-note {
  background: var(--purple-50);
  border-left: 3px solid var(--purple-400);
  color: var(--purple-700);
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12.5px;
  margin: 16px 0;
}

.divider {
  height: 1px; background: var(--ink-100);
  margin: 24px 0;
}

/* ======================================================================
   顧客向けフォーム専用テーマ (赤系) — 東北電力ブランドカラー準拠
   レイアウト・コンポーネントは Figma の「お支払い期限日延長のお申込みフォーム」
   に合わせつつ、カラーは管理画面と同じ赤系で統一する。
   ====================================================================== */
.form-body {
  overflow-x: hidden;
  /* 東北電力ブランドの赤系トークン (admin と同系統) */
  --brand-primary: var(--red-600);
  --brand-grad: var(--grad-primary);
  --brand-grad-hover: var(--grad-primary-hover);
  --brand-soft: rgba(192, 41, 44, 0.08);
  --brand-text-strong: #0a0a0a;
  --brand-text-muted: #949494;
  --brand-border: #e8e8e8;
  --brand-input-bg-ocr: #f9f9f9;

  --grad-soft: linear-gradient(180deg, #ffffff 0%, #fdfaf6 100%);

  background: #ffffff;
}

/* トップバーは Figma にはないので、白背景・薄ボーダーで控えめに上書き */
.form-body .form-topbar {
  border-bottom-color: var(--brand-border);
}
.form-body .form-topbar .brand-mark {
  background: var(--brand-grad);
  box-shadow: 0 4px 10px rgba(192, 41, 44, 0.3);
}
.form-body .form-topbar .brand-system { color: var(--brand-text-muted); }

/* カード: Figma は枠線/影なしのプレーンレイアウトなので、シンプル化 */
.form-body .form-card {
  background: #ffffff;
  border: none;
  box-shadow: none;
  padding: 28px 30px 40px;
  border-radius: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.form-body .form-card h1 {
  color: var(--brand-primary);
  text-align: center;
  display: block;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.4;
  margin: 12px 0 24px;
}
.form-body .form-card .lead {
  color: var(--brand-text-strong);
  font-size: 14px;
  line-height: 1.65;
  margin-bottom: 16px;
}

/* セクション見出し: Figma の左端に縦バーが入るタイプ */
.form-body .section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 700;
  color: var(--brand-text-strong);
  margin: 32px 0 20px;
  line-height: 1.4;
}
.form-body .section-title::before {
  content: "";
  width: 6px;
  height: 32px;
  border-radius: 5px;
  background: var(--brand-text-strong);
  flex-shrink: 0;
}
.form-body .section-title.is-primary { color: var(--brand-primary); }
.form-body .section-title.is-primary::before { background: var(--brand-primary); }

/* 強調見出し (本文中の太字小見出し) */
.form-body .heading-strong {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand-text-strong);
  line-height: 1.5;
  margin: 24px 0 8px;
}
.form-body .heading-strong .heading-strong-note {
  color: var(--brand-text-muted);
  font-size: 12px;
  font-weight: 500;
  margin-left: 8px;
}

/* 注意事項ボックス (薄赤背景 + 赤テキスト。Figma レイアウトはそのままに配色のみ変更) */
.form-body .note-box {
  background: var(--brand-soft);
  border-radius: 20px;
  padding: 20px 22px;
  color: var(--brand-primary);
  font-size: 14px;
  line-height: 1.71;
  margin: 12px 0;
}
.form-body .note-box p { margin: 0; }
.form-body .note-box p + p { margin-top: 8px; }
.form-body .note-box .note-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
}
.form-body .note-box .note-list li {
  padding-left: 1.5em;
  text-indent: -1em;
}
.form-body .note-box .note-list li + li { margin-top: 12px; }

/* 区切り線 */
.form-body .form-divider {
  height: 1px;
  background: var(--brand-border);
  border: none;
  margin: 32px 0;
}

/* 同意チェックボックス */
.form-body .consent-check {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 16px;
  color: var(--brand-text-strong);
  cursor: pointer;
  margin: 32px 0 20px;
  user-select: none;
}
.form-body .consent-check input[type="checkbox"] {
  appearance: none;
  width: 24px;
  height: 24px;
  border: 1px solid var(--brand-text-muted);
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
  position: relative;
  transition: all .15s ease;
  flex-shrink: 0;
}
.form-body .consent-check input[type="checkbox"]:checked {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}
.form-body .consent-check input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 7px; top: 3px;
  width: 7px; height: 12px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* SMS 受信同意 (Figma 513:3739) */
.form-body .sms-consent-field {
  margin-top: 24px;
}
.form-body .sms-consent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.form-body .sms-consent input[type="checkbox"] {
  appearance: none;
  width: 24px;
  height: 24px;
  border: 1px solid var(--brand-text-muted);
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
  position: relative;
  transition: all .15s ease;
  flex-shrink: 0;
  margin-top: 2px;
}
.form-body .sms-consent input[type="checkbox"]:checked {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}
.form-body .sms-consent input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 7px; top: 3px;
  width: 7px; height: 12px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.form-body .sms-consent-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-body .sms-consent-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--brand-text-strong);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.form-body .sms-consent-note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--brand-text-muted);
}

/* 必須 / 任意バッジ */
.form-body .badge-required,
.form-body .badge-optional {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1;
  vertical-align: middle;
}
.form-body .badge-required { background: var(--brand-primary); }
.form-body .badge-optional { background: var(--brand-text-muted); }

/* フォームフィールド (Figma 準拠) */
.form-body .field {
  margin-bottom: 20px;
  max-width: 100%;
  min-width: 0;
}
.form-body .field-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 500;
  color: var(--brand-text-strong);
  margin-bottom: 10px;
  line-height: 1.4;
}
.form-body .field-help {
  color: var(--brand-text-muted);
  font-size: 12px;
  margin-top: 6px;
  line-height: 1.5;
}
.form-body .field-error {
  color: #d23f3f;
  font-size: 12px;
  margin-top: 6px;
  line-height: 1.5;
}
.form-body .zip-lookup-status {
  font-size: 12px;
  margin-top: 6px;
  line-height: 1.5;
  color: var(--brand-text-muted);
}
.form-body .zip-lookup-status.is-loading {
  color: var(--brand-text-muted);
}
.form-body .zip-lookup-status.is-success {
  color: #2e7d32;
}
.form-body .zip-lookup-status.is-error {
  color: #d23f3f;
}

/* 入力 / select / textarea: Figma は 56px 高、角丸 4px、ボーダー #e8e8e8 */
.form-body .field-input,
.form-body .select,
.form-body .textarea {
  width: 100%;
  min-height: 56px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--brand-border);
  border-radius: 4px;
  font-family: inherit;
  font-size: 16px;
  color: var(--brand-text-strong);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-body .field-input::placeholder,
.form-body .textarea::placeholder { color: var(--brand-text-muted); }
.form-body .field-input:hover,
.form-body .select:hover,
.form-body .textarea:hover { border-color: var(--brand-primary); }
.form-body .field-input:focus,
.form-body .select:focus,
.form-body .textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(192, 41, 44, 0.15);
}

/* 必須項目: 未入力時は赤枠で未完了を示す */
.form-body .field-input.is-field-incomplete,
.form-body .select.is-field-incomplete,
.form-body .textarea.is-field-incomplete {
  border-color: var(--red-500);
  background: var(--red-100);
}
.form-body .field-input.is-field-incomplete:hover,
.form-body .select.is-field-incomplete:hover,
.form-body .textarea.is-field-incomplete:hover {
  border-color: var(--red-500);
}
.form-body .field-input.is-field-incomplete:focus,
.form-body .select.is-field-incomplete:focus,
.form-body .textarea.is-field-incomplete:focus {
  border-color: var(--red-500);
  box-shadow: 0 0 0 3px rgba(210, 63, 63, 0.15);
}

/* OCR で自動入力された値 = 薄グレー背景に切り替え (Figma 準拠)。
   入力完了後のみ適用。未入力 (is-field-incomplete) のときは白背景＋赤枠を優先。 */
.form-body .field-input.is-ocr-filled:not(.is-field-incomplete) {
  background: var(--brand-input-bg-ocr);
}
.form-body .field-input.is-ocr-filled:not(.is-field-incomplete):focus {
  background: #ffffff;
}

/* CakePHP Form->control() のラッパー div.input を親幅に収める */
.form-body .field > .input,
.form-body .field > .input.date {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

/*
 * 日付入力 (iOS Safari)
 * - type="date" は inline-flex のため display:block は使わない
 * - flex ラッパー + WebKit 内部 padding リセットで親幅に収める
 * @see https://gomakethings.com/fixing-temporal-input-styling-in-safari/
 */
.form-body .field-date-wrap {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.form-body .field-date-wrap > .input,
.form-body .field-date-wrap > .input.date {
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.form-body .field-date-wrap input[type="date"].field-input {
  flex: 1 0 0;
  -webkit-flex: 1 0 0;
  width: 100%;
  min-width: 0;
  min-inline-size: 0;
  max-width: 100%;
  -webkit-min-logical-width: 0;
  box-sizing: border-box;
}

.form-body .field-date-wrap input[type="date"]::-webkit-datetime-edit,
.form-body .field-date-wrap input[type="date"]::-webkit-datetime-edit-fields-wrapper,
.form-body .field-date-wrap input[type="date"]::-webkit-datetime-edit-text,
.form-body .field-date-wrap input[type="date"]::-webkit-datetime-edit-day-field,
.form-body .field-date-wrap input[type="date"]::-webkit-datetime-edit-month-field,
.form-body .field-date-wrap input[type="date"]::-webkit-datetime-edit-year-field {
  padding: 0;
}

.form-body .field-date-wrap input[type="date"]::-webkit-date-and-time-value {
  min-width: 0;
  text-align: left;
}

.form-body .field-date-wrap input[type="date"]::-webkit-inner-spin-button {
  height: auto;
}

/* iOS: temporal input の width 100% を確実に効かせる */
@supports (-webkit-touch-callout: none) {
  .form-body .field-date-wrap input[type="date"].field-input {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
}

/* 行末に「円」などの単位を表示するための inline ラッパ */
.form-body .field-input-suffix {
  display: flex;
  align-items: center;
  gap: 12px;
}
.form-body .field-input-suffix .field-input { flex: 1; }
.form-body .field-input-suffix .suffix {
  color: var(--brand-text-strong);
  font-size: 16px;
  flex-shrink: 0;
}

/* ラジオボタングループ */
.form-body .radio-group {
  display: flex;
  gap: 32px;
  padding: 8px 0;
}
.form-body .radio-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  color: var(--brand-text-strong);
  cursor: pointer;
  user-select: none;
}
.form-body .radio-item input[type="radio"] {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--brand-text-muted);
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  position: relative;
  transition: all .15s ease;
  flex-shrink: 0;
}
.form-body .radio-item input[type="radio"]:checked {
  border-color: var(--brand-primary);
}
.form-body .radio-item input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 10px; height: 10px;
  background: var(--brand-primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

/* CTA ボタン (Figma の pill グラデーション・高さ 70px) */
.form-body .btn-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 70px;
  padding: 10px 20px;
  background: var(--brand-grad);
  color: #ffffff;
  border: none;
  border-radius: 3000px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow .15s ease, transform .12s ease, opacity .15s ease;
  box-shadow: 0 6px 18px rgba(192, 41, 44, 0.28);
  text-decoration: none;
}
.form-body .btn-pill:hover {
  background: var(--brand-grad-hover);
  box-shadow: 0 10px 24px rgba(192, 41, 44, 0.36);
  transform: translateY(-1px);
}
.form-body .btn-pill:disabled,
.form-body .btn-pill[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 確認画面: 修正するボタン (アウトライン) */
.form-body .btn-pill-outline {
  background: #ffffff;
  color: var(--brand-primary);
  border: 1px solid var(--brand-primary);
  box-shadow: none;
}
.form-body .btn-pill-outline:hover {
  background: #fff5f5;
  box-shadow: none;
}

/* 確認画面: 入力内容サマリー */
.form-body .confirm-summary {
  margin: 24px 0 0;
  border-top: 1px solid var(--brand-border);
}
.form-body .confirm-summary dt {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-text-muted);
  padding: 16px 0 4px;
}
.form-body .confirm-summary dd {
  margin: 0;
  padding: 0 0 16px;
  font-size: 16px;
  color: var(--brand-text-strong);
  border-bottom: 1px solid var(--brand-border);
  word-break: break-word;
}

/* 確認画面: ボタン列 */
.form-body .confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 32px;
}

/* 撮影前イラスト */
.form-body .illust {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 24px auto 12px;
}

/* OCR ステータス */
.form-body .ocr-status {
  margin-top: 16px;
  padding: 18px 20px;
  border-radius: 12px;
  font-size: 14px;
  border: 1px solid transparent;
  display: none;
  line-height: 1.5;
  align-items: center;
  gap: 14px;
}
.form-body .ocr-status.is-visible { display: flex; }

.form-body .ocr-status.is-error {
  background: var(--danger-bg);
  color: var(--danger-fg);
  border-color: #f5c2c2;
}
.form-body .ocr-status .ocr-status-text {
  flex: 1;
  min-width: 0;
}

/* くるくる回るスピナー (currentColor をなぞるので親の文字色に追従) */
.form-body .ocr-spinner {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 3px solid currentColor;
  border-top-color: transparent;
  border-right-color: transparent;
  opacity: 0.85;
  animation: ocr-spin 0.85s linear infinite;
}
@keyframes ocr-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* 入力画面トップに表示する OCR 失敗通知バナー */
.form-body .ocr-fail-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  margin: 0 0 20px;
  background: var(--warning-bg);
  color: var(--warning-fg);
  border: 1px solid var(--warning-bd);
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.65;
}
.form-body .ocr-fail-banner-icon {
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1.3;
}
.form-body .ocr-fail-banner-body { flex: 1; min-width: 0; }
.form-body .ocr-fail-banner-body strong { font-weight: 600; }

/* OCR / S3 デバッグパネル (DEBUG=true 時のみ input.php で出力) */
.form-body .ocr-debug-panel {
  margin: 24px auto 0;
  max-width: 640px;
  padding: 16px;
  background: #f8f4ff;
  border: 1px dashed var(--purple-300);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--ink-700);
}
.form-body .ocr-debug-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-primary);
}
.form-body .ocr-debug-block { margin-top: 12px; }
.form-body .ocr-debug-block:first-of-type { margin-top: 0; }
.form-body .ocr-debug-label {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
}
.form-body .ocr-debug-meta {
  margin: 0 0 8px;
  word-break: break-all;
}
.form-body .ocr-debug-meta code {
  font-family: ui-monospace, monospace;
  font-size: 11px;
}
.form-body .ocr-debug-image {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--ink-200);
  border-radius: 4px;
  background: #fff;
}
.form-body .ocr-debug-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0;
}
.form-body .ocr-debug-dl dt { font-weight: 600; margin: 0; }
.form-body .ocr-debug-dl dd { margin: 0; word-break: break-all; }
.form-body .ocr-debug-pre {
  margin: 0;
  padding: 10px;
  max-height: 280px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 手動入力リンク (撮影に進むボタンの下) */
.form-body .manual-input-link-wrap {
  margin: 14px 0 0;
  text-align: center;
}
.form-body .manual-input-link {
  display: inline-block;
  color: var(--brand-text-muted);
  font-size: 14px;
  text-decoration: underline;
  padding: 6px 8px;
}
.form-body .manual-input-link:hover,
.form-body .manual-input-link:focus-visible {
  color: var(--brand-primary);
}

/* ======================================================================
   OCR ライブカメラ画面 (Figma: 払込用紙の読み取り / node 281:29)
   白背景。上部の枠 (.camera-preview) 内にだけ映像を表示し、
   その下に撮影のポイント、最下部にシャッターを置く。
   ====================================================================== */
/* カメラ表示中は背面のフォームをスクロールさせない */
.form-body.camera-open { overflow: hidden; }

.camera-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.camera-screen[hidden] { display: none; }

/* 上部バー (黒背景・中央タイトル・左に戻る) */
.camera-topbar {
  position: relative;
  flex: 0 0 auto;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.camera-topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}
.camera-back {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: #ffffff;
  border-radius: 50%;
  cursor: pointer;
}
.camera-back:hover { background: rgba(255, 255, 255, 0.12); }
.camera-back svg { width: 22px; height: 22px; }

/* 中央コンテンツ (プレビュー枠 + 撮影のポイント)。あふれたらスクロール */
.camera-stage {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 読み取り枠内プレビュー。映像はこの枠内にだけ object-fit: cover で表示する */
.camera-preview {
  position: relative;
  width: 100%;
  height: 46vh;
  max-height: 420px;
  background: #1a1a1a;
  overflow: hidden;
}
.camera-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #1a1a1a;
}

/* 四隅の L 字ガイド (全周は囲わず角だけ白枠で示す) */
.camera-corners {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.camera-corners .cc {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 3px solid #ffffff;
}
.camera-corners .cc-tl {
  top: 0;
  left: 0;
  border-right: none;
  border-bottom: none;
  border-top-left-radius: 4px;
}
.camera-corners .cc-tr {
  top: 0;
  right: 0;
  border-left: none;
  border-bottom: none;
  border-top-right-radius: 4px;
}
.camera-corners .cc-bl {
  bottom: 0;
  left: 0;
  border-right: none;
  border-top: none;
  border-bottom-left-radius: 4px;
}
.camera-corners .cc-br {
  bottom: 0;
  right: 0;
  border-left: none;
  border-top: none;
  border-bottom-right-radius: 4px;
}

/* 撮影のポイント (黒背景に白文字) */
.camera-hints {
  padding: 28px 24px;
  color: #ffffff;
}
.camera-hints-title {
  margin: 0 0 16px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}
.camera-hints-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.8;
}
.camera-hints-list li {
  padding-left: 1.5em;
  text-indent: -1.5em;
}
.camera-hints-list li::before { content: "\2713\00a0"; }

/* シャッターバー (下部・黒背景) */
.camera-shutter-bar {
  flex: 0 0 auto;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}
.camera-shutter {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: #ffffff;
  color: var(--brand-text-strong);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  transition: transform .1s ease, opacity .15s ease;
}
.camera-shutter:active { transform: scale(0.94); }
.camera-shutter:disabled,
.camera-shutter[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}
.camera-shutter svg { width: 28px; height: 28px; }

/* 撮影〜OCR 中のローディングオーバーレイ */
.camera-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  background: rgba(10, 10, 10, 0.7);
  color: #ffffff;
  text-align: center;
}
.camera-loading[hidden] { display: none; }
.camera-loading .ocr-spinner { opacity: 1; }
.camera-loading-text { font-size: 15px; line-height: 1.6; }

/* スマホ幅で左右マージン調整 */
@media (max-width: 480px) {
  .form-body .form-main {
    padding-left: 16px;
    padding-right: 16px;
  }
  .form-body .form-card {
    padding: 20px 18px 32px;
    max-width: 100%;
    overflow-x: clip;
  }
  .form-body #application-form {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .form-body .section-title { font-size: 20px; }
  .form-body .section-title::before { height: 26px; }
}

/* Login */
.login-page {
  min-height: 100vh;
  display: grid; place-items: center;
  background: var(--grad-soft);
  padding: 24px;
}
.login-wrap {
  width: 100%;
  max-width: 380px;
}
.login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px 32px 28px;
  width: 100%;
  max-width: 380px;
  border: 1px solid var(--ink-200);
}
.login-card h1 {
  font-size: 18px;
  margin: 0 0 4px;
  display: flex; align-items: center; gap: 10px;
}
.login-card .subtitle { color: var(--ink-500); font-size: 12.5px; margin: 0 0 24px; }

/* ===== Admin detail edit ===== */
.detail-table-wrap {
  max-height: 480px;
  overflow-y: auto;
  scrollbar-color: var(--beige-300) transparent;
}
.detail-table-wrap::-webkit-scrollbar { width: 8px; }
.detail-table-wrap::-webkit-scrollbar-thumb { background: var(--beige-300); border-radius: 4px; }

.detail-with-image { display: block; margin-bottom: 18px; }
.detail-with-image.has-image {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
  align-items: stretch;
}
.detail-with-image.has-image > .card { margin-top: 0; }
@media (max-width: 1100px) {
  .detail-with-image.has-image { grid-template-columns: 1fr; }
}

/* ===== 払込票画像カード (詳細画面の右側カード内でのズーム + パン) ===== */
.payment-slip-card .card-header { gap: 8px; }
.payment-slip-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.payment-slip-zoom-btn,
.payment-slip-link-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  color: var(--ink-700);
  cursor: pointer;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  padding: 0;
  transition: all .12s ease;
}
.payment-slip-zoom-btn:hover:not(:disabled),
.payment-slip-link-btn:hover {
  background: var(--purple-50);
  color: var(--purple-700);
  border-color: var(--purple-200);
}
.payment-slip-zoom-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.payment-slip-zoom-level {
  min-width: 44px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-700);
  font-family: var(--font-num);
  user-select: none;
}
.payment-slip-body {
  height: 480px;             /* 詳細情報カード (.detail-table-wrap max-height: 480px) と揃える */
  padding: 12px;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink-50);
}
/* ズーム時、画像が body より大きくなった場合の中央寄せ → 左上寄せに切り替え
   (flex centering と scroll の挙動が衝突するのを避ける) */
.payment-slip-body.has-zoomed-image {
  align-items: flex-start;
  justify-content: flex-start;
}
.payment-slip-body.is-pannable { cursor: grab; }
.payment-slip-body.is-pannable.is-panning { cursor: grabbing; }
.payment-slip-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  cursor: zoom-in;
  border-radius: 4px;
}
/* ズーム時のサイズは JS で width/height を直接指定する (CSS では制約だけ外す) */
.payment-slip-image.is-zoomed {
  max-width: none;
  max-height: none;
  object-fit: initial;
  cursor: zoom-out;
  border-radius: 0;
}
.payment-slip-body.is-pannable .payment-slip-image.is-zoomed { cursor: grab; }
.payment-slip-body.is-pannable.is-panning .payment-slip-image.is-zoomed { cursor: grabbing; }

table.detail.detail-edit tbody tr:hover td { background: var(--ink-50); }
table.detail.detail-edit .col-star {
  width: 36px;
  text-align: center;
  padding-left: 18px !important;
  padding-right: 0 !important;
}
table.detail.detail-edit .col-label { width: 22%; min-width: 160px; }
table.detail.detail-edit .col-original { width: 32%; }
table.detail.detail-edit .col-edit { width: 46%; }

.star-mark {
  display: inline-block;
  color: var(--red-600);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

tr.is-editable .col-label { color: var(--ink-900); font-weight: 600; }
tr.is-readonly .col-label,
tr.is-readonly .col-original { color: var(--ink-500); }
tr.is-readonly .col-edit { background: var(--ink-50); }

/* CakePHP Form->control() のラッパー div.input には枠を付けない（実 input のみ） */
.page div.input,
.page div.select,
.page div.textarea {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.page input.input,
.page select.select,
.page textarea.textarea {
  width: 100%;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-900);
  transition: all .15s ease;
}
.page input.input:hover,
.page select.select:hover,
.page textarea.textarea:hover { border-color: var(--purple-300); }
.page input.input:focus,
.page select.select:focus,
.page textarea.textarea:focus {
  outline: none;
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(210, 63, 63, 0.15);
}
.page input.input.is-readonly {
  background: transparent;
  color: var(--ink-700);
  border-color: transparent;
  cursor: default;
  pointer-events: none;
  padding-left: 0;
  padding-right: 0;
}
.page select.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23c0292c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.page textarea.textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.65;
}
.page .textarea-meta {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  color: var(--ink-500);
  font-size: 12px;
}
.page .field-error {
  margin-top: 4px;
  font-size: 12px;
  color: var(--red-600);
}

table.change-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
table.change-table thead th {
  background: #fbf7ee;
  color: var(--ink-500);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  padding: 12px 18px;
  border-bottom: 1px solid var(--ink-200);
}
table.change-table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--ink-100);
  vertical-align: middle;
}
table.change-table tbody tr:last-child td { border-bottom: none; }
table.change-table .change-label {
  width: 20%;
  min-width: 140px;
  color: var(--ink-700);
  font-weight: 500;
}
table.change-table .change-before,
table.change-table .change-after { width: 40%; }

.action-bar {
  position: sticky;
  bottom: 16px;
  z-index: 10;
  margin-top: 24px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--ink-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 14px;
}
.action-bar-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-500);
  font-size: 13px;
}
.action-bar-info[hidden] {
  display: none !important;
}
.action-bar-info-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning-fg);
}
.action-bar-spacer { flex: 1; }
.btn-lg { padding: 12px 28px; font-size: 14px; }
.btn-subtle {
  background: var(--ink-50);
  color: var(--ink-700);
  border-color: var(--ink-200);
}
.btn-subtle:hover {
  background: var(--ink-100);
  color: var(--ink-900);
}

.page .input label,
.page .form-group label { display: none; }
.page .input input,
.page .input select,
.page .input textarea,
.page .form-group input,
.page .form-group select,
.page .form-group textarea { margin: 0; }

/* ============== SMS送信ブロック ============== */
.sms-card .card-header-meta .is-warning {
  color: var(--warning-fg);
}
.sms-compose {
  padding: 0 22px 16px;
}
.sms-textarea {
  width: 100%;
  resize: vertical;
  min-height: 100px;
}
.sms-textarea:disabled {
  background: var(--ink-50);
  color: var(--ink-400);
  cursor: not-allowed;
}
.sms-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}
.sms-history {
  padding: 0 22px 22px;
  border-top: 1px solid var(--ink-100);
  margin-top: 8px;
  padding-top: 16px;
}
.sms-history-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
  margin: 0 0 10px;
}
.sms-history-empty {
  font-size: 12px;
  color: var(--ink-400);
  padding: 8px 0;
}
.sms-history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.sms-history-table th,
.sms-history-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--ink-100);
  vertical-align: top;
  text-align: left;
}
.sms-history-table thead th {
  font-weight: 600;
  color: var(--ink-600);
  background: var(--ink-50);
  border-bottom: 1px solid var(--ink-200);
}
.sms-history-col-time { width: 150px; }
.sms-history-col-status { width: 110px; }
.sms-history-col-user { width: 120px; }
.sms-history-body {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-800);
}
.sms-history-error {
  margin-top: 4px;
  font-size: 11px;
  color: var(--danger-fg);
}

/* ===== 未対応アラート通知 (一覧画面・右上スタック) ===== */
.alert-panel {
  position: fixed;
  top: 76px;
  right: 20px;
  z-index: 1200;
  width: 340px;
  max-width: calc(100vw - 40px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.alert-panel[hidden] { display: none; }
.alert-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--danger-fg);
  border-radius: var(--radius-pill);
  background: var(--danger-fg);
  color: #fff;
  font-family: var(--font-jp);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: filter 0.15s ease;
}
.alert-panel-header:hover { filter: brightness(1.06); }
.alert-panel-header.alert-pulse {
  animation: alert-pulse 0.9s ease;
}
@keyframes alert-pulse {
  0%   { transform: translateX(0);    box-shadow: var(--shadow-md), 0 0 0 0 rgba(197, 62, 62, 0.55); filter: brightness(1); }
  15%  { transform: translateX(-5px); filter: brightness(1.25); }
  30%  { transform: translateX(5px); }
  45%  { transform: translateX(-4px); }
  60%  { transform: translateX(4px);  box-shadow: var(--shadow-md), 0 0 0 8px rgba(197, 62, 62, 0); }
  75%  { transform: translateX(-2px); filter: brightness(1.25); }
  100% { transform: translateX(0);    box-shadow: var(--shadow-md), 0 0 0 0 rgba(197, 62, 62, 0); filter: brightness(1); }
}
@media (prefers-reduced-motion: reduce) {
  .alert-panel-header.alert-pulse { animation: none; }
}
.alert-panel-bell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: none;
}
.alert-panel-count { font-family: var(--font-num); }
.alert-panel-chevron {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}
.alert-panel.is-collapsed .alert-panel-chevron { transform: rotate(-90deg); }
.alert-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  pointer-events: none;
}
.alert-panel.is-collapsed .alert-stack {
  display: none;
}
.alert-stack::-webkit-scrollbar { width: 0; height: 0; }
.alert-toast {
  pointer-events: auto;
  position: relative;
  display: block;
  padding: 12px 36px 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--danger-fg);
  border-left: 4px solid var(--danger-fg);
  background: #fff;
  box-shadow: var(--shadow-lg);
  color: var(--ink-900);
  cursor: pointer;
  text-align: left;
  transform: translateX(24px);
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
}
.alert-toast.is-visible {
  transform: translateX(0);
  opacity: 1;
}
.alert-toast.is-leaving {
  transform: translateX(24px);
  opacity: 0;
}
.alert-toast:hover {
  box-shadow: var(--shadow-lg), 0 0 0 3px var(--danger-bg);
}
.alert-toast-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.alert-toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--danger-fg);
}
.alert-toast-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--danger-fg);
}
.alert-toast-type {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-500);
  background: var(--ink-100);
  border-radius: var(--radius-pill);
  padding: 1px 9px;
}
.alert-toast-body {
  font-size: 13px;
  line-height: 1.5;
}
.alert-toast-name {
  font-weight: 600;
}
.alert-toast-meta {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--ink-500);
  font-family: var(--font-num);
}
.alert-toast-elapsed {
  color: var(--danger-fg);
  font-weight: 700;
}

