@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600;700&family=Noto+Sans+JP:wght@400;500;700&display=swap');

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  color: #2D3436;
  background: #F5F6FA;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

input, select, textarea {
  font-family: inherit;
  outline: none;
}

/* ========== サイドバー ========== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 260px;
  height: 100vh;
  background: #1E272E;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 24px 24px 8px;
}

.sidebar-logo h1 {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: #FFFFFF;
  line-height: 1.2;
}

.sidebar-logo span {
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 12px;
  color: #636E72;
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 24px 0;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: #B2BEC3;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-nav li a.active {
  border-left-color: #00B894;
  background: rgba(0, 184, 148, 0.1);
  color: #00B894;
}

.sidebar-nav li a .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.sidebar-nav li a .nav-icon .material-icons {
  font-size: 20px;
  vertical-align: middle;
  margin-right: 0;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer .user-name {
  color: #B2BEC3;
  font-size: 13px;
  margin-bottom: 6px;
}

.sidebar-footer .logout-link {
  color: #636E72;
  font-size: 12px;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-footer .logout-link .material-icons {
  font-size: 16px;
}

.sidebar-footer .logout-link:hover {
  color: #FF7675;
}

/* ========== ハンバーガー ========== */
.hamburger {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: #1E272E;
  color: #FFF;
  border: none;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  font-size: 22px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.hamburger .material-icons {
  font-size: 22px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
}

/* ========== トップバー ========== */
.topbar {
  position: sticky;
  top: 0;
  margin-left: 260px;
  height: 64px;
  background: #FFFFFF;
  border-bottom: 1px solid #DFE6E9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 50;
}

.topbar-left {
  display: flex;
  flex-direction: column;
}

.topbar-title {
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: #2D3436;
}

.breadcrumb {
  font-size: 12px;
  color: #636E72;
}

.breadcrumb a {
  color: #00B894;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.notification-bell {
  position: relative;
  font-size: 20px;
  color: #636E72;
  cursor: pointer;
  transition: color 0.2s;
}

.notification-bell .material-icons {
  font-size: 22px;
}

.notification-bell:hover {
  color: #2D3436;
}

.notification-bell .badge {
  position: absolute;
  top: -4px;
  right: -6px;
  background: #FF7675;
  color: #FFF;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #00B894;
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 14px;
}

/* ========== メインコンテンツ ========== */
.main-content {
  margin-left: 260px;
  padding: 32px;
  min-height: calc(100vh - 64px);
}

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

.kpi-card {
  background: #FFFFFF;
  border: 1px solid #DFE6E9;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s;
}

.kpi-card:hover {
  border-color: #00B894;
}

.kpi-card .kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: #636E72;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-icon {
  font-size: 28px;
  opacity: 0.7;
}

.kpi-card .kpi-value {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 36px;
  line-height: 1.1;
}

.kpi-card .kpi-unit {
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 400;
  font-size: 14px;
  color: #636E72;
  margin-left: 4px;
}

.kpi-card .kpi-change {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 500;
}

.kpi-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
}

/* ========== カード ========== */
.card {
  background: #FFFFFF;
  border: 1px solid #DFE6E9;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
  margin-bottom: 32px;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #DFE6E9;
}

.card-header h2 {
  font-size: 16px;
  font-weight: 700;
}

.card-header .view-all {
  font-size: 13px;
  color: #00B894;
  font-weight: 500;
  transition: opacity 0.2s;
}

.card-header .view-all:hover {
  opacity: 0.7;
}

.card-body {
  padding: 24px;
}

.card-body.no-padding {
  padding: 0;
}

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

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

thead th {
  background: #F5F6FA;
  color: #636E72;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 16px;
  text-align: left;
  white-space: nowrap;
}

tbody td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid #F0F0F0;
  white-space: nowrap;
}

tbody tr {
  transition: background 0.15s;
}

tbody tr:hover {
  background: #F8FFF8;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ========== ステータスバッジ ========== */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge.pending {
  background: #FDCB6E;
  color: #7D6608;
}

.status-badge.approved {
  background: #55EFC4;
  color: #00694B;
}

.status-badge.rejected {
  background: #FF7675;
  color: #FFFFFF;
}

.status-badge.active {
  background: #00B894;
  color: #FFFFFF;
}

.status-badge.closed {
  background: #B2BEC3;
  color: #636E72;
}

.status-badge.new {
  background: #74B9FF;
  color: #0652DD;
}

/* ========== ボタン ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: #00B894;
  color: #FFF;
}

.btn-primary:hover {
  background: #00a383;
}

.btn-secondary {
  background: transparent;
  border: 1px solid #DFE6E9;
  color: #2D3436;
}

.btn-secondary:hover {
  background: #F5F6FA;
}

.btn-danger {
  background: #FF7675;
  color: #FFF;
}

.btn-danger:hover {
  background: #e66564;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

/* ========== フィルターバー ========== */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.filter-tabs {
  display: flex;
  gap: 4px;
  background: #F5F6FA;
  border-radius: 10px;
  padding: 4px;
}

.filter-tab {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #636E72;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.filter-tab:hover {
  color: #2D3436;
}

.filter-tab.active {
  background: #FFFFFF;
  color: #00B894;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.filter-tab .count-badge {
  display: inline-block;
  background: #DFE6E9;
  color: #636E72;
  padding: 1px 7px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
}

.filter-tab.active .count-badge {
  background: rgba(0, 184, 148, 0.15);
  color: #00B894;
}

.filter-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-input {
  border: 1px solid #DFE6E9;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  min-width: 240px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: #00B894;
  box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.12);
}

.filter-select {
  border: 1px solid #DFE6E9;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  background: #FFF;
  color: #2D3436;
  cursor: pointer;
  transition: border-color 0.2s;
}

.filter-select:focus {
  border-color: #00B894;
  box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.12);
}

/* ========== 一括操作 ========== */
.bulk-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: #F5F6FA;
  border-bottom: 1px solid #DFE6E9;
}

.bulk-actions span {
  font-size: 13px;
  color: #636E72;
}

/* ========== ページネーション ========== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 0;
}

.pagination .page-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid #DFE6E9;
  background: #FFF;
  color: #2D3436;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination .page-btn:hover {
  background: #F5F6FA;
}

.pagination .page-btn.active {
  background: #00B894;
  color: #FFF;
  border-color: #00B894;
}

.pagination .page-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ========== 詳細ページ ========== */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 32px;
}

.detail-grid.full {
  grid-template-columns: 1fr;
}

.info-row {
  display: flex;
  padding: 10px 0;
  border-bottom: 1px solid #F0F0F0;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  width: 140px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 500;
  color: #636E72;
}

.info-value {
  font-size: 14px;
  color: #2D3436;
  line-height: 1.6;
}

/* ========== ステータス変更エリア ========== */
.status-action-area {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.status-action-area .current-status {
  font-size: 14px;
  color: #636E72;
}

/* ========== メモ ========== */
.memo-area textarea {
  width: 100%;
  border: 1px solid #DFE6E9;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.memo-area textarea:focus {
  border-color: #00B894;
  box-shadow: 0 0 0 3px rgba(0, 184, 148, 0.12);
}

.memo-area label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #636E72;
  margin-bottom: 6px;
}

.memo-area .save-row {
  margin-top: 12px;
  text-align: right;
}

/* ========== タイムライン ========== */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: #DFE6E9;
}

.timeline-item {
  position: relative;
  padding-bottom: 20px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -24px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #00B894;
  border: 2px solid #FFF;
  box-shadow: 0 0 0 2px #DFE6E9;
}

.timeline-item .tl-time {
  font-size: 12px;
  color: #636E72;
  margin-bottom: 2px;
}

.timeline-item .tl-text {
  font-size: 14px;
  color: #2D3436;
}

/* ========== チェックボックス ========== */
.custom-checkbox {
  width: 18px;
  height: 18px;
  accent-color: #00B894;
  cursor: pointer;
}

/* ========== ユーティリティ ========== */
.text-primary { color: #00B894; }
.text-danger { color: #FF7675; }
.text-sub { color: #636E72; }
.text-sm { font-size: 13px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.show {
    display: block;
  }

  .hamburger {
    display: flex;
  }

  .topbar {
    margin-left: 0;
    padding: 0 16px 0 64px;
  }

  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }

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

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

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

  .filter-tabs {
    overflow-x: auto;
  }

  .filter-right {
    flex-direction: column;
  }

  .search-input {
    min-width: 100%;
  }

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