/* ===========================================
   書類テンプレート管理 - Soft UI スタイル
   =========================================== */

:root {
  --bg: #e0e5ec;
  --bg-light: #edf1f7;
  --shadow-light: #ffffff;
  --shadow-dark: #a3b1c6;
  --primary: #4d7bf3;
  --primary-dark: #3a5fc7;
  --accent: #34c38f;
  --danger: #f46a6a;
  --warning: #f1b44c;
  --text: #3a3a3a;
  --text-light: #6b7b8d;
  --text-muted: #9aa5b1;
  --sidebar-width: 240px;
  --header-height: 60px;
  --radius: 16px;
  --radius-sm: 10px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg);
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ===========================================
   ヘッダー
   =========================================== */
.soft-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg);
  box-shadow: 0 4px 12px rgba(163, 177, 198, 0.35);
  z-index: 100;
  display: flex;
  align-items: center;
}

.header-inner {
  width: 100%;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}

.header-actions {
  margin-left: auto;
}

.soft-select-sm {
  border: none;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
  outline: none;
  cursor: pointer;
  min-width: 140px;
}

/* ===========================================
   ハンバーガーメニュー
   =========================================== */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  width: 36px;
  height: 36px;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===========================================
   サイドバー
   =========================================== */
.sidebar-content {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg);
  box-shadow: 4px 0 12px rgba(163, 177, 198, 0.25);
  overflow-y: auto;
  z-index: 90;
  transition: transform 0.3s ease;
}

.sidebar-overlay {
  display: none;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(163, 177, 198, 0.3);
}

.sidebar-brand {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.nav-list {
  list-style: none;
  padding: 8px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  gap: 12px;
  color: var(--text-light);
  font-size: 14px;
  font-weight: 500;
}

.nav-item:hover {
  background: rgba(77, 123, 243, 0.06);
  color: var(--primary);
}

.nav-item.active {
  color: var(--primary);
  font-weight: 600;
  background: rgba(77, 123, 243, 0.08);
  border-right: 3px solid var(--primary);
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 14px;
}

/* ===========================================
   メインコンテンツ
   =========================================== */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 24px;
  min-height: calc(100vh - var(--header-height));
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
}

/* ===========================================
   Soft UI カード
   =========================================== */
.soft-card {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(163, 177, 198, 0.3);
}

.card-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 16px 0 12px;
}

/* ===========================================
   カードグリッド
   =========================================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.card-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.summary-card {
  text-align: center;
  padding: 20px;
}

.summary-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  margin-bottom: 8px;
}

.summary-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
}

/* ===========================================
   フォーム要素
   =========================================== */
.soft-input,
.soft-select,
.soft-textarea {
  width: 100%;
  border: none;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: all 0.2s;
}

.soft-input:focus,
.soft-select:focus,
.soft-textarea:focus {
  box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light);
  color: var(--primary);
}

.soft-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group {
  margin-bottom: 16px;
  position: relative;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-light);
  padding-left: 4px;
}

.form-group label.required::after {
  content: ' *';
  color: var(--danger);
}

.form-help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  padding-left: 4px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ===========================================
   ボタン
   =========================================== */
.btn-soft {
  border: none;
  background: var(--bg);
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 24px;
  border-radius: 30px;
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.btn-soft:hover {
  transform: translateY(-1px);
  box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
}

.btn-soft:active {
  transform: translateY(0);
  box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary:active {
  box-shadow: inset 3px 3px 6px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
  color: var(--text-light);
}

.btn-accent {
  color: var(--accent);
}

.btn-danger {
  color: var(--danger);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 20px;
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}

.btn-lg {
  padding: 14px 36px;
  font-size: 16px;
}

/* ===========================================
   テーブル
   =========================================== */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.soft-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.soft-table thead th {
  background: rgba(77, 123, 243, 0.08);
  color: var(--text-light);
  font-weight: 600;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 2px solid rgba(163, 177, 198, 0.3);
}

.soft-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(163, 177, 198, 0.2);
  vertical-align: middle;
}

.soft-table tbody tr:hover {
  background: rgba(77, 123, 243, 0.04);
}

/* ===========================================
   フィルタ
   =========================================== */
.filter-card {
  margin-bottom: 20px;
}

.filter-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-group {
  min-width: 140px;
}

.filter-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-grow {
  flex: 1;
  min-width: 200px;
}

.filter-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

/* ===========================================
   テンプレートグリッド
   =========================================== */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.template-card {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.template-card:hover {
  transform: translateY(-2px);
  box-shadow: 6px 6px 14px var(--shadow-dark), -6px -6px 14px var(--shadow-light);
}

.template-card .tpl-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.template-card .tpl-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  line-height: 1.4;
  flex: 1;
}

.template-card .tpl-id {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.template-card .tpl-category {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(77, 123, 243, 0.1);
  color: var(--primary);
  margin-right: 6px;
  margin-bottom: 4px;
}

.template-card .tpl-business {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(52, 195, 143, 0.1);
  color: var(--accent);
}

.template-card .tpl-meta {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-light);
}

.template-card .tpl-desc {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.template-card.deprecated {
  background: #e8eaed;
  opacity: 0.7;
}

.template-card .tpl-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.badge-gold {
  background: linear-gradient(135deg, #f5c842, #d4a017);
  color: #fff;
}

.badge-popular {
  background: var(--primary);
  color: #fff;
}

.badge-expiring {
  background: var(--warning);
  color: #fff;
}

/* ===========================================
   タブ
   =========================================== */
.tab-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-btn {
  border: none;
  background: var(--bg);
  color: var(--text-light);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 25px;
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.tab-btn.active {
  color: #fff;
  background: var(--primary);
  box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.15);
}

.tab-btn:hover:not(.active) {
  color: var(--primary);
}

/* ===========================================
   オートコンプリート
   =========================================== */
.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-light);
  border-radius: var(--radius-sm);
  box-shadow: 4px 4px 12px var(--shadow-dark);
  max-height: 200px;
  overflow-y: auto;
  z-index: 50;
  display: none;
}

.autocomplete-list.show {
  display: block;
}

.autocomplete-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid rgba(163, 177, 198, 0.2);
}

.autocomplete-item:hover {
  background: rgba(77, 123, 243, 0.08);
  color: var(--primary);
}

/* ===========================================
   チェックボックスリスト
   =========================================== */
.checkbox-list {
  max-height: 250px;
  overflow-y: auto;
  background: var(--bg);
  border-radius: var(--radius-sm);
  box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
  padding: 12px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  font-size: 13px;
  border-bottom: 1px solid rgba(163, 177, 198, 0.15);
}

.checkbox-item:last-child {
  border-bottom: none;
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* ===========================================
   変数入力エリア
   =========================================== */
.variables-area {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(163, 177, 198, 0.3);
}

.var-field {
  margin-bottom: 12px;
}

.var-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
}

.var-field .var-required {
  color: var(--danger);
  margin-left: 4px;
}

.var-field .var-help {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===========================================
   セット情報
   =========================================== */
.set-info {
  margin-top: 16px;
  padding: 16px;
  background: rgba(77, 123, 243, 0.05);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
}

.set-info h4 {
  font-size: 13px;
  color: var(--primary);
  margin-bottom: 8px;
}

.set-info ul {
  list-style: none;
  font-size: 13px;
  color: var(--text-light);
}

.set-info ul li {
  padding: 4px 0;
}

.set-info ul li::before {
  content: '- ';
  color: var(--primary);
}

/* ===========================================
   アラートバナー
   =========================================== */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
}

.alert-danger {
  background: rgba(244, 106, 106, 0.12);
  color: var(--danger);
  border-left: 4px solid var(--danger);
}

.alert-warning {
  background: rgba(241, 180, 76, 0.12);
  color: #b07d10;
  border-left: 4px solid var(--warning);
}

.alert-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: inherit;
  padding: 0 4px;
}

/* ===========================================
   モーダル
   =========================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-container {
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(163, 177, 198, 0.3);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-light);
  padding: 0;
  line-height: 1;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(163, 177, 198, 0.3);
}

/* ===========================================
   ローディング
   =========================================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(224, 229, 236, 0.85);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-spinner {
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid var(--shadow-dark);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-spinner p {
  color: var(--text-light);
  font-weight: 600;
  font-size: 14px;
}

/* ===========================================
   トースト通知
   =========================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  box-shadow: 4px 4px 12px var(--shadow-dark), -4px -4px 12px var(--shadow-light);
  font-size: 13px;
  font-weight: 500;
  max-width: 360px;
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.toast-success {
  border-left: 4px solid var(--accent);
  color: #1a7a53;
}

.toast.toast-error {
  border-left: 4px solid var(--danger);
  color: var(--danger);
}

.toast.toast-info {
  border-left: 4px solid var(--primary);
  color: var(--primary);
}

.toast.toast-out {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* ===========================================
   ステータスバッジ
   =========================================== */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.status-active { background: rgba(52, 195, 143, 0.15); color: var(--accent); }
.status-paused { background: rgba(241, 180, 76, 0.15); color: var(--warning); }
.status-inactive { background: rgba(163, 177, 198, 0.2); color: var(--text-muted); }
.status-danger { background: rgba(244, 106, 106, 0.15); color: var(--danger); }
.status-progress { background: rgba(77, 123, 243, 0.15); color: var(--primary); }

/* ===========================================
   ページネーション
   =========================================== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.pagination button {
  border: none;
  background: var(--bg);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  transition: all 0.2s;
}

.pagination button.active {
  background: var(--primary);
  color: #fff;
  box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.15);
}

.pagination button:hover:not(.active) {
  color: var(--primary);
}

/* ===========================================
   リストコンテナ
   =========================================== */
.list-container {
  max-height: 300px;
  overflow-y: auto;
}

.list-item {
  padding: 10px 0;
  border-bottom: 1px solid rgba(163, 177, 198, 0.2);
  font-size: 13px;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item-title {
  font-weight: 600;
  color: var(--text);
}

.list-item-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ===========================================
   接続ステータス
   =========================================== */
.connection-status {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
}

.connection-status.success {
  background: rgba(52, 195, 143, 0.1);
  color: var(--accent);
}

.connection-status.error {
  background: rgba(244, 106, 106, 0.1);
  color: var(--danger);
}

/* ===========================================
   空状態
   =========================================== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ===========================================
   レスポンシブ: タブレット
   =========================================== */
@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .template-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  .filter-row {
    flex-direction: column;
    gap: 12px;
  }

  .filter-group {
    min-width: 100%;
  }
}

/* ===========================================
   レスポンシブ: スマートフォン
   =========================================== */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 260px;
  }

  /* ハンバーガー表示 */
  .hamburger {
    display: flex;
  }

  /* ヘッダー */
  .header-title {
    font-size: 15px;
  }

  .soft-select-sm {
    min-width: 100px;
    font-size: 12px;
    padding: 6px 10px;
  }

  /* サイドバー（デフォルトで非表示） */
  .sidebar-content {
    transform: translateX(-100%);
  }

  .sidebar.open .sidebar-content {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 85;
  }

  .sidebar.open .sidebar-overlay {
    display: block;
  }

  /* メインコンテンツ */
  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  .page-title {
    font-size: 18px;
    margin-bottom: 16px;
  }

  /* カードグリッド */
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .card-grid-2 {
    grid-template-columns: 1fr;
  }

  .summary-card {
    padding: 14px;
  }

  .summary-value {
    font-size: 24px;
  }

  .summary-label {
    font-size: 11px;
  }

  /* テンプレートグリッド */
  .template-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* カード */
  .soft-card {
    padding: 16px;
    border-radius: 14px;
    margin-bottom: 14px;
  }

  /* フォーム */
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn-soft {
    width: 100%;
    text-align: center;
  }

  .filter-actions {
    flex-direction: column;
  }

  .filter-actions .btn-soft {
    width: 100%;
    text-align: center;
  }

  /* タブ */
  .tab-group {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .tab-btn {
    flex-shrink: 0;
    font-size: 13px;
    padding: 8px 16px;
  }

  /* テーブル */
  .soft-table {
    font-size: 12px;
  }

  .soft-table thead th,
  .soft-table tbody td {
    padding: 8px 8px;
  }

  /* モーダル */
  .modal-container {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 18px;
    margin: 10px;
  }

  .modal-footer {
    flex-direction: column;
  }

  .modal-footer .btn-soft {
    width: 100%;
    text-align: center;
  }

  /* トースト */
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .toast {
    max-width: 100%;
  }

  /* ページネーション */
  .pagination button {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }
}

/* ===========================================
   レスポンシブ: 小型スマートフォン
   =========================================== */
@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .summary-value {
    font-size: 20px;
  }

  .header-inner {
    padding: 0 12px;
    gap: 10px;
  }

  .main-content {
    padding: 12px;
  }

  .soft-card {
    padding: 14px;
    border-radius: 12px;
  }

  .btn-soft {
    padding: 10px 18px;
    font-size: 13px;
  }

  .btn-lg {
    padding: 12px 24px;
    font-size: 14px;
  }
}

/* ===========================================
   ピン留め・お気に入り
   =========================================== */
.pin-indicator {
  position: absolute;
  top: 12px;
  left: 12px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
}

.star-mark {
  color: #d4a017;
  margin-left: 4px;
  font-weight: 700;
}

/* ===========================================
   必須エラー
   =========================================== */
.required-error {
  box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light), 0 0 0 2px var(--danger) !important;
}

.required-error-msg {
  color: var(--danger);
  font-size: 11px;
  margin-top: 2px;
  display: block;
}

/* ===========================================
   棒グラフ
   =========================================== */
.bar-chart-container {
  padding: 8px 0;
}

.bar-chart-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  gap: 12px;
}

.bar-chart-label {
  width: 180px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.bar-chart-track {
  flex: 1;
  height: 24px;
  background: var(--bg);
  border-radius: 12px;
  box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
  overflow: hidden;
  position: relative;
}

.bar-chart-fill {
  height: 100%;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #6e9bfa);
  transition: width 0.6s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  min-width: 32px;
}

.bar-chart-fill.rank-a {
  background: linear-gradient(135deg, var(--primary), #6e9bfa);
}

.bar-chart-fill.rank-b {
  background: linear-gradient(135deg, var(--accent), #5dd9a8);
}

.bar-chart-fill.rank-c {
  background: linear-gradient(135deg, var(--warning), #f5d080);
}

.bar-chart-value {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

/* ===========================================
   プレビューエリア
   =========================================== */
.preview-area {
  margin-top: 20px;
  padding: 20px;
  background: var(--bg-light);
  border-radius: var(--radius-sm);
  border: 2px dashed rgba(77, 123, 243, 0.3);
}

.preview-area h4 {
  font-size: 14px;
  color: var(--primary);
  margin-bottom: 12px;
}

.preview-row {
  display: flex;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(163, 177, 198, 0.15);
}

.preview-row:last-child {
  border-bottom: none;
}

.preview-label {
  width: 140px;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.preview-value {
  color: var(--text);
  font-weight: 600;
}

/* ===========================================
   テンプレートカード 有効期限オレンジ
   =========================================== */
.template-card.expiring-soon {
  background: linear-gradient(135deg, #fff3e0, var(--bg));
  border-left: 4px solid var(--warning);
}

/* ===========================================
   評価スター表示
   =========================================== */
.rating-display {
  display: inline-flex;
  gap: 2px;
}

.rating-star {
  color: #d4a017;
  font-size: 14px;
}

.rating-star.empty {
  color: var(--shadow-dark);
}

/* ===========================================
   レスポンシブ追加: 棒グラフ
   =========================================== */
@media (max-width: 768px) {
  .bar-chart-label {
    width: 100px;
    font-size: 11px;
  }

  .bar-chart-row {
    gap: 8px;
  }

  .preview-row {
    flex-direction: column;
    gap: 2px;
  }

  .preview-label {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .bar-chart-label {
    width: 80px;
    font-size: 10px;
  }
}

/* ===========================================
   印刷用
   =========================================== */
@media print {
  .soft-header,
  .sidebar,
  .hamburger,
  .filter-card,
  .form-actions,
  .pagination,
  .toast-container {
    display: none !important;
  }

  .main-content {
    margin: 0;
    padding: 0;
  }

  .soft-card {
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }
}
