/* ============================================================
   振込管理システム｜株式会社一心ホールディングス
   カラー: ネイビー / ブルー / 白
============================================================ */
:root {
  --navy-900: #0b1f3f;
  --navy-800: #10294f;
  --navy-700: #16355f;
  --navy-600: #1e4276;
  --blue-600: #1d5fd6;
  --blue-500: #2e6fe3;
  --blue-400: #4d87ea;
  --blue-100: #dbe7f9;
  --blue-50: #eef4fc;
  --bg: #f4f7fb;
  --white: #ffffff;
  --text: #1a2436;
  --text-sub: #5a6b84;
  --line: #d8e1ee;
  --danger: #d43d3d;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(11, 31, 63, .07);
  --shadow-lg: 0 10px 34px rgba(11, 31, 63, .16);
  --font: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ============ ヘッダー ============ */
.app-header {
  background: linear-gradient(120deg, var(--navy-900) 0%, var(--navy-700) 55%, #1c4a8f 100%);
  color: #fff;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}
.app-header__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.app-header__brand { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; }
.app-header__logo-chip {
  background: #fff;
  border-radius: 8px;
  padding: 5px 10px;
  display: flex;
  align-items: center;
}
.app-header__logo-chip img { height: 26px; width: auto; }
.app-header__titles { display: flex; flex-direction: column; line-height: 1.3; }
.app-header__company { font-size: 12px; letter-spacing: .06em; opacity: .85; }
.app-header__system { font-size: 19px; font-weight: 700; letter-spacing: .12em; }

.app-nav { display: flex; gap: 4px; }
.app-nav__btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  color: rgba(255, 255, 255, .75);
  border: none;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 18px;
  border-radius: 10px 10px 0 0;
  transition: background .15s, color .15s;
}
.app-nav__btn:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.app-nav__btn.is-active {
  background: var(--bg);
  color: var(--navy-800);
  font-weight: 700;
}

/* ============ 設定バナー ============ */
.config-banner {
  max-width: 1080px;
  margin: 16px auto -6px;
  padding: 12px 18px;
  background: #fff7e6;
  border: 1px solid #f0d9a8;
  border-radius: 10px;
  color: #7a5b13;
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.config-banner code { background: #f3e8cd; padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }

/* ============ レイアウト ============ */
.app-main { max-width: 1080px; margin: 0 auto; padding: 26px 20px 70px; }
.panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.panel__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--blue-50);
}
.panel__title {
  font-size: 19px;
  font-weight: 700;
  color: var(--navy-800);
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel__title::before {
  content: "";
  width: 5px;
  height: 22px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--blue-500), var(--navy-700));
}
.panel__badge {
  background: var(--blue-600);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 999px;
}
.panel__head .btn { margin-left: auto; }

/* ============ フォーム ============ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 26px;
}
.field--full { grid-column: 1 / -1; }
.field__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--navy-800);
  margin-bottom: 7px;
}
.req {
  background: #fdecec;
  color: var(--danger);
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
}
.opt { color: var(--text-sub); font-size: 11.5px; font-weight: 400; }
.field__hint { font-size: 12px; color: var(--text-sub); margin-top: 5px; }

.input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  padding: 11px 14px;
  font-size: 16px;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
  min-height: 46px;
}
.input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(46, 111, 227, .14);
}
.input--select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235a6b84' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
.input--textarea { resize: vertical; min-height: 84px; line-height: 1.7; }
.input--amount { text-align: right; font-weight: 700; font-size: 18px; letter-spacing: .02em; }
.input.is-error { border-color: var(--danger); }

.field__with-suffix, .field__with-prefix { display: flex; align-items: center; gap: 8px; }
.field__with-suffix .input, .field__with-prefix .input { flex: 1; }
.field__suffix, .field__prefix { color: var(--text-sub); font-size: 15px; font-weight: 500; white-space: nowrap; }
.field__prefix { font-size: 17px; font-weight: 700; color: var(--navy-700); }

.form-actions {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--blue-50);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.form-actions__main { display: flex; gap: 12px; flex-wrap: wrap; }

/* ============ ボタン ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 24px;
  min-height: 46px;
  transition: transform .06s, box-shadow .15s, background .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary {
  background: linear-gradient(120deg, var(--blue-600), var(--navy-700));
  color: #fff;
  box-shadow: 0 4px 14px rgba(29, 95, 214, .32);
}
.btn--primary:hover { box-shadow: 0 6px 18px rgba(29, 95, 214, .42); }
.btn--secondary {
  background: var(--blue-50);
  color: var(--navy-700);
  border: 1.5px solid var(--blue-100);
}
.btn--secondary:hover { background: var(--blue-100); }
.btn--ghost {
  background: transparent;
  color: var(--text-sub);
  border: 1.5px solid var(--line);
}
.btn--ghost:hover { background: #f2f5fa; color: var(--navy-700); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #bb3030; }
.btn--sm { padding: 8px 14px; font-size: 13px; min-height: 36px; }

/* ============ 検索・絞り込み ============ */
.filters {
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.filters__row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filters__item { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.filters__item--grow { flex: 1; min-width: 180px; }
.filters__item--btn { justify-content: flex-end; }
.filters__label { font-size: 11.5px; font-weight: 700; color: var(--navy-700); }
.input--sm { min-height: 40px; padding: 8px 12px; font-size: 14px; }

.result-count { font-size: 12.5px; color: var(--text-sub); margin-bottom: 10px; }

/* ============ 履歴テーブル（PC） ============ */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--line); }
.history-table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
.history-table th {
  background: var(--navy-800);
  color: #fff;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: .05em;
  text-align: left;
  padding: 11px 14px;
  white-space: nowrap;
}
.history-table td {
  padding: 11px 14px;
  border-top: 1px solid var(--blue-50);
  vertical-align: middle;
  white-space: nowrap;
}
.history-table tbody tr:hover { background: #f7faff; }
.history-table tbody tr.is-overdue-row { background: #fff5f5; }
.history-table tbody tr.is-overdue-row:hover { background: #ffeeee; }
.ta-r { text-align: right; }
.ta-c { text-align: center; }
.cell-name { font-weight: 700; color: var(--navy-800); }
.cell-person--none { color: #b0bccd; }
.person-chip {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy-700);
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: 999px;
  padding: 2px 11px;
  white-space: nowrap;
}
.cell-amount { font-weight: 700; text-align: right; letter-spacing: .01em; }
.cell-actions { display: flex; gap: 5px; justify-content: center; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-sub);
  border-radius: 7px;
  padding: 6px 9px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: all .13s;
}
.icon-btn:hover { border-color: var(--blue-400); color: var(--blue-600); background: var(--blue-50); }
.icon-btn--danger:hover { border-color: var(--danger); color: var(--danger); background: #fdecec; }

/* ============ ステータスバッジ ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--draft    { background: #eef1f5; color: #5f6b7d; }
.badge--sent     { background: #e3edfc; color: #1d5fd6; }
.badge--waiting  { background: #fdf0e0; color: #c26a0a; }
.badge--paid     { background: #e2f5e9; color: #1d8a4b; }
.badge--overdue  { background: #fde5e5; color: #c93030; }
.badge--cancel   { background: #e2e4e9; color: #3f4756; }

.overdue-alert {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #c93030;
  background: #fde5e5;
  border: 1px solid #f5b8b8;
  padding: 2px 9px;
  border-radius: 999px;
  margin-left: 6px;
}

.status-select {
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12.5px;
  padding: 5px 26px 5px 9px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235a6b84' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 8px center;
  -webkit-appearance: none;
  appearance: none;
  color: var(--text);
  cursor: pointer;
}
.status-select:focus { outline: none; border-color: var(--blue-500); }

/* ============ 履歴カード（スマホ） ============ */
.card-list { display: none; flex-direction: column; gap: 12px; }
.h-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 15px 16px;
  box-shadow: 0 1px 4px rgba(11, 31, 63, .05);
}
.h-card.is-overdue-row { border-color: #f0b9b9; background: #fffafa; }
.h-card__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.h-card__name { font-size: 16.5px; font-weight: 700; color: var(--navy-800); }
.h-card__amount { font-size: 19px; font-weight: 900; color: var(--navy-800); letter-spacing: .01em; }
.h-card__rows { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 10px; font-size: 13px; }
.h-card__row { display: flex; gap: 8px; }
.h-card__row dt { color: var(--text-sub); min-width: 66px; }
.h-card__row dd { font-weight: 500; }
.h-card__status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.h-card__actions { display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px dashed var(--line); padding-top: 10px; }
.h-card__actions .icon-btn { flex: 1; justify-content: center; padding: 9px 6px; font-size: 12px; }

/* ============ 空・ローディング ============ */
.empty-state { text-align: center; color: var(--text-sub); padding: 46px 0; font-size: 14px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--text-sub); padding: 40px 0; font-size: 14px; }
.spinner {
  width: 20px; height: 20px;
  border: 3px solid var(--blue-100);
  border-top-color: var(--blue-600);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  display: inline-block;
}
.spinner--lg { width: 34px; height: 34px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ モーダル ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 31, 63, .45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal--sm { max-width: 420px; }
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--navy-800);
  color: #fff;
}
.modal__title { font-size: 16px; font-weight: 700; }
.modal__close {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.8);
  font-size: 26px;
  line-height: 1;
  padding: 0 4px;
}
.modal__close:hover { color: #fff; }
.modal__body { padding: 20px; overflow-y: auto; }
.modal__foot {
  padding: 14px 20px;
  border-top: 1px solid var(--blue-50);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.modal__caution { color: var(--danger); font-size: 12.5px; margin-top: 6px; }

.detail-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.detail-table th {
  text-align: left;
  color: var(--text-sub);
  font-weight: 600;
  padding: 9px 12px 9px 0;
  width: 110px;
  vertical-align: top;
  white-space: nowrap;
}
.detail-table td { padding: 9px 0; border-bottom: 1px solid var(--blue-50); }
.detail-table tr:last-child td { border-bottom: none; }
.detail-memo { white-space: pre-wrap; }

/* ============ PDF生成オーバーレイ・トースト ============ */
.pdf-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(255,255,255,.75);
  display: flex; align-items: center; justify-content: center;
}
.pdf-overlay__box {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
  padding: 30px 44px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  color: var(--navy-800); font-weight: 700;
}
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy-800);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 26px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  max-width: calc(100vw - 40px);
  text-align: center;
  animation: toast-in .25s ease;
}
.toast--error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ============================================================
   PDFテンプレート（A4縦 794×1123px 固定・端末サイズの影響なし）
============================================================ */
.pdf-stage {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 794px;
  overflow: hidden;
  pointer-events: none;
}
.pdf-page {
  width: 794px;
  height: 1123px;
  background: #ffffff;
  position: relative;
  font-family: var(--font);
  color: #1a2436;
  display: flex;
  flex-direction: column;
}
.pdf-accent {
  height: 14px;
  background: linear-gradient(90deg, #0b1f3f 0%, #16355f 35%, #1d5fd6 75%, #7fb0f2 100%);
}
.pdf-body {
  flex: 1;
  padding: 40px 62px 30px;
  display: flex;
  flex-direction: column;
}
.pdf-header { text-align: center; margin-bottom: 26px; }
.pdf-title {
  font-size: 34px;
  font-weight: 900;
  color: #0b1f3f;
  letter-spacing: .34em;
  text-indent: .34em;
}
.pdf-title-rule { display: flex; justify-content: center; margin-top: 12px; }
.pdf-title-rule span {
  width: 260px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, #1d5fd6 30%, #1d5fd6 70%, transparent);
  display: block;
}
.pdf-customer {
  font-size: 21px;
  font-weight: 700;
  color: #0b1f3f;
  border-bottom: 2px solid #10294f;
  display: table;
  padding: 0 6px 4px 2px;
  margin-bottom: 18px;
}
.pdf-customer-sama { margin-left: 6px; font-size: 18px; }
.pdf-greeting { font-size: 14px; line-height: 1.9; color: #2a3547; margin-bottom: 24px; }

.pdf-cards { display: flex; gap: 16px; margin-bottom: 24px; }
.pdf-card { border-radius: 12px; padding: 18px 24px 16px; }
.pdf-card--amount {
  flex: 1.35;
  background: linear-gradient(125deg, #0b1f3f 0%, #16355f 55%, #1d4fa8 100%);
  color: #fff;
  text-align: center;
  box-shadow: 0 4px 16px rgba(11,31,63,.22);
}
.pdf-card--due {
  flex: 1;
  background: #ffffff;
  border: 2px solid #c7d9f3;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.pdf-card__label {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .28em;
  text-indent: .28em;
  color: #a8c4ec;
  margin-bottom: 6px;
}
.pdf-card__label--navy { color: #1d5fd6; }
.pdf-card__amount {
  font-size: 44px;
  font-weight: 900;
  letter-spacing: .01em;
  line-height: 1.15;
  white-space: nowrap;
}
.pdf-card__tax { font-size: 13px; margin-top: 3px; color: #cfdef5; font-weight: 500; }
.pdf-card__due { font-size: 21px; font-weight: 900; color: #0b1f3f; line-height: 1.3; }
.pdf-card__due-made { font-size: 14px; font-weight: 700; color: #16355f; margin-top: 2px; }

.pdf-bank {
  background: #eef4fc;
  border: 1px solid #d9e6f8;
  border-radius: 12px;
  padding: 20px 26px;
  margin-bottom: 22px;
}
.pdf-bank__title {
  font-size: 15px;
  font-weight: 900;
  color: #0b1f3f;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.pdf-bank__title::before {
  content: "";
  width: 4px; height: 17px; border-radius: 2px;
  background: #1d5fd6;
}
.pdf-bank__table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.pdf-bank__table th {
  text-align: left;
  color: #4a5c78;
  font-weight: 700;
  width: 118px;
  padding: 7px 8px 7px 2px;
  border-bottom: 1px solid #d9e6f8;
  vertical-align: middle;
}
.pdf-bank__table td {
  padding: 7px 0;
  border-bottom: 1px solid #d9e6f8;
  font-weight: 700;
  color: #10294f;
  letter-spacing: .02em;
  vertical-align: middle;
}
.pdf-bank__table tr:last-child th, .pdf-bank__table tr:last-child td { border-bottom: none; }

.pdf-notes { margin-bottom: 10px; }
.pdf-notes__title {
  font-size: 13px;
  font-weight: 900;
  color: #16355f;
  margin-bottom: 6px;
}
.pdf-notes ul { list-style: none; }
.pdf-notes li {
  font-size: 12.5px;
  color: #3c4a60;
  line-height: 1.8;
  padding-left: 15px;
  position: relative;
}
.pdf-notes li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .72em;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #1d5fd6;
}

.pdf-footer { margin-top: auto; }
.pdf-footer__rule {
  height: 2px;
  background: linear-gradient(90deg, #10294f, #1d5fd6 60%, #dbe7f9);
  border-radius: 1px;
  margin-bottom: 16px;
}
.pdf-footer__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.pdf-footer__logo { height: 44px; width: auto; }
.pdf-footer__info { text-align: right; font-size: 11.5px; color: #4a5c78; line-height: 1.7; }
.pdf-footer__company { font-size: 14px; font-weight: 900; color: #0b1f3f; margin-bottom: 2px; }
.pdf-footer__person {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: #16355f;
  background: #eef4fc;
  border: 1px solid #d9e6f8;
  border-radius: 999px;
  padding: 2px 14px;
  margin-bottom: 6px;
}

/* ============================================================
   レスポンシブ
============================================================ */
@media (max-width: 860px) {
  .app-header__inner { padding: 12px 14px 0; }
  .app-nav { width: 100%; }
  .app-nav__btn { flex: 1; justify-content: center; padding: 12px 8px; font-size: 13px; }
  .app-main { padding: 18px 12px 60px; }
  .panel { padding: 20px 16px; border-radius: 12px; }
  .form-grid { grid-template-columns: 1fr; gap: 18px; }
  .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .form-actions__main { flex-direction: column; }
  .form-actions .btn { width: 100%; }
  .filters__row { flex-direction: column; align-items: stretch; }
  .filters__item { min-width: 0; }

  /* テーブル→カード */
  .table-wrap { display: none; }
  .card-list { display: flex; }
}
@media (min-width: 861px) {
  .card-list { display: none !important; }
}
