:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e2e5eb;
  --text: #1f2430;
  --text-muted: #6b7280;
  --primary: #2f6fed;
  --primary-dark: #2457c4;
  --primary-bg: #eaf1ff;
  --danger: #e0453f;
  --danger-bg: #fdeceb;
  --success: #1f9d55;
  --success-bg: #e8f8ee;
  --warn: #b8860b;
  --warn-bg: #fdf3dc;
  --overdue: #d1453b;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(20, 24, 38, 0.06);
  --shadow-lg: 0 12px 40px rgba(20, 24, 38, 0.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.brand h1 { font-size: 18px; margin: 0; font-weight: 700; }

.header-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* Buttons */
.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: #f0f2f5; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--surface); }
.btn-danger { background: var(--danger-bg); border-color: #f5c6c3; color: var(--danger); }
.btn-danger:hover { background: #fbdcda; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.header-dropdown { position: relative; }
.dropdown-arrow { font-size: 10px; color: var(--text-muted); }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 50;
}
.dropdown-menu[hidden] { display: none; }
.dropdown-item {
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.dropdown-item:hover { background: #f0f2f5; }

.multi-select { position: relative; }
.multi-select-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-family: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.multi-select-toggle:hover { background: #f7f9fc; }
.multi-select .dropdown-menu {
  left: 0;
  right: 0;
  min-width: 0;
  max-height: 220px;
  overflow-y: auto;
}
.dropdown-menu .multi-select-option {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.multi-select-option:hover { background: #f0f2f5; }
.multi-select-option input { margin: 0; }

/* Main */
.app-main { padding: 20px 24px 60px; max-width: 1280px; margin: 0 auto; }

/* Stats */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat-card .stat-value { font-size: 24px; font-weight: 700; }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat-card.overdue .stat-value { color: var(--overdue); }

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}
.search-input {
  flex: 1 1 260px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--surface);
}
.select {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  padding: 0 4px;
}

.checkbox-tag-group { display: flex; flex-wrap: wrap; gap: 6px; }
.checkbox-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px 4px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.checkbox-tag input { margin: 0; }
.checkbox-tag:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
}
.person-tag {
  display: inline-block;
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
}

/* Table */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.customer-table { width: 100%; border-collapse: collapse; }
.customer-table th {
  text-align: left;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
}
.customer-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
.customer-table tbody tr:last-child td { border-bottom: none; }
.customer-table tbody tr { cursor: pointer; transition: background 0.1s; }
.customer-table tbody tr:hover { background: #f7f9fc; }

.name-cell { font-weight: 600; }
.name-cell .sub { font-weight: 400; color: var(--text-muted); font-size: 12px; margin-top: 2px; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-見込み { background: var(--warn-bg); color: var(--warn); }
.badge-取引中 { background: var(--success-bg); color: var(--success); }
.badge-過去 { background: #eceef1; color: var(--text-muted); }

.badge-契約 { padding: 2px 8px; font-size: 11px; }
.badge-開始前 { background: var(--primary-bg); color: var(--primary); }
.badge-進行中 { background: var(--success-bg); color: var(--success); }
.badge-完了 { background: #eceef1; color: var(--text-muted); }

.badge-媒体経由 { padding: 2px 8px; font-size: 11px; background: var(--primary-bg); color: var(--primary); }
.badge-warning { background: var(--danger-bg); color: var(--danger); }
.audit-missing-list { display: flex; flex-wrap: wrap; gap: 8px; }
.company-audit-hint { margin-bottom: 12px; }

/* 支援準備 スライド用ビジュアル */
.prep-visual-header { text-align: center; margin-bottom: 18px; }
.prep-visual-company { font-size: 20px; font-weight: 700; color: var(--text); }
.prep-visual-year { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
#prepVisualBody .checklist-breakdown { margin-left: 0; }
#companyAuditBody .customer-table tbody tr { cursor: pointer; }
#companyAuditBody .customer-table tbody tr:hover { background: #f7f9fc; }

.overdue-text { color: var(--overdue); font-weight: 700; }
.row-actions { text-align: right; white-space: nowrap; }

.empty-state { padding: 60px 20px; text-align: center; color: var(--text-muted); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 24, 38, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-large { max-width: 760px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; margin: 0; }
.modal-header-actions { display: flex; align-items: center; gap: 8px; }
.copy-notice {
  background: var(--primary-bg);
  border: 1px solid #cfe0ff;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--primary-dark);
  line-height: 1.6;
}
.copy-notice[hidden] { display: none; }
.copy-notice strong { font-weight: 700; }
.renewal-alert { color: var(--danger); font-size: 12px; font-weight: 700; margin-left: 4px; }
.renewal-source { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.cloud-status {
  padding: 6px 24px;
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.cloud-status[hidden] { display: none; }
.cloud-ok { background: var(--success-bg); color: var(--success); }
.cloud-saving { background: var(--primary-bg); color: var(--primary); }
.cloud-offline { background: var(--warn-bg); color: var(--warn); }
.cloud-conflict { background: var(--danger-bg); color: var(--danger); }
.bulk-renewal {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: #f7f9fc;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.bulk-renewal-label { font-size: 11px; font-weight: 700; color: var(--text-muted); }
.renewal-controls { white-space: nowrap; }
.select-sm { padding: 4px 6px; font-size: 12px; border-radius: 6px; }
.comparison-count-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 12px 0 6px;
}
.icon-btn {
  border: none; background: none; font-size: 20px; line-height: 1;
  cursor: pointer; color: var(--text-muted); padding: 4px 8px; border-radius: 6px;
}
.icon-btn:hover { background: #f0f2f5; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.footer-right { display: flex; gap: 8px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab-btn {
  border: none; background: none; padding: 9px 14px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Form */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.form-grid label[hidden] { display: none; }
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea {
  font-family: inherit;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
}
.form-grid textarea { resize: vertical; }
.req { color: var(--danger); }
.field-hint { font-size: 11px; font-weight: 400; color: var(--text-muted); }
.media-detail-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}
.media-detail-block[hidden] { display: none; }
.media-detail-block .form-grid { margin-top: 10px; }
.media-detail-title { font-size: 13px; font-weight: 700; color: var(--text); }

/* Audit (監査) */
.audit-section { margin-top: 16px; }
.audit-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.audit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
}
.audit-item-text { font-size: 12px; color: var(--text); flex: 1; }
.audit-score {
  font-family: inherit;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text);
  background: var(--surface);
  flex-shrink: 0;
}
.audit-total {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.field-label { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.quota-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quota-col {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
}
.quota-title { font-size: 12px; font-weight: 700; color: var(--text); }
.quota-row { font-size: 12px; color: var(--text-muted); }
.quota-col label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}
.quota-col input {
  font-family: inherit;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text);
  background: var(--surface);
}
.quota-total { font-size: 12px; font-weight: 700; color: var(--primary); }
.computed-value {
  padding: 8px 10px;
  border-radius: 7px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* Record list (contracts/history) */
.panel-toolbar { margin-bottom: 10px; }
.record-list { display: flex; flex-direction: column; gap: 18px; }
.record-group { display: flex; flex-direction: column; gap: 8px; }
.record-group-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.record-group-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.record-group-totals {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
}
.record-group-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: -2px;
}
.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary-bg);
  border-radius: 999px;
  padding: 3px 4px 3px 10px;
  font-size: 11px;
}
.link-chip a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.link-chip a:hover { text-decoration: underline; }
.link-chip-remove {
  border: none;
  background: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 999px;
}
.link-chip-remove:hover { background: rgba(47, 111, 237, 0.15); }
.link-add-input {
  border: 1px dashed var(--border);
  border-radius: 999px;
  background: transparent;
  font-size: 11px;
  padding: 4px 10px;
  color: var(--text);
  min-width: 180px;
}
.link-add-input:focus { border-style: solid; border-color: var(--primary); outline: none; }
.record-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.record-item:hover { background: #f7f9fc; }
.record-item-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.record-item-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.copy-btn {
  border: none;
  background: none;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  flex-shrink: 0;
}
.copy-btn:hover { background: #f0f2f5; color: var(--primary); }

/* Checklist (支援準備) */
.checklist-category { margin-bottom: 14px; }
.checklist-category:last-child { margin-bottom: 0; }
.checklist-category-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.checklist-category-title:hover { color: var(--primary); }
.checklist-category-arrow { color: var(--text-muted); font-size: 10px; width: 10px; display: inline-block; }
.checklist-progress { font-weight: 600; color: var(--text-muted); font-size: 11px; }
.checklist-item {
  padding: 7px 4px;
  border-bottom: 1px solid var(--border);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item-row { display: flex; align-items: center; gap: 10px; }
.checklist-item-indicator { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.checklist-item-detail-toggle {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 6px;
  flex-shrink: 0;
}
.checklist-item-detail-toggle:hover { color: var(--primary); }
.checklist-item-label { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; min-width: 0; }
.checklist-item-label input { margin: 0; flex-shrink: 0; }
.checklist-item-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 4px 0 0 26px;
}
.checklist-text { flex: 1; font-size: 13px; color: var(--text); }
.checklist-text.checked { color: var(--text-muted); text-decoration: line-through; }
.checklist-breakdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 0 26px;
}
.checklist-breakdown-rows { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.checklist-breakdown-total { font-size: 11px; font-weight: 700; color: var(--text-muted); }
.checklist-breakdown-add { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.checklist-breakdown-collapsed { flex-direction: row; align-items: center; gap: 10px; }
.link-edit-btn {
  border: none;
  background: none;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
}
.link-edit-btn:hover { color: var(--primary-dark); text-decoration: underline; }
.checklist-breakdown-summary { font-size: 12px; color: var(--text-muted); }
.breakdown-role-input, .breakdown-count-input {
  font-family: inherit;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text);
  background: var(--surface);
}
.breakdown-role-input { width: 130px; }
.breakdown-count-input { width: 70px; }
.breakdown-remove {
  border: none;
  background: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 999px;
}
.breakdown-remove:hover { background: rgba(47, 111, 237, 0.15); }
.checklist-delete {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 999px;
  flex-shrink: 0;
}
.checklist-delete:hover { background: var(--danger-bg); color: var(--danger); }
.record-item-title { font-weight: 600; }
.record-item-title-sub { font-weight: 400; color: var(--text-muted); font-size: 12px; margin-left: 8px; }
.record-item-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.record-empty { color: var(--text-muted); font-size: 13px; padding: 20px 0; text-align: center; }

/* Cross sell (クロスセル) */
.cross-sell-section { margin-bottom: 22px; }
.cross-sell-section:last-child { margin-bottom: 0; }
.cross-sell-section h3 { font-size: 14px; margin: 0 0 10px; }
.cross-sell-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cross-sell-row:last-child { margin-bottom: 0; }
.cross-sell-row-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cross-sell-row-title { font-weight: 600; font-size: 13px; }
.cross-sell-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cross-sell-row textarea {
  font-family: inherit;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text);
  background: var(--surface);
  resize: vertical;
  min-height: 40px;
}

/* 契約タイムライン */
.tl-year { margin-bottom: 22px; }
.tl-year:last-child { margin-bottom: 0; }
.tl-year-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.tl-year-title { font-size: 14px; font-weight: 700; }
.tl-year-total { font-size: 11px; color: var(--text-muted); }
.tl-axis { display: flex; margin-bottom: 6px; }
.tl-axis-spacer { width: 190px; flex-shrink: 0; }
.tl-axis-months { position: relative; flex: 1; height: 16px; border-left: 1px solid var(--border); }
.tl-axis-months span {
  position: absolute;
  top: 0;
  font-size: 10px;
  color: var(--text-muted);
  transform: translateX(-50%);
  white-space: nowrap;
}
.tl-row { display: flex; align-items: center; min-height: 30px; }
.tl-label {
  width: 190px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  padding-right: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tl-track { position: relative; flex: 1; height: 24px; border-left: 1px solid var(--border); }
.tl-grid { position: absolute; inset: 0; pointer-events: none; }
.tl-grid span { position: absolute; top: 0; bottom: 0; border-left: 1px dashed #eef0f4; }
.tl-bar {
  position: absolute;
  top: 3px;
  height: 18px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  min-width: 4px;
}
.tl-bar-outside {
  position: absolute;
  top: 3px;
  height: 18px;
  display: flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.tl-c1 { background: var(--primary-bg); color: var(--primary); border: 1px solid #bcd3ff; }
.tl-c2 { background: var(--success-bg); color: var(--success); border: 1px solid #b7e6c9; }
.tl-c3 { background: #f0ebfd; color: #7b5cd6; border: 1px solid #d6c9f7; }
.tl-c4 { background: var(--warn-bg); color: var(--warn); border: 1px solid #ecd9a6; }
.tl-c5 { background: #e6f6fa; color: #17879c; border: 1px solid #b6e2ec; }
.tl-t1 { color: var(--primary); }
.tl-t2 { color: var(--success); }
.tl-t3 { color: #7b5cd6; }
.tl-t4 { color: var(--warn); }
.tl-t5 { color: #17879c; }
.tl-legend { display: flex; gap: 14px; margin-top: 10px; font-size: 11px; color: var(--text-muted); flex-wrap: wrap; }
.tl-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Analysis */
.analysis-section { margin-bottom: 24px; }
.analysis-section:last-child { margin-bottom: 0; }
.analysis-section h3 { font-size: 14px; margin: 0 0 10px; }
.analysis-section .customer-table th, .analysis-section .customer-table td { padding: 8px 12px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1f2430; color: #fff;
  padding: 10px 18px; border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
}
.toast[hidden] { display: none; }

/* 印刷（年度比較モーダルを開いた状態で印刷すると、その内容だけが横幅に収まって出力される） */
@media print {
  body * { visibility: hidden; }
  #contractComparisonModal,
  #contractComparisonModal * { visibility: visible; }

  #contractComparisonModal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: auto;
    display: block;
    padding: 0;
    background: #fff;
  }
  #contractComparisonModal .modal {
    width: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
  }
  #contractComparisonModal .modal-body {
    overflow: visible;
    max-height: none;
    padding: 0;
  }
  #contractComparisonModal .modal-header {
    padding: 0 0 10px;
  }
  #btnPrintComparison,
  #btnCloseContractComparisonModal { display: none; }

  /* 表やタイムラインが途中で切れないように */
  .analysis-section,
  .tl-year,
  .tl-row,
  .customer-table tr { break-inside: avoid; page-break-inside: avoid; }
  .analysis-section h3 { break-after: avoid; page-break-after: avoid; }

  /* 棒グラフ・バッジの色を印刷でも残す */
  .tl-bar, .tl-bar-outside, .badge, .stat-card {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  @page { size: A4 portrait; margin: 12mm; }
}
