/**
 * 共通スタイル - 現場フォトクラウド
 * Pattern 06 "Refined Minimal" ベース
 */

/* ===== Google Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ===== リセット ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ===== CSS変数 ===== */
:root {
  /* Pattern 06 カラー */
  --bg: #f8f9fc;
  --surface: #ffffff;
  --surface-dim: #f1f3f8;
  --surface-hover: #f5f7fb;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #dbeafe;
  --accent-softer: #eff6ff;
  --accent-glow: rgba(37, 99, 235, 0.08);
  --success: #059669;
  --success-soft: #d1fae5;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-accent: #2563eb;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07);
  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
  --header-height: 52px;
  --statusbar-height: 32px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  /* 後方互換エイリアス（既存ページのインラインスタイル用） */
  --primary-color: #2563eb;
  --secondary-color: #2563eb;
  --success-color: #059669;
  --danger-color: #dc2626;
  --warning-color: #d97706;
  --info-color: #0284c7;
  --light-bg: #f8f9fc;
  --dark-text: #0f172a;
  --muted-text: #94a3b8;
  --border-color: #e2e8f0;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  --hover-shadow: 0 4px 12px rgba(15, 23, 42, 0.07);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: #e2e8f0;
  --glass-blur: blur(16px);
  --glass-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

/* ===== FOUC防止: サイドバー折りたたみ状態を即座に反映 ===== */
html.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed);
  transition: none !important;
}
/* layout.js構築完了後にトランジションを有効化 */
html.layout-ready .sidebar {
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Body ===== */
body {
  font-family: 'Plus Jakarta Sans', 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100vh;
  line-height: 1.6;
  font-size: 14px;
}

/* 微細なグリッドテクスチャ（建設図面のニュアンス） */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.018) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* ===== アプリレイアウト ===== */
.app-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* ===== ヘッダー ===== */
.header {
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 50;
  flex-shrink: 0;
  position: relative;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.sidebar-toggle {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
  font-size: 18px;
}
.sidebar-toggle:hover {
  background: var(--surface-dim);
  color: var(--text-primary);
}
.sidebar-toggle svg {
  width: 18px;
  height: 18px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
  color: inherit;
}
.header-logo-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.header-logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.header-logo-mark {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}
.header-logo-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.header-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}

.header-right,
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition);
  position: relative;
  font-size: 16px;
}
.header-btn:hover {
  background: var(--surface-dim);
  color: var(--text-primary);
}
.header-btn .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

/* ヘッダーユーザー */
.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 20px;
  cursor: pointer;
  transition: background var(--transition);
  border: 1px solid transparent;
}
.header-user:hover {
  background: var(--surface-dim);
  border-color: var(--border);
}
.header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
}
.header-username {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* パンくず */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  min-width: 0;
}
.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
  white-space: nowrap;
}
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { font-size: 11px; opacity: 0.5; }
.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 600;
  white-space: nowrap;
}

/* 旧式パンくずバー（後方互換） */
.breadcrumb-bar {
  background: var(--surface);
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}
.breadcrumb-bar a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s;
}
.breadcrumb-bar a:hover {
  opacity: 0.7;
}
.breadcrumb-separator {
  color: var(--text-muted);
  font-size: 11px;
}

/* ===== サイドバー ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  z-index: 40;
}
.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.sidebar-nav {
  padding: 12px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 16px 12px 6px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition);
}
.collapsed .sidebar-section-label {
  opacity: 0;
  padding: 8px 0;
  height: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.nav-item:hover {
  background: var(--surface-dim);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--accent-softer);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}
.nav-icon svg {
  width: 18px;
  height: 18px;
}

.nav-label {
  opacity: 1;
  transition: opacity 0.15s ease;
  overflow: hidden;
}
.collapsed .nav-label {
  opacity: 0;
  width: 0;
}
.collapsed .nav-item {
  justify-content: center;
  padding: 9px;
}
.collapsed .nav-item.active::before {
  display: none;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 1.5;
  transition: opacity 0.15s ease;
}
.collapsed .nav-badge { opacity: 0; width: 0; overflow: hidden; padding: 0; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-light);
}
.sidebar-storage {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-dim);
  transition: opacity var(--transition);
}
.collapsed .sidebar-storage { opacity: 0; height: 0; padding: 0; overflow: hidden; }
.sidebar-storage-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.sidebar-storage-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}
.sidebar-storage-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.8s ease;
}
.sidebar-storage-text {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* モバイルサイドバーオーバーレイ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
  z-index: 39;
}
.sidebar-overlay.active {
  display: block;
}

/* ===== メインコンテンツ ===== */
.main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 32px 40px;
  scroll-behavior: smooth;
}
.main-inner,
.content-inner {
  max-width: 1120px;
  margin: 0 auto;
}

/* 旧レイアウト後方互換（.containerをメインコンテンツに使うページ） */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== ページヘッダー ===== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
}
.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 400;
}
.page-actions {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

/* ===== ステータスバー ===== */
.statusbar {
  height: var(--statusbar-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
  z-index: 50;
}
.statusbar-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.statusbar-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.15);
}
.statusbar-divider {
  width: 1px;
  height: 14px;
  background: var(--border);
}
.statusbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ===== ボタン ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  text-decoration: none;
  min-height: 36px;
  line-height: 1.4;
}
.btn:hover { opacity: 0.9; }
.btn:active { opacity: 0.8; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25);
  text-decoration: none;
  min-height: 36px;
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  text-decoration: none;
  min-height: 36px;
}
.btn-secondary:hover {
  background: var(--surface-dim);
  color: var(--text-primary);
  border-color: #d1d5db;
}

.btn-success {
  background: var(--success);
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-success:hover { background: #047857; }

.btn-danger {
  background: var(--danger);
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-danger:hover { background: #b91c1c; }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-outline:hover {
  background: var(--surface-dim);
  color: var(--text-primary);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  min-height: 30px;
}
.btn-lg {
  padding: 10px 24px;
  font-size: 15px;
  min-height: 44px;
}

/* ===== カード ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
  padding: 20px;
  margin-bottom: 16px;
}
.card:hover { border-color: #d1d5db; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  margin-bottom: 0;
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}
.card-action {
  font-size: 12px;
  color: var(--text-accent);
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  font-family: inherit;
}
.card-action:hover { background: var(--accent-softer); }

.card-body { padding: 0 20px 20px; color: var(--text-primary); }

/* ===== 統計カード ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  cursor: default;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}
.stat-card:hover {
  border-color: var(--accent-soft);
  box-shadow: var(--shadow-md);
}
.stat-card:hover::after { opacity: 1; }

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}
.stat-icon.blue { background: var(--accent-softer); }
.stat-icon.green { background: #ecfdf5; }
.stat-icon.amber { background: #fffbeb; }
.stat-icon.purple { background: #f5f3ff; }

.stat-trend {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
}
.stat-trend.up { color: var(--success); background: var(--success-soft); }
.stat-trend.down { color: var(--danger); background: var(--danger-soft); }

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 4px;
  font-feature-settings: 'tnum';
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ===== グリッドレイアウト ===== */
.grid {
  display: grid;
  gap: 16px;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ===== フォーム ===== */
.form-group {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
}
.form-label.required::after {
  content: ' *';
  color: var(--danger);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="date"],
select,
textarea,
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  outline: none;
  min-height: 38px;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus,
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.form-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 4px;
}

/* ===== テーブル ===== */
.table,
.data-table,
.activity-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.table thead,
.data-table thead,
.activity-table thead {
  background: var(--surface-dim);
}
.table thead th,
.data-table thead th,
.activity-table thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--surface-dim);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table thead th:first-child,
.data-table thead th:first-child,
.activity-table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.table thead th:last-child,
.data-table thead th:last-child,
.activity-table thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }

.table tbody tr,
.data-table tbody tr,
.activity-table tbody tr {
  transition: background var(--transition);
}
.table tbody tr:hover,
.data-table tbody tr:hover,
.activity-table tbody tr:hover {
  background: var(--accent-glow);
}
.table th,
.table td,
.data-table tbody td,
.activity-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: middle;
}
.table tbody tr:last-child td,
.data-table tbody tr:last-child td,
.activity-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table-wrap,
.activity-table-wrap {
  overflow-x: auto;
}

/* ===== バッジ ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.badge-primary { background: var(--accent-softer); color: var(--accent); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--accent-softer); color: var(--accent); }

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-pill.blue { background: var(--accent-softer); color: var(--accent); }
.badge-pill.green { background: var(--success-soft); color: var(--success); }
.badge-pill.amber { background: var(--warning-soft); color: var(--warning); }
.badge-pill.red { background: var(--danger-soft); color: var(--danger); }
.badge-pill.purple { background: #f5f3ff; color: #7c3aed; }
.badge-pill.gray { background: var(--surface-dim); color: var(--text-secondary); }

/* ===== アラート ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.alert-success { background: var(--success-soft); border: 1px solid #a7f3d0; color: #065f46; }
.alert-danger { background: var(--danger-soft); border: 1px solid #fecaca; color: #991b1b; }
.alert-warning { background: var(--warning-soft); border: 1px solid #fde68a; color: #92400e; }
.alert-info { background: var(--accent-softer); border: 1px solid var(--accent-soft); color: #1e40af; }

/* ===== モーダル ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}
.modal-overlay.active,
.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.15);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.active .modal,
.modal-overlay.show .modal {
  transform: translateY(0) scale(1);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
  font-size: 18px;
}
.modal-close:hover {
  background: var(--surface-dim);
  color: var(--text-primary);
}
.modal-body {
  padding: 20px 24px;
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 24px 20px;
}

/* ===== トースト通知 ===== */
.toast {
  position: fixed;
  bottom: 48px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  z-index: 300;
  transform: translateY(12px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--accent); }
.toast-close {
  margin-left: 8px;
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition);
  font-size: 14px;
  flex-shrink: 0;
}
.toast-close:hover {
  background: var(--surface-dim);
  color: var(--text-primary);
}

/* ===== 空の状態表示 ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state-icon {
  font-size: 40px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-state-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.empty-state-text,
.empty-state-description {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ===== タブナビゲーション ===== */
.tab-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab-nav-item {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
  margin-bottom: -1px;
}
.tab-nav-item:hover { color: var(--text-primary); }
.tab-nav-item.active {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* ===== 検索ボックス ===== */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-box input {
  padding-left: 40px;
  padding-right: 12px;
}

/* ===== ドロップダウン ===== */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 4px;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all var(--transition);
}
.dropdown.open .dropdown-menu,
.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  font-family: inherit;
  white-space: nowrap;
}
.dropdown-item:hover {
  background: var(--surface-dim);
  color: var(--text-primary);
}
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-soft); }
.dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 0;
}

/* ===== ユーザーメニュー（後方互換） ===== */
.user-menu { position: relative; }
.user-menu-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 4px 10px 4px 4px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  min-height: 34px;
  transition: all var(--transition);
  font-family: inherit;
}
.user-menu-toggle:hover {
  background: var(--surface-dim);
  border-color: var(--border);
}
.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 180px;
  box-shadow: var(--shadow-md);
  display: none;
  z-index: 200;
  padding: 4px;
}
.user-menu-dropdown.open { display: block; }
.user-menu-dropdown a,
.user-menu-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
  font-family: inherit;
  border-radius: var(--radius-sm);
}
.user-menu-dropdown a:hover,
.user-menu-dropdown button:hover {
  background: var(--surface-dim);
  color: var(--text-primary);
}
.user-menu-dropdown .menu-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 0;
}

/* 管理ダッシュボードリンク */
.admin-menu-link {
  display: none;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  min-height: 34px;
  text-decoration: none;
  transition: all var(--transition);
}
.admin-menu-link:hover {
  background: var(--surface-dim);
  color: var(--text-primary);
}

/* ===== プロジェクトカード ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  text-decoration: none;
  color: inherit;
  display: block;
}
.project-card:hover {
  border-color: var(--accent-soft);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}
.project-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
}
.project-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
  white-space: nowrap;
}
.project-status.active { background: var(--accent-softer); color: var(--accent); }
.project-status.preparing { background: var(--warning-soft); color: var(--warning); }
.project-status.completed { background: var(--success-soft); color: var(--success); }

.project-location {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.project-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.project-stats span {
  display: flex;
  align-items: center;
  gap: 4px;
}
.project-progress { margin-top: 14px; }
.project-progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.project-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
}
.project-progress-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}

/* ===== アバター ===== */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-soft), var(--accent));
}
.avatar-xs { width: 20px; height: 20px; font-size: 9px; }
.avatar-sm { width: 26px; height: 26px; font-size: 11px; }
.avatar-md { width: 32px; height: 32px; font-size: 13px; }
.avatar-lg { width: 40px; height: 40px; font-size: 16px; }
.avatar-xl { width: 56px; height: 56px; font-size: 20px; }

/* ===== ローディング ===== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}
.spinner {
  border: 3px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== ページネーション ===== */
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.pagination-controls label {
  color: var(--text-muted);
}
.pagination-controls select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
}
.pagination-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  font-size: 13px;
}
.pagination-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  transition: all var(--transition);
}
.pagination-btn:hover:not([disabled]) {
  background: var(--accent-glow);
  border-color: var(--accent);
}
.pagination-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.pagination-btn[disabled] {
  opacity: 0.4;
  cursor: default;
}
.pagination-ellipsis {
  color: var(--text-muted);
}

/* ===== フッター ===== */
.app-footer {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: auto;
  background: var(--surface);
}
.app-footer a {
  color: var(--accent);
  text-decoration: none;
}
.app-footer a:hover {
  text-decoration: underline;
}

/* ===== 認証ページ用レイアウト ===== */
body.auth-page {
  overflow: auto;
  height: auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
body.auth-page::before {
  /* グリッドテクスチャを認証ページでも使用 */
}

.auth-hero {
  text-align: center;
  margin-bottom: 32px;
  max-width: 400px;
  width: 100%;
}
.auth-hero-icon {
  margin-bottom: 0;
}
.auth-hero-icon img {
  width: 240px;
  height: 240px;
  object-fit: contain;
}
.auth-hero-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.auth-hero-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.auth-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.auth-feature {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface);
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* 認証カード */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 400px;
  overflow: hidden;
}
.auth-card.wide {
  max-width: 440px;
}
.auth-card-header {
  padding: 24px 32px 0;
  text-align: center;
}
.auth-card-header h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.auth-card-header .subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}
.auth-card-body {
  padding: 24px 32px;
}
.auth-card-footer {
  padding: 0 32px 24px;
  text-align: center;
}
.auth-card-footer a {
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
  font-weight: 500;
}
.auth-card-footer a:hover {
  text-decoration: underline;
}
.auth-divider {
  text-align: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.auth-divider span {
  color: var(--text-muted);
  font-size: 13px;
}
.auth-divider a {
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
  font-weight: 600;
  margin-left: 4px;
}

/* 認証メッセージ */
.auth-message {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  display: none;
  line-height: 1.5;
}
.auth-message.show { display: block; }
.auth-message.success { background: var(--success-soft); color: #065f46; }
.auth-message.error { background: var(--danger-soft); color: #991b1b; }

/* 認証フォームボタン */
.auth-btn {
  width: 100%;
  padding: 10px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: all var(--transition);
  font-family: inherit;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25);
}
.auth-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== ユーティリティ ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.hidden { display: none !important; }

body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

.hide-mobile { /* モバイルで非表示: レスポンシブセクションで制御 */ }

/* ===== アニメーション ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in {
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.1s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.2s; }
.delay-5 { animation-delay: 0.25s; }
.delay-6 { animation-delay: 0.3s; }

/* ===== スクロールバー ===== */
.main::-webkit-scrollbar { width: 6px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
.main::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ===== モバイルボトムナビゲーション ===== */
.bottom-nav {
  display: none;
}

/* ===== レスポンシブ ===== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 20px 24px 32px; }
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  /* サイドバーをモバイルではオーバーレイモードに */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar.collapsed {
    width: var(--sidebar-width);
    transform: translateX(-100%);
  }
  .sidebar.collapsed.mobile-open {
    transform: translateX(0);
  }

  .breadcrumb { display: none; }
  .header-divider { display: none; }
  .main { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }
  .projects-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; gap: 12px; }
  .header-username { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  /* ページアクション・ブレッドクラムの折り返し */
  .page-actions { flex-wrap: wrap; gap: 8px; }
  .breadcrumb-bar { padding: 8px 12px; flex-wrap: wrap; }

  .hide-mobile { display: none !important; }

  /* ヘッダーコンパクト化 */
  .header { padding: 0 12px; }

  /* 管理ダッシュボードリンクはモバイルで非表示 */
  .admin-menu-link { display: none !important; }

  /* ボトムナビ */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(15, 23, 42, 0.06);
    justify-content: space-around;
    align-items: stretch;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 8px 4px 6px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
  }
  .bottom-nav-item:active { background: var(--accent-glow); }
  .bottom-nav-item.active { color: var(--accent); }
  .bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 2px;
    background: var(--accent);
    border-radius: 0 0 2px 2px;
  }
  .bottom-nav-icon {
    font-size: 20px;
    line-height: 1;
    margin-bottom: 2px;
  }
  .bottom-nav-label { white-space: nowrap; }

  body.has-bottom-nav { padding-bottom: 64px; }
  body.has-bottom-nav .app-footer { padding-bottom: 8px; }

  /* 「その他」ポップアップメニュー */
  .bottom-nav-more-menu {
    position: fixed;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    right: 8px;
    z-index: 201;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 4px;
    min-width: 160px;
  }
  .bottom-nav-more-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition);
    border-radius: var(--radius-sm);
  }
  .bottom-nav-more-item:active { background: var(--accent-glow); }
  .bottom-nav-more-item.active { color: var(--accent); }
  .bottom-nav-more-logout {
    color: var(--danger);
    border-top: 1px solid var(--border);
    margin-top: 4px;
    padding-top: 10px;
  }
  .bottom-nav-more-icon {
    font-size: 16px;
    width: 24px;
    text-align: center;
  }

  /* 認証ページモバイル */
  body.auth-page { padding: 16px; }
  .auth-card-body { padding: 20px 20px; }
  .auth-card-header { padding: 20px 20px 0; }
  .auth-card-footer { padding: 0 20px 20px; }
  .auth-hero-title { font-size: 20px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 20px; }
  .stat-icon { width: 30px; height: 30px; font-size: 14px; }

  .container { padding: 12px; }
  .card { padding: 12px; margin-bottom: 12px; }

  /* モーダルモバイル */
  .modal { width: 98%; border-radius: var(--radius); }
  .modal-header { padding: 16px 16px 0; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 0 16px 16px; }
  .modal-title { font-size: 15px; }

  .app-footer { padding: 16px 12px; }

  .pagination-bar { flex-wrap: wrap; gap: 4px; }
  .pagination-btn { padding: 6px 10px; font-size: 12px; }

  /* 認証ページ */
  .auth-card-body { padding: 20px 16px; }
  .auth-card-header { padding: 16px 16px 0; }
  .auth-card-footer { padding: 0 16px 16px; }
}

/* ===== コンテキスト切替 ===== */
.context-switcher {
  padding: 8px 12px;
  margin-bottom: 4px;
  position: relative;
}
.context-switcher-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
}
.context-switcher-toggle:hover {
  background: var(--surface-hover);
}
.ctx-icon { font-size: 14px; flex-shrink: 0; }
.ctx-label {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ctx-arrow {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.context-switcher-dropdown {
  display: none;
  position: absolute;
  left: 12px;
  right: 12px;
  top: calc(100% - 2px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
}
.context-switcher-dropdown.open { display: block; }
.ctx-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition);
}
.ctx-option:hover { background: var(--surface-dim); }
.ctx-option.active {
  background: var(--accent-softer);
  color: var(--accent);
  font-weight: 600;
}
.ctx-opt-icon { font-size: 13px; flex-shrink: 0; }
