/* ===========================
   リセット & ベース
   =========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-width: 240px;
  --header-height: 60px;
  --color-primary: #1a5fa8;
  --color-primary-dark: #134a87;
  --color-primary-light: #e8f0fc;
  --color-orange: #e67e22;
  --color-orange-light: #fef3e2;
  --color-green: #27ae60;
  --color-green-light: #eafaf1;
  --color-red: #e74c3c;
  --color-red-light: #fdf0ef;
  --color-purple: #8e44ad;
  --color-purple-light: #f5eefa;
  --color-gray: #6b7280;
  --color-gray-light: #f3f4f6;
  --color-border: #e5e7eb;
  --color-bg: #f0f4fa;
  --color-white: #ffffff;
  --color-text: #111827;
  --color-text-muted: #6b7280;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.15);
  --radius: 10px;
  --radius-sm: 6px;
  --transition: .2s ease;
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg);
  display: flex;
  min-height: 100vh;
}

/* ===========================
   サイドバー
   =========================== */
#sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0f2d5c 0%, #1a5fa8 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  font-size: 16px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.12);
  letter-spacing: .02em;
}
.sidebar-logo i { font-size: 20px; color: #7eb8f7; }

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background var(--transition), color var(--transition);
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active {
  background: rgba(255,255,255,.15);
  color: #fff;
  border-left-color: #7eb8f7;
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; }

.badge {
  background: #e74c3c;
  color: #fff;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  margin-left: auto;
  min-width: 20px;
  text-align: center;
  display: none;
}
.badge.show { display: inline-block; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.12);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255,255,255,.7);
}
.sidebar-footer i { font-size: 20px; }

/* ===========================
   メインコンテンツ
   =========================== */
#main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#top-header {
  height: var(--header-height);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

#sidebar-toggle {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--color-gray);
  display: none;
}

.header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
}

.header-actions {
  margin-left: auto;
  color: var(--color-text-muted);
  font-size: 13px;
}

/* ===========================
   ビュー（ページ）
   =========================== */
.view { display: none; padding: 24px; }
.view.active { display: block; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
}

/* ===========================
   カード
   =========================== */
.card {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-white);
}
.card-header h2 {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header h2 i { color: var(--color-primary); }

.card-body { padding: 20px; }

/* ===========================
   ダッシュボード統計
   =========================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--color-white);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.blue { background: var(--color-primary-light); color: var(--color-primary); }
.stat-icon.orange { background: var(--color-orange-light); color: var(--color-orange); }
.stat-icon.green { background: var(--color-green-light); color: var(--color-green); }
.stat-icon.purple { background: var(--color-purple-light); color: var(--color-purple); }

.stat-label {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}

/* ===========================
   ダッシュボードグリッド
   =========================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ===========================
   テーブル
   =========================== */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 700px;
}

.data-table thead tr {
  background: var(--color-gray-light);
}
.data-table th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #fafbfc; }

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  font-size: 13px;
  color: var(--color-text-muted);
}

.pagination {
  display: flex;
  gap: 4px;
}
.pagination button {
  padding: 5px 10px;
  border: 1px solid var(--color-border);
  background: var(--color-white);
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  transition: background var(--transition);
}
.pagination button:hover { background: var(--color-gray-light); }
.pagination button.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* ===========================
   バッジ・ステータス
   =========================== */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.status-badge.new { background: #e8f0fc; color: #1a5fa8; }
.status-badge.jlease-wait { background: #fef3e2; color: #d35400; }
.status-badge.approved { background: #eafaf1; color: #1e8449; }
.status-badge.rejected { background: #fdf0ef; color: #c0392b; }
.status-badge.contract-prep { background: #f5eefa; color: #7d3c98; }
.status-badge.contract-sent { background: #e8f8f5; color: #1a7c5a; }
.status-badge.completed { background: #d5f5e3; color: #1e6640; }
.status-badge.cancelled { background: #f2f3f4; color: #6b7280; }

.jlease-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.jlease-badge.pending { background: #fef3e2; color: #d35400; }
.jlease-badge.approved { background: #eafaf1; color: #1e8449; }
.jlease-badge.rejected { background: #fdf0ef; color: #c0392b; }
.jlease-badge.unsubmitted { background: #f2f3f4; color: #6b7280; }

/* ===========================
   ボタン
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background var(--transition), box-shadow var(--transition), transform .1s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn-primary:hover { background: var(--color-primary-dark); }

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-outline:hover { background: var(--color-primary-light); }

.btn-orange {
  background: var(--color-orange);
  color: #fff;
  border-color: var(--color-orange);
}
.btn-orange:hover { background: #d35400; }

.btn-green {
  background: var(--color-green);
  color: #fff;
  border-color: var(--color-green);
}
.btn-green:hover { background: #1e8449; }

.btn-red {
  background: var(--color-red);
  color: #fff;
  border-color: var(--color-red);
}
.btn-red:hover { background: #c0392b; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11.5px; }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 14px;
  transition: background var(--transition), color var(--transition);
}
.btn-icon:hover { background: var(--color-gray-light); color: var(--color-primary); }

.btn-group { display: flex; gap: 4px; flex-wrap: wrap; }

/* ===========================
   フィルターバー
   =========================== */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filter-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ===========================
   フォーム
   =========================== */
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--color-text);
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26,95,168,.12);
}

.filter-bar .form-control,
.filter-bar select { height: 36px; min-width: 200px; }
.filter-bar select { min-width: 160px; }

textarea.form-control { resize: vertical; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 200px;
}
.form-group.full-width { flex: 100%; min-width: 100%; }

.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text);
}
.form-label.required::after {
  content: ' *';
  color: var(--color-red);
}

.form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-primary-light);
  padding-bottom: 6px;
  margin: 20px 0 14px;
  letter-spacing: .04em;
}

/* ===========================
   ジェイリースタブ
   =========================== */
.jlease-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.jlease-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1.5px solid var(--color-border);
  background: var(--color-white);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: all var(--transition);
}
.jlease-tab:hover { border-color: var(--color-primary); color: var(--color-primary); }
.jlease-tab.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.tab-count {
  background: rgba(0,0,0,.12);
  border-radius: 50px;
  padding: 1px 7px;
  font-size: 11px;
}
.jlease-tab.active .tab-count { background: rgba(255,255,255,.25); }

/* ===========================
   モーダル
   =========================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  transition: opacity var(--transition);
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-sm { max-width: 460px; }
.modal-lg { max-width: 860px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-gray-light);
}
.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-header h2 i { color: var(--color-primary); }

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.modal-close:hover { background: var(--color-border); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ===========================
   詳細表示
   =========================== */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.detail-section-title {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 14px 0 6px;
  border-bottom: 2px solid var(--color-primary-light);
  margin-bottom: 4px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-gray-light);
}
.detail-item:nth-child(even):not(.full-span) { padding-left: 16px; }
.detail-item.full-span { grid-column: 1 / -1; }

.detail-label {
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.detail-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
}
.detail-value.empty { color: var(--color-text-muted); font-style: italic; }

/* ===========================
   確認ダイアログ
   =========================== */
.confirm-box {
  text-align: center;
  padding: 8px 0;
}
.confirm-icon {
  width: 64px;
  height: 64px;
  background: var(--color-primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--color-primary);
  margin: 0 auto 16px;
}
.confirm-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}
.confirm-desc {
  color: var(--color-text-muted);
  font-size: 13px;
  margin-bottom: 20px;
}
.confirm-detail {
  background: var(--color-gray-light);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: left;
  margin-bottom: 16px;
}
.detail-row {
  display: flex;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 6px;
}
.detail-row:last-child { margin-bottom: 0; }
.detail-row span { color: var(--color-text-muted); min-width: 100px; }

.confirm-notice {
  background: #fef3e2;
  color: #7d4200;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12.5px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
}

.contract-filter-bar {
  padding: 16px 20px;
  margin-bottom: 16px;
}

.info-box {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}
.info-box.orange {
  background: var(--color-orange-light);
  color: #7d4200;
  border-left: 3px solid var(--color-orange);
}

/* ===========================
   ラジオボタングループ
   =========================== */
.radio-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.radio-label input[type="radio"] { accent-color: var(--color-primary); }

.radio-badge {
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.radio-badge.pending { background: var(--color-orange-light); color: #d35400; }
.radio-badge.approved { background: var(--color-green-light); color: #1e8449; }
.radio-badge.rejected { background: var(--color-red-light); color: #c0392b; }

/* ===========================
   ローディング
   =========================== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--color-text-muted);
}
.loading i { margin-right: 8px; }
.text-center { text-align: center; }

/* ===========================
   トースト通知
   =========================== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-text);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  font-weight: 500;
  min-width: 260px;
  max-width: 380px;
  animation: toastIn .3s ease;
}
.toast.success { background: #1e6640; }
.toast.error { background: #a93226; }
.toast.info { background: #1a5fa8; }
.toast i { font-size: 15px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(10px); } }

/* ===========================
   送付済みバッジ
   =========================== */
.sent-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11.5px;
  font-weight: 600;
}
.sent-badge.done { background: #d5f5e3; color: #1e6640; }
.sent-badge.pending { background: #f2f3f4; color: #6b7280; }

/* ===========================
   最近申込リスト（ダッシュボード）
   =========================== */
.recent-list { list-style: none; }
.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}
.recent-item:last-child { border-bottom: none; }

.recent-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.recent-info { flex: 1; min-width: 0; }
.recent-name { font-weight: 600; font-size: 13px; }
.recent-property {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===========================
   ユーティリティ
   =========================== */
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--color-text-muted); }
.font-bold { font-weight: 700; }

/* ===========================
   PDFボタン
   =========================== */
.btn-pdf {
  background: #e74c3c;
  color: #fff;
  border-color: #e74c3c;
}
.btn-pdf:hover { background: #c0392b; border-color: #c0392b; }

.btn-pdf-dl {
  background: #c0392b;
  color: #fff;
  border: 1.5px solid #c0392b;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}
.btn-pdf-dl:hover { background: #a93226; }

/* ===========================
   申込一覧 書類ボタン
   =========================== */
.btn-doc {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  text-decoration: none;
  background: #1a3a6b;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.btn-doc:hover { opacity: 0.82; }
.btn-doc i { font-size: 10px; }

.btn-doc-contract {
  background: #1a7a4a;
}
.btn-doc-juyo {
  background: #7b3fa8;
}
.btn-doc-disabled {
  background: #b0b8c8;
  color: #fff;
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* 書類フィルター select */
#filter-doc {
  min-width: 130px;
}

/* ===========================
   PDF プレビュー
   =========================== */
.pdf-preview-wrap {
  display: flex;
  flex-direction: column;
  height: 72vh;
}

.pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #2c3e50;
  color: #ecf0f1;
  padding: 10px 20px;
  font-size: 13px;
}
.pdf-doc-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.pdf-doc-title i { color: #e74c3c; font-size: 16px; }
.pdf-pages { font-size: 12px; color: #bdc3c7; }

.pdf-canvas {
  flex: 1;
  overflow-y: auto;
  background: #525659;
  padding: 24px;
  display: flex;
  justify-content: center;
}

.pdf-page {
  background: #fff;
  width: 100%;
  max-width: 680px;
  padding: 40px 44px;
  box-shadow: 0 4px 24px rgba(0,0,0,.35);
  position: relative;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 12px;
  color: #1a1a1a;
  line-height: 1.7;
}

/* スタンプ */
.pdf-stamp {
  position: absolute;
  top: 36px;
  right: 36px;
  border: 3px solid;
  border-radius: 6px;
  padding: 4px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  transform: rotate(-12deg);
  opacity: .7;
}
.pdf-stamp.stamp-sent { border-color: #27ae60; color: #27ae60; background: #f0fff7; }
.pdf-stamp.stamp-pending { border-color: #e67e22; color: #e67e22; background: #fff9f0; }

.pdf-header-block {
  text-align: center;
  margin-bottom: 28px;
  border-bottom: 2px solid #1a1a1a;
  padding-bottom: 16px;
}
.pdf-doc-h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .2em;
  margin-bottom: 4px;
}
.pdf-doc-sub {
  font-size: 13px;
  color: #555;
  letter-spacing: .1em;
}

.pdf-section {
  margin-bottom: 20px;
}
.pdf-section-title {
  font-size: 12px;
  font-weight: 700;
  background: #2c3e50;
  color: #fff;
  padding: 4px 10px;
  margin-bottom: 6px;
  letter-spacing: .06em;
}

.pdf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.pdf-table th {
  background: #f5f6fa;
  padding: 6px 10px;
  font-weight: 600;
  color: #444;
  border: 1px solid #d0d0d0;
  white-space: nowrap;
  width: 90px;
}
.pdf-table td {
  padding: 6px 10px;
  border: 1px solid #d0d0d0;
  color: #1a1a1a;
}

.pdf-sign-area {
  display: flex;
  gap: 24px;
  margin: 28px 0 16px;
}
.pdf-sign-box {
  flex: 1;
  border: 1px solid #aaa;
  border-radius: 4px;
  padding: 12px 16px;
  min-height: 90px;
  text-align: center;
}
.pdf-sign-label {
  font-size: 11px;
  font-weight: 700;
  color: #555;
  margin-bottom: 10px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 6px;
}
.pdf-sign-line {
  border-bottom: 1px solid #aaa;
  margin: 20px 0 6px;
}
.pdf-sign-hint {
  font-size: 10px;
  color: #aaa;
}
.pdf-sign-done {
  color: #27ae60;
  font-size: 12px;
  font-weight: 700;
  margin-top: 8px;
}
.pdf-sign-done i { font-size: 16px; display: block; margin-bottom: 4px; }
.pdf-sign-done small { font-weight: 400; font-size: 10px; color: #5a9c72; }

.pdf-footer-note {
  font-size: 10px;
  color: #999;
  border-top: 1px solid #ddd;
  padding-top: 10px;
  margin-top: 16px;
  line-height: 1.6;
}

/* ===========================
   顧客管理レイアウト
   =========================== */

/* --- メインエリア（パネル開閉で幅が変わる） --- */
.customers-main {
  transition: margin-right .3s ease;
}
#view-customers.panel-open .customers-main {
  margin-right: 420px;
}

/* --- パンくず --- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}
.breadcrumb i { font-size: 10px; }
.bc-current { color: var(--color-primary); font-weight: 600; }

/* --- ページ説明 --- */
.page-desc {
  font-size: 12.5px;
  color: var(--color-text-muted);
  margin-top: 3px;
}

/* --- フィルターバー --- */
.cust-filter-bar {
  margin-bottom: 12px;
}
.cust-filter-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  flex-wrap: wrap;
}

.cust-search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.cust-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 13px;
  pointer-events: none;
}
.cust-search-input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--color-text);
  transition: border-color .2s;
}
.cust-search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26,95,168,.1);
}

.cust-date-wrap {
  position: relative;
}
.cust-date-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 12px;
  pointer-events: none;
  z-index: 1;
}

.btn-link {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: underline;
  padding: 0 4px;
  transition: color .2s;
}
.btn-link:hover { color: var(--color-primary); }

/* --- 結果バー --- */
.cust-result-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13px;
}
.cust-result-count {
  font-size: 13px;
  color: var(--color-text-muted);
}
.pdf-col-label {
  font-size: 12px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.pdf-col-label i { color: #e74c3c; }

/* --- テーブル PDF列 --- */
.cust-table .th-pdf {
  text-align: center;
  font-size: 11px;
  background: #fef9f9;
  color: #c0392b;
  min-width: 76px;
}
.cust-table td.td-pdf {
  text-align: center;
  padding: 10px 6px;
}

/* --- PDF開くボタン --- */
.btn-open-pdf {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1.5px solid var(--color-primary);
  background: #fff;
  color: var(--color-primary);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.btn-open-pdf:hover {
  background: var(--color-primary);
  color: #fff;
}
.btn-open-pdf i { font-size: 12px; }
.btn-open-pdf.no-doc {
  border-color: var(--color-border);
  color: var(--color-border);
  cursor: default;
  pointer-events: none;
}

/* --- ページネーション --- */
.cust-pagination-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===========================
   ステータスバッジ（顧客管理用）
   =========================== */
.cust-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.cust-badge.shinsa-chu    { background: #dbeafe; color: #1e40af; }
.cust-badge.keiyaku-junbi { background: #d1fae5; color: #065f46; }
.cust-badge.keiyaku-sakusei{ background: #d1fae5; color: #065f46; }
.cust-badge.moushikomi    { background: #f3f4f6; color: #374151; }
.cust-badge.hiketsu       { background: #fee2e2; color: #991b1b; }
.cust-badge.shorui-fubi   { background: #ffedd5; color: #9a3412; }
.cust-badge.keiyaku-kanryo{ background: #ede9fe; color: #5b21b6; }

/* ===========================
   PDFサイドパネル
   =========================== */
.pdf-side-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0,0,0,.15);
  z-index: 150;
  display: flex;
  flex-direction: column;
  transition: transform .3s ease;
}
.pdf-side-panel.hidden {
  display: none;
}

.psp-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-gray-light);
}
.psp-title-area {
  display: flex;
  align-items: center;
  gap: 12px;
}
.psp-pdf-icon {
  font-size: 28px;
  color: #e74c3c;
}
.psp-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
}
.psp-sub {
  font-size: 11.5px;
  color: var(--color-text-muted);
  margin-top: 2px;
}
.psp-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.psp-close:hover { background: var(--color-border); }

.psp-doc-info {
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.psp-doc-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
}
.psp-doc-id {
  font-size: 11px;
  color: var(--color-text-muted);
}

.psp-viewer {
  flex: 1;
  overflow-y: auto;
  background: #525659;
  padding: 16px;
  display: flex;
  justify-content: center;
}

/* パネル内のPDFページ（コンパクト版） */
.psp-page {
  background: #fff;
  width: 100%;
  max-width: 360px;
  padding: 24px 28px;
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
  position: relative;
  font-size: 10.5px;
  color: #1a1a1a;
  line-height: 1.6;
}
.psp-page .pdf-stamp {
  top: 14px;
  right: 14px;
  font-size: 10px;
  padding: 2px 8px;
}
.psp-page .pdf-doc-h1 { font-size: 14px; letter-spacing: .15em; }
.psp-page .pdf-doc-sub { font-size: 10px; }
.psp-page .pdf-header-block { margin-bottom: 14px; padding-bottom: 10px; }
.psp-page .pdf-section { margin-bottom: 12px; }
.psp-page .pdf-section-title { font-size: 10px; padding: 3px 8px; }
.psp-page .pdf-table th, .psp-page .pdf-table td { padding: 4px 7px; font-size: 10px; }
.psp-page .pdf-sign-area { margin: 14px 0 10px; }
.psp-page .pdf-sign-box { padding: 8px 10px; min-height: 60px; }
.psp-page .pdf-footer-note { font-size: 9px; }

.psp-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 10px;
}
.psp-footer .btn { flex: 1; justify-content: center; }

.psp-notice {
  padding: 8px 20px 12px;
  font-size: 11px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.psp-notice i { color: var(--color-primary); }

/* ===========================
   レスポンシブ
   =========================== */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 0px; }
  #sidebar {
    width: 240px;
    transform: translateX(-240px);
  }
  #sidebar.open { transform: translateX(0); }
  #sidebar-toggle { display: block; }
  #main-content { margin-left: 0; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .view { padding: 16px; }
  .modal { max-width: 100%; margin: 0; border-radius: 0; max-height: 100vh; }
}
