/* ===========================
   WOODWORK 統合建設管理システム
   共通スタイル
   =========================== */

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

:root {
  --nav-bg: #0f1d36;
  --nav-width: 220px;
  --nav-text: #a8b8d8;
  --nav-active-bg: #1e3a6e;
  --nav-active-text: #ffffff;
  --nav-hover-bg: #1a2e52;
  --header-bg: #ffffff;
  --content-bg: #f4f6fa;
  --card-bg: #ffffff;
  --border-color: #e5e9f2;
  --text-primary: #1a2340;
  --text-secondary: #6b7a99;
  --text-muted: #9aaac0;
  --accent-blue: #2563eb;
  --accent-blue-light: #dbeafe;
  --accent-green: #16a34a;
  --accent-green-light: #dcfce7;
  --accent-orange: #ea580c;
  --accent-orange-light: #ffedd5;
  --accent-red: #dc2626;
  --accent-red-light: #fee2e2;
  --accent-purple: #7c3aed;
  --accent-purple-light: #ede9fe;
  --accent-gray: #6b7280;
  --accent-gray-light: #f3f4f6;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  font-size: 14px;
}

body {
  font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
  background-color: var(--content-bg);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
}

/* ===========================
   ナビゲーション
   =========================== */
.sidebar {
  width: var(--nav-width);
  background-color: var(--nav-bg);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: #2563eb;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-icon svg {
  width: 20px;
  height: 20px;
  fill: white;
}

.sidebar-logo-text .logo-main {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.05em;
  line-height: 1.1;
}

.sidebar-logo-text .logo-sub {
  font-size: 10px;
  color: var(--nav-text);
  line-height: 1.3;
  margin-top: 1px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: var(--nav-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  user-select: none;
}

.nav-item:hover {
  background-color: var(--nav-hover-bg);
  color: #ffffff;
}

.nav-item.active {
  background-color: var(--nav-active-bg);
  color: var(--nav-active-text);
  border-left-color: #2563eb;
  font-weight: 500;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item.active svg {
  opacity: 1;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.sidebar-footer:hover {
  background-color: var(--nav-hover-bg);
}

.footer-avatar {
  width: 32px;
  height: 32px;
  background: #2563eb;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.footer-avatar svg {
  width: 18px;
  height: 18px;
  fill: white;
}

.footer-text .company {
  font-size: 11px;
  color: var(--nav-text);
}

.footer-text .user {
  font-size: 12px;
  color: #ffffff;
  font-weight: 500;
}

/* ===========================
   メインコンテンツエリア
   =========================== */
.main-content {
  margin-left: var(--nav-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===========================
   ページヘッダー
   =========================== */
.page-header {
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.bell-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background 0.15s;
}

.bell-btn:hover {
  background: var(--accent-blue-light);
}

.bell-btn svg {
  width: 20px;
  height: 20px;
}

.bell-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: var(--accent-red);
  color: white;
  font-size: 9px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.header-user:hover {
  background: var(--content-bg);
}

.header-user-info {
  text-align: right;
}

.header-user-info .company {
  font-size: 11px;
  color: var(--text-secondary);
}

.header-user-info .name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ===========================
   ページコンテンツ
   =========================== */
.page-content {
  padding: 24px 28px;
  flex: 1;
}

/* ===========================
   サマリーカード
   =========================== */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 16px;
}

.summary-card-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.summary-card-icon svg {
  width: 24px;
  height: 24px;
}

.summary-card-icon.blue { background: var(--accent-blue-light); color: var(--accent-blue); }
.summary-card-icon.green { background: var(--accent-green-light); color: var(--accent-green); }
.summary-card-icon.purple { background: var(--accent-purple-light); color: var(--accent-purple); }
.summary-card-icon.red { background: var(--accent-red-light); color: var(--accent-red); }
.summary-card-icon.orange { background: var(--accent-orange-light); color: var(--accent-orange); }

.summary-card-body {}

.summary-card-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.summary-card-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.summary-card-value .unit {
  font-size: 14px;
  font-weight: 500;
  margin-left: 2px;
}

.summary-card-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.summary-card-sub.highlight-green { color: var(--accent-green); font-weight: 500; }
.summary-card-sub.highlight-purple { color: var(--accent-purple); font-weight: 500; }
.summary-card-sub.highlight-red { color: var(--accent-red); font-weight: 500; }

/* ===========================
   検索・フィルターバー
   =========================== */
.filter-bar {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 140px;
}

.filter-group label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.filter-input,
.filter-select {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-primary);
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  font-family: inherit;
}

.filter-input:focus,
.filter-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.filter-input::placeholder {
  color: var(--text-muted);
}

.filter-date-range {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-date-range input {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  width: 120px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.filter-date-range input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.filter-date-range span {
  color: var(--text-secondary);
}

.filter-actions {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding-top: 0;
}

/* ===========================
   ボタン
   =========================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--accent-blue);
  color: #ffffff;
}

.btn-primary:hover {
  background: #1d4ed8;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

.btn-secondary {
  background: #fff;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--content-bg);
  border-color: #c0cce0;
}

.btn-success {
  background: var(--accent-green);
  color: #ffffff;
}

.btn-success:hover {
  background: #15803d;
}

.btn-danger {
  background: #fff;
  color: var(--accent-red);
  border: 1px solid var(--border-color);
}

.btn-danger:hover {
  background: var(--accent-red-light);
  border-color: var(--accent-red);
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-blue);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  font-family: inherit;
  font-weight: 500;
}

.btn-link:hover {
  background: var(--accent-blue-light);
}

/* ===========================
   テーブルセクション
   =========================== */
.table-section {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-section-header {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.table-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.data-table th {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: #f8fafd;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid #f0f3f8;
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background 0.1s;
}

.data-table tbody tr:hover {
  background: #f8fafd;
}

.data-table .amount {
  text-align: right;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ===========================
   ステータスバッジ
   =========================== */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue { background: var(--accent-blue-light); color: var(--accent-blue); }
.badge-green { background: var(--accent-green-light); color: var(--accent-green); }
.badge-orange { background: var(--accent-orange-light); color: var(--accent-orange); }
.badge-red { background: var(--accent-red-light); color: var(--accent-red); }
.badge-purple { background: var(--accent-purple-light); color: var(--accent-purple); }
.badge-gray { background: var(--accent-gray-light); color: var(--accent-gray); }
.badge-yellow { background: #fef9c3; color: #854d0e; }

/* ===========================
   ページネーション
   =========================== */
.pagination {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
}

.pagination-info {
  font-size: 12px;
  color: var(--text-secondary);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-family: inherit;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.page-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
  font-weight: 600;
}

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

/* ===========================
   ローディング・空状態
   =========================== */
.loading-row td {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

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

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ===========================
   ページ切り替えアニメーション
   =========================== */
.page-view {
  display: none;
}

.page-view.active {
  display: block;
}

/* ===========================
   アニメーション
   =========================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-view.active {
  animation: fadeIn 0.2s ease;
}

/* ===========================
   無効状態
   =========================== */
.nav-item.disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: default;
}

.detail-tab.disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: default;
}

/* ===========================
   スクロールバー
   =========================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f0f3f8;
}

::-webkit-scrollbar-thumb {
  background: #c0cce0;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a0b0cc;
}
