/**
 * コンポーネントスタイル
 */

/* ===== ボタン ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  text-decoration: none;
  font-size: 0.875rem;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-success {
  background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
  color: white;
}

.btn-info {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
}

.btn-warning {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  color: white;
}

/* アウトラインボタン */
.btn-outline-primary {
  background: white;
  color: #3b82f6;
  border: 1.5px solid #3b82f6;
}
.btn-outline-primary:hover {
  background: #3b82f6;
  color: white;
}

.btn-outline-danger {
  background: white;
  color: #ef4444;
  border: 1.5px solid #ef4444;
}
.btn-outline-danger:hover {
  background: #ef4444;
  color: white;
}

/* ===== SVGアイコン共通スタイル ===== */
.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  fill: currentColor;
  stroke: currentColor;
  flex-shrink: 0;
}
.icon-sm { width: 0.875em; height: 0.875em; }
.icon-lg { width: 1.25em; height: 1.25em; }
.icon-xl { width: 1.5em; height: 1.5em; }
.icon-2x { width: 2em; height: 2em; }
.icon-3x { width: 3em; height: 3em; }

/* ボタン内のアイコンの余白 */
.btn .icon { margin-right: 0.25em; }
.btn .icon:only-child { margin-right: 0; }

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-group {
  display: inline-flex;
  gap: 0.25rem;
}

/* ===== カード ===== */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  color: var(--color-text-primary);
}

.card-body {
  padding: 1.5rem;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
}

/* ===== テーブル ===== */
.table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  table-layout: auto;
}

/* テーブルを横スクロール可能にするラッパー */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

.table-responsive .table {
  margin-bottom: 0;
}

.table thead {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.table thead th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
}

.table tbody tr {
  border-bottom: 1px solid #e9ecef;
  transition: all 0.2s;
}

.table tbody tr:nth-child(even) {
  background: #f8f9fa;
}

.table tbody tr:hover {
  background: #e7f3ff !important;
  cursor: pointer;
}

.table tbody tr:hover td {
  background: transparent;
}

.table tbody td {
  padding: 1rem;
  font-size: 0.875rem;
  color: var(--color-text-primary);
}

.table tbody td:first-child {
  font-weight: 500;
}

/* ===== フォーム ===== */
.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
}

.form-group.required label::after {
  content: ' *';
  color: #dc3545;
  font-weight: 700;
}

.form-label,
.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text-primary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  font-size: 0.9375rem;
  transition: all 0.2s;
  background: white;
  font-family: inherit;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: #adb5bd;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
  background: #f8f9ff;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 1.5rem;
  width: 100%;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 1.5rem;
  width: 100%;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: 1.5rem;
  width: 100%;
}

.form-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid #e9ecef;
}

.form-section-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--color-text-primary);
}

.filter-form {
  padding: 0;
}

.filter-row {
  display: flex;
  gap: 1rem;
  align-items: end;
  flex-wrap: wrap;
}

/* ===== 検索コントロール（統一デザイン） ===== */
.search-controls {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
  flex-wrap: wrap;
  padding: 0.5rem;
  background: #f8f9fa;
  border-radius: 12px;
  border: 1px solid #e9ecef;
}

.search-input-wrapper {
  flex: 1;
  min-width: 220px;
  position: relative;
}

.search-input-wrapper::before {
  content: "🔍";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.875rem;
  pointer-events: none;
  z-index: 1;
}

.search-input-wrapper input {
  width: 100%;
  padding: 0.625rem 1rem 0.625rem 2.5rem;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 0.875rem;
  background: white;
  transition: all 0.2s ease;
  height: 42px;
}

.search-input-wrapper input::placeholder {
  color: #9ca3af;
}

.search-input-wrapper input:hover {
  border-color: #e5e7eb;
}

.search-input-wrapper input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: white;
}

.filter-select-wrapper,
.sort-select-wrapper {
  min-width: 150px;
}

.limit-select-wrapper {
  min-width: 90px;
}

.filter-select-wrapper select,
.sort-select-wrapper select,
.limit-select-wrapper select {
  width: 100%;
  padding: 0.625rem 2rem 0.625rem 0.875rem;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 0.875rem;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E") no-repeat right 10px center;
  background-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
  height: 42px;
  color: #374151;
}

.filter-select-wrapper select:hover,
.sort-select-wrapper select:hover,
.limit-select-wrapper select:hover {
  border-color: #e5e7eb;
}

.filter-select-wrapper select:focus,
.sort-select-wrapper select:focus,
.limit-select-wrapper select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-controls .btn-clear {
  padding: 0.625rem 1rem;
  background: white;
  color: #6b7280;
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  height: 42px;
  white-space: nowrap;
}

.search-controls .btn-clear:hover {
  background: #f3f4f6;
  color: #374151;
  transform: none;
  box-shadow: none;
}

/* テーブルコントロール */
.table-controls {
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.record-count {
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 500;
}

tr.hidden-row {
  display: none;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .search-controls {
    flex-direction: column;
    padding: 0.75rem;
  }

  .search-input-wrapper,
  .filter-select-wrapper,
  .sort-select-wrapper,
  .limit-select-wrapper {
    width: 100%;
    min-width: unset;
  }

  .search-controls .btn-clear {
    width: 100%;
    justify-content: center;
  }
}

/* ===== ページネーション ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid #e9ecef;
}

.pagination .btn {
  min-width: 80px;
  font-weight: 600;
}

.pagination-info {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  padding: 0 1rem;
  font-weight: 500;
}

.pagination-pages {
  display: flex;
  gap: 0.25rem;
}

.pagination-page {
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  background: white;
  color: var(--color-text-primary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}

.pagination-page:hover {
  background: #667eea;
  color: white;
  border-color: #667eea;
  transform: translateY(-1px);
}

.pagination-page.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: transparent;
  font-weight: 600;
}

/* ===== バッジ ===== */
.badge {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-success {
  background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
  color: white;
}

.badge-info {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
}

.badge-warning {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.badge-error,
.badge-danger {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
  color: white;
}

.badge-link {
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-block;
}

.badge-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.badge-secondary {
  background: #6c757d;
  color: white;
}

/* ===== リンク ===== */
.link-primary {
  color: #667eea;
  text-decoration: none;
  transition: color 0.2s;
  font-weight: 500;
}

.link-primary:hover {
  color: #764ba2;
  text-decoration: underline;
}

/* ===== ユーティリティ ===== */
.text-muted {
  color: var(--color-text-tertiary);
}

.text-sm {
  font-size: 0.875rem;
}

.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--color-text-tertiary);
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 2px dashed #cbd5e1;
  border-radius: 0.75rem;
  margin: 1rem 0;
}

.empty-state::before {
  content: '📋';
  display: block;
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state p {
  font-size: 1.125rem;
  margin-bottom: 1.5rem;
  color: #64748b;
}

.empty-state .btn {
  margin-top: 0.5rem;
}

/* ===== ページコンテナ ===== */
.page-container {
  padding: 2rem;
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  overflow-x: hidden;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: var(--color-text-primary);
}

.page-subtitle {
  color: var(--color-text-secondary);
  margin: 0;
  font-size: 1rem;
}

.page-actions {
  display: flex;
  gap: 0.75rem;
}

/* ===== カードフッター ===== */
.card-footer {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  border-top: 2px solid #e9ecef;
  background: #f8f9fa;
}

/* ===== アラート ===== */
.alert {
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  border-radius: 8px;
  border-left: 4px solid;
  font-size: 0.9375rem;
}

.alert strong {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.alert ul {
  margin: 0.75rem 0 0 0;
  padding-left: 1.5rem;
}

.alert li {
  margin-top: 0.5rem;
}

.alert-error {
  background: #fee;
  border-left-color: #dc3545;
  color: #721c24;
}

.alert-success {
  background: #d4edda;
  border-left-color: #28a745;
  color: #155724;
}

.alert-warning {
  background: #fff3cd;
  border-left-color: #ffc107;
  color: #856404;
}

.alert-info {
  background: #d1ecf1;
  border-left-color: #17a2b8;
  color: #0c5460;
}

/* ===== 詳細表示（show.ejs用） ===== */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.info-item {
  padding: 0.75rem 0;
}

.info-item label {
  display: block;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-item div {
  font-weight: 500;
  font-size: 1rem;
  color: var(--color-text-primary);
}

.info-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid #e9ecef;
}

.info-section label {
  display: block;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.notes-box {
  background: #f8f9fa;
  padding: 1.25rem;
  border-radius: 8px;
  border: 2px solid #e9ecef;
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 0.9375rem;
}

/* ===== タブナビゲーション ===== */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin: 2rem 0 1rem 0;
  border-bottom: 2px solid #e9ecef;
  overflow-x: auto;
}

.tab-btn {
  padding: 1rem 1.75rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #667eea;
  background: #f8f9ff;
}

.tab-btn.active {
  color: #667eea;
  border-bottom-color: #667eea;
  background: #f8f9ff;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.text-success {
  color: #28a745;
  font-weight: 600;
}

.text-error {
  color: #dc3545;
  font-weight: 600;
}

.text-warning {
  color: #ffc107;
  font-weight: 600;
}

.text-info {
  color: #17a2b8;
  font-weight: 600;
}

/* ===== KPIカード ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
  min-height: 120px;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--card-accent, linear-gradient(90deg, #667eea, #764ba2));
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.kpi-card-urgent {
  border-color: #ff9500;
  background: linear-gradient(135deg, #fff9f0 0%, #ffffff 100%);
  animation: urgentPulse 3s infinite;
}

.kpi-card-alert {
  border-color: #ff6b6b;
  background: linear-gradient(135deg, #fff5f5 0%, #ffffff 100%);
  animation: alertPulse 2s infinite;
}

@keyframes urgentPulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(255, 149, 0, 0.15); }
  50% { box-shadow: 0 8px 24px rgba(255, 149, 0, 0.25); }
}

@keyframes alertPulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(255, 107, 107, 0.15); }
  50% { box-shadow: 0 8px 24px rgba(255, 107, 107, 0.25); }
}

.kpi-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
  position: relative;
}

.kpi-content {
  flex: 1;
  min-width: 0;
}

.kpi-value {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.5rem;
  color: var(--color-text-primary);
}

.kpi-label {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.kpi-subtitle {
  font-size: 0.8rem;
  color: var(--color-text-tertiary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kpi-change {
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.kpi-change.positive {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.kpi-change.negative {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.urgent-text {
  color: #ff9500;
  font-weight: 700;
  font-size: 0.75rem;
  animation: urgentBlink 2s infinite;
}

@keyframes urgentBlink {
  0%, 50% { opacity: 1; }
  75% { opacity: 0.7; }
  100% { opacity: 1; }
}

/* KPIカード色設定 */
.kpi-card.kpi-horses {
  --card-accent: linear-gradient(90deg, #667eea, #764ba2);
}

.kpi-card.kpi-owners {
  --card-accent: linear-gradient(90deg, #f093fb, #f5576c);
}

.kpi-card.kpi-revenue {
  --card-accent: linear-gradient(90deg, #4facfe, #00f2fe);
}

.kpi-card.kpi-unpaid {
  --card-accent: linear-gradient(90deg, #fa709a, #fee140);
}

.kpi-card.kpi-health {
  --card-accent: linear-gradient(90deg, #ff9a56, #ff6a88);
}

.kpi-card.kpi-training {
  --card-accent: linear-gradient(90deg, #a8edea, #fed6e3);
}

.kpi-card.kpi-medical {
  --card-accent: linear-gradient(90deg, #56ab2f, #a8e063);
}

/* ===== 新しい横長KPIカード（4つ用） ===== */
.kpi-grid-new {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.kpi-card-horizontal {
  background: white;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
  min-height: 100px;
  max-height: 120px;
}

.kpi-card-horizontal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea, #764ba2);
}

.kpi-card-horizontal:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.kpi-card-horizontal.urgent {
  border-color: #ff9500;
  background: linear-gradient(135deg, #fff9f0 0%, #ffffff 100%);
}

.kpi-card-horizontal.urgent::before {
  background: linear-gradient(90deg, #ff9500, #ff6b35);
}

.kpi-card-horizontal.kpi-horses::before {
  background: linear-gradient(90deg, #667eea, #764ba2);
}

.kpi-card-horizontal.kpi-unpaid::before {
  background: linear-gradient(90deg, #fa709a, #fee140);
}

.kpi-card-horizontal.kpi-health::before {
  background: linear-gradient(90deg, #ff9a56, #ff6a88);
}

.kpi-card-horizontal.kpi-training::before {
  background: linear-gradient(90deg, #a8edea, #fed6e3);
}

.kpi-card-horizontal.kpi-revenue::before {
  background: linear-gradient(90deg, #4facfe, #00f2fe);
}

.kpi-icon-horizontal {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 2px solid rgba(0, 0, 0, 0.05);
}

.kpi-card-horizontal.kpi-horses .kpi-icon-horizontal {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.kpi-card-horizontal.kpi-unpaid .kpi-icon-horizontal {
  background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  color: white;
}

.kpi-card-horizontal.kpi-health .kpi-icon-horizontal {
  background: linear-gradient(135deg, #ff9a56 0%, #ff6a88 100%);
  color: white;
}

.kpi-card-horizontal.kpi-training .kpi-icon-horizontal {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  color: #333;
}

.kpi-card-horizontal.kpi-revenue .kpi-icon-horizontal {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
}

.kpi-data {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.kpi-number {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.25rem;
  color: var(--color-text-primary);
}

.kpi-label-horizontal {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  font-weight: 500;
  line-height: 1.2;
}

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

  .kpi-grid-new {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .kpi-grid-new {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .kpi-card {
    padding: 1.5rem;
    min-height: 100px;
  }

  .kpi-card-horizontal {
    padding: 1.25rem;
    min-height: 90px;
    max-height: 110px;
  }

  .kpi-icon {
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
  }

  .kpi-icon-horizontal {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
  }

  .kpi-value {
    font-size: 1.875rem;
  }

  .kpi-number {
    font-size: 1.75rem;
  }

  .kpi-label-horizontal {
    font-size: 0.8rem;
  }

  .page-container {
    padding: 1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-row .form-group {
    width: 100%;
  }

  .form-grid,
  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .table {
    font-size: 0.8125rem;
  }

  .table thead th,
  .table tbody td {
    padding: 0.75rem 0.5rem;
  }

  .pagination {
    flex-wrap: wrap;
  }

  .pagination-pages {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
  }

  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tab-btn {
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
  }

  .card-footer {
    flex-direction: column;
  }

  .card-footer .btn {
    width: 100%;
  }
}

/* ===== 統計カード（オーナーページ用） ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.stat-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(102, 126, 234, 0.1);
}

.stat-content {
  flex: 1;
  min-width: 0;
}

.stat-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1f2937;
  line-height: 1;
}

/* 統計カードのタイプ別スタイル */
.stat-paid {
  border-left: 4px solid #10b981;
}

.stat-paid .stat-icon {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.stat-paid:hover {
  border-left-color: #059669;
  box-shadow: 0 8px 16px rgba(16, 185, 129, 0.2);
}

.stat-unpaid {
  border-left: 4px solid #f59e0b;
}

.stat-unpaid .stat-icon {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.stat-unpaid:hover {
  border-left-color: #d97706;
  box-shadow: 0 8px 16px rgba(245, 158, 11, 0.2);
}

.stat-draft {
  border-left: 4px solid #6b7280;
}

.stat-draft .stat-icon {
  background: rgba(107, 114, 128, 0.1);
  color: #6b7280;
}

.stat-draft:hover {
  border-left-color: #4b5563;
  box-shadow: 0 8px 16px rgba(107, 114, 128, 0.2);
}

/* 統計カードのレスポンシブ対応 */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-card:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .stat-card {
    padding: 1.25rem;
  }

  .stat-card:last-child {
    grid-column: auto;
  }

  .stat-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .stat-label {
    font-size: 0.8rem;
  }
}

/* ===== 請求期間情報（オーナー詳細ページ用） ===== */
.billing-period-info {
  margin-bottom: 1.5rem;
}

.period-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
}

.period-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.period-header .btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-weight: 600;
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}

.period-header .btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 255, 255, 0.2);
}

/* 新しい統計カードタイプ */
.stat-count {
  border-left: 4px solid #3b82f6;
}

.stat-count .stat-icon {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.stat-count:hover {
  border-left-color: #2563eb;
  box-shadow: 0 8px 16px rgba(59, 130, 246, 0.2);
}

.stat-breakdown {
  border-left: 4px solid #8b5cf6;
}

.stat-breakdown .stat-icon {
  background: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

.stat-breakdown:hover {
  border-left-color: #7c3aed;
  box-shadow: 0 8px 16px rgba(139, 92, 246, 0.2);
}

.stat-expected {
  border-left: 4px solid #06b6d4;
}

.stat-expected .stat-icon {
  background: rgba(6, 182, 212, 0.1);
  color: #06b6d4;
}

.stat-expected:hover {
  border-left-color: #0891b2;
  box-shadow: 0 8px 16px rgba(6, 182, 212, 0.2);
}

/* 内訳詳細 */
.breakdown-detail {
  line-height: 1.6;
}

.breakdown-detail small {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.breakdown-detail small:last-child {
  margin-bottom: 0;
}

/* レスポンシブ対応（請求期間情報） */
@media (max-width: 768px) {
  .period-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
    padding: 1.25rem;
  }

  .period-header h3 {
    font-size: 1.125rem;
  }

  .period-header .btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
  }

  .breakdown-detail {
    text-align: left;
  }
}

/* ===== 馬名スタイル ===== */
.horse-name {
  font-weight: 600;
}
