/* シンプル・青基調デザイン */

:root {
  --primary-blue: #2563eb;
  --primary-blue-dark: #1e40af;
  --primary-blue-light: #3b82f6;
  --secondary-blue: #60a5fa;
  --accent-blue: #93c5fd;
  --bg-light: #f8fafc;
  --bg-white: #ffffff;
  --text-dark: #1e293b;
  --text-gray: #64748b;
  --border-gray: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
  line-height: 1.6;
}

/* Dashboard Container */
.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* Dashboard Header */
.dashboard-header {
  background: white;
  border-radius: 12px;
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
}

.dashboard-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

.dashboard-subtitle {
  font-size: 0.875rem;
  color: var(--text-gray);
  margin-top: 0.25rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Year Selector */
.year-selector {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-light);
  padding: 0.25rem;
  border-radius: 8px;
}

.year-btn {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-gray);
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.year-btn:hover {
  background: white;
  color: var(--primary-blue);
}

.year-btn.active {
  background: var(--primary-blue);
  color: white;
}

/* View Toggle */
.view-toggle {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-light);
  padding: 0.25rem;
  border-radius: 8px;
}

.toggle-btn {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-gray);
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle-btn:hover {
  background: white;
  color: var(--primary-blue);
}

.toggle-btn.active {
  background: var(--primary-blue);
  color: white;
}

/* Refresh Button */
.refresh-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-gray);
  background: white;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-gray);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.refresh-btn:hover {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

/* Quarter Tabs */
.quarter-tabs {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--border-gray);
  padding-top: 1.5rem;
}

.quarter-tab {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-gray);
  background: white;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.quarter-tab:hover {
  border-color: var(--primary-blue);
  background: var(--bg-light);
}

.quarter-tab.active {
  border-color: var(--primary-blue);
  background: var(--primary-blue);
  color: white;
}

.tab-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
}

.tab-months {
  display: block;
  font-size: 0.75rem;
  opacity: 0.8;
  margin-top: 0.25rem;
}

.quarter-tabs.hidden {
  display: none;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Stats Card */
.stats-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
}

.stats-card:hover {
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
}

.card-icon.blue {
  background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
}

.card-icon.green {
  background: linear-gradient(135deg, #10b981, #34d399);
}

.card-icon.orange {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.card-icon.purple {
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
}

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

.card-period {
  font-size: 0.75rem;
  color: var(--text-gray);
  opacity: 0.7;
}

.card-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0.5rem 0;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-gray);
  font-size: 0.875rem;
}

.card-footer .label {
  color: var(--text-gray);
}

.card-footer .value {
  font-weight: 600;
  color: var(--text-dark);
}

.card-footer .value.positive {
  color: var(--success);
}

.card-footer .value.negative {
  color: var(--danger);
}

/* Progress Bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-light);
  border-radius: 4px;
  overflow: hidden;
  margin: 1rem 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-blue), var(--secondary-blue));
  border-radius: 4px;
  transition: width 1s ease;
}

/* Chart Card */
.chart-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
}

.card-header-simple {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.card-header-simple h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-dark);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.export-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-gray);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-gray);
  font-size: 0.875rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.export-btn:hover {
  background: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

.chart-wrapper {
  position: relative;
  height: 300px;
}

/* Ranking List */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-light);
  border-radius: 8px;
  transition: all 0.2s;
}

.ranking-item:hover {
  background: var(--accent-blue);
  background: rgba(37, 99, 235, 0.05);
}

.rank-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.rank-badge.rank-1 {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: white;
}

.rank-badge.rank-2 {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  color: white;
}

.rank-badge.rank-3 {
  background: linear-gradient(135deg, #fb923c, #f97316);
  color: white;
}

.rank-badge {
  background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
  color: white;
}

.person-info {
  flex: 1;
}

.person-name {
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.25rem;
}

.person-amount {
  font-size: 0.875rem;
  color: var(--text-gray);
}

.person-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-light);
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-blue), var(--secondary-blue));
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* Status Grid */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
}

.status-item {
  padding: 1rem;
  background: var(--bg-light);
  border-radius: 8px;
  text-align: center;
  transition: all 0.2s;
}

.status-item:hover {
  background: rgba(37, 99, 235, 0.05);
  transform: translateY(-2px);
}

.status-label {
  font-size: 0.75rem;
  color: var(--text-gray);
  margin-bottom: 0.5rem;
}

.status-count {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
}

.status-estimate {
  border-left: 3px solid #f59e0b;
}

.status-ordered {
  border-left: 3px solid #3b82f6;
}

.status-in_progress {
  border-left: 3px solid #10b981;
}

.status-completed {
  border-left: 3px solid #6366f1;
}

.status-cancelled {
  border-left: 3px solid #ef4444;
}

/* Table */
.table-wrapper {
  overflow-x: auto;
  margin-top: 1.5rem;
}

.simple-table {
  width: 100%;
  border-collapse: collapse;
}

.simple-table thead {
  background: var(--bg-light);
}

.simple-table th {
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-gray);
  font-size: 0.875rem;
  border-bottom: 2px solid var(--border-gray);
}

.simple-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-gray);
  color: var(--text-dark);
}

.simple-table tbody tr {
  transition: background 0.2s;
}

.simple-table tbody tr:hover {
  background: var(--bg-light);
}

.simple-table tbody tr.clickable {
  cursor: pointer;
}

.simple-table tbody tr.clickable:hover {
  background: rgba(37, 99, 235, 0.05);
}

.simple-table .total-row {
  font-weight: 700;
  background: var(--bg-light);
  border-top: 2px solid var(--border-gray);
}

.achievement-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 600;
}

.achievement-badge.high {
  background: #d1fae5;
  color: #065f46;
}

.achievement-badge.medium {
  background: #dbeafe;
  color: #1e40af;
}

.achievement-badge.low {
  background: #fee2e2;
  color: #991b1b;
}

/* Yearly View */
.yearly-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.yearly-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Loading & Error */
.loading-spinner {
  text-align: center;
  padding: 3rem;
  color: var(--text-gray);
}

.loading-spinner i {
  font-size: 2rem;
  color: var(--primary-blue);
  margin-bottom: 1rem;
}

.error-message {
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  color: #991b1b;
}

.error-message i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.no-data {
  text-align: center;
  padding: 2rem;
  color: var(--text-gray);
}

/* Utility */
.mr-2 {
  margin-right: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
  .dashboard-container {
    padding: 1rem;
  }

  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .quarter-tabs {
    flex-direction: column;
  }

  .yearly-charts {
    grid-template-columns: 1fr;
  }

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

/* Current Info Banner */
.current-info-banner {
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.15);
}

.current-info-banner i {
  font-size: 1.25rem;
}

/* Monthly Achievement Card */
.monthly-achievement {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.monthly-achievement h3 {
  color: var(--text-dark);
  font-size: 1.125rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.monthly-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.monthly-stat-item {
  padding: 1rem;
  background: var(--bg-light);
  border-radius: 8px;
  border-left: 3px solid var(--primary-blue);
}

.monthly-stat-item .label {
  font-size: 0.875rem;
  color: var(--text-gray);
  margin-bottom: 0.5rem;
}

.monthly-stat-item .value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-dark);
}

.monthly-stat-item .sub-value {
  font-size: 0.875rem;
  color: var(--text-gray);
  margin-top: 0.25rem;
}


/* Scope Selector Styles */
.scope-selector {
  display: flex;
  gap: 0.5rem;
  background: white;
  padding: 0.25rem;
  border-radius: 8px;
}

.scope-btn {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-medium);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.scope-btn:hover {
  background: var(--bg-light);
  color: var(--primary-blue);
}

.scope-btn.active {
  background: var(--primary-blue);
  color: white;
}

.scope-btn i {
  font-size: 0.875rem;
}
