/* dMemo Admin — 管理画面専用CSS */

/* ── Admin ナビゲーション ── */
.admin-nav { background: #1e1b4b; color: #e0e7ff; position: sticky; top: 0; z-index: 100; }
.admin-nav-inner { max-width: 1200px; margin: 0 auto; padding: 0 1rem; display: flex; align-items: center; justify-content: space-between; height: 56px; }
.admin-nav-brand { font-weight: 700; font-size: 1rem; color: #a5b4fc; text-decoration: none; display: flex; align-items: center; gap: .5rem; }
.admin-nav-brand .badge-admin { font-size: .7rem; }
.admin-nav-links { display: flex; gap: 1.5rem; list-style: none; }
.admin-nav-links a { text-decoration: none; color: #c7d2fe; font-size: .9rem; transition: color .15s; }
.admin-nav-links a:hover,
.admin-nav-links a.active { color: #ffffff; }
.admin-nav-user { display: flex; align-items: center; gap: .75rem; font-size: .85rem; color: #a5b4fc; }

/* ── Admin メインレイアウト ── */
.admin-main { max-width: 1200px; margin: 0 auto; padding: 1.5rem 1rem; }

/* ── KPI統計グリッド ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: #ffffff; border: 1px solid var(--color-border, #e2e8f0); border-radius: 8px; padding: 1.25rem 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.stat-label { font-size: .8rem; font-weight: 500; color: var(--color-text-muted, #64748b); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .4rem; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--color-text, #1e293b); line-height: 1; }
.stat-sub { font-size: .8rem; color: var(--color-text-muted, #64748b); margin-top: .3rem; }

/* ── 検索フォーム ── */
.search-form { background: #ffffff; border: 1px solid var(--color-border, #e2e8f0); border-radius: 8px; padding: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,.1); margin-bottom: 1.5rem; }
.search-form-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.search-form-group { display: flex; flex-direction: column; gap: .3rem; }
.search-form-group label { font-size: .8rem; font-weight: 500; color: var(--color-text-muted, #64748b); }
.search-form-group input,
.search-form-group select { padding: .4rem .65rem; border: 1px solid var(--color-border, #e2e8f0); border-radius: 6px; font-size: .9rem; color: var(--color-text, #1e293b); background: #f8fafc; transition: border-color .15s; }
.search-form-group input:focus,
.search-form-group select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.search-checkbox-group { display: flex; align-items: center; gap: .4rem; padding-bottom: .2rem; }
.search-checkbox-group label { font-size: .9rem; color: var(--color-text, #1e293b); cursor: pointer; }

/* ── 残業行ハイライト ── */
tr.overtime-row td { background: #fffbeb; }

/* ── テーブルコンテンツ折り返し ── */
.content-cell { max-width: 300px; white-space: pre-wrap; word-break: break-word; font-size: .85rem; }

/* ── 結果カウント ── */
.result-count { font-size: .85rem; color: var(--color-text-muted, #64748b); margin-bottom: .75rem; }

/* ── エクスポートセクション ── */
.export-section { background: #ffffff; border: 1px solid var(--color-border, #e2e8f0); border-radius: 8px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,.1); margin-bottom: 1rem; }
.export-section h3 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; color: var(--color-text, #1e293b); }
.export-info { font-size: .85rem; color: var(--color-text-muted, #64748b); margin-top: .75rem; }
.export-info ul { margin-top: .4rem; padding-left: 1.2rem; }

/* ── ページタイトル ── */
.page-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 1.25rem; color: var(--color-text, #1e293b); display: flex; align-items: center; gap: .5rem; }
.page-title-sub { font-size: .85rem; font-weight: 400; color: var(--color-text-muted, #64748b); }

/* ── Admin ログイン画面 ── */
.admin-login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: #f0f4ff; }
.admin-login-card { width: 100%; max-width: 400px; background: #ffffff; border: 1px solid #c7d2fe; border-radius: 12px; box-shadow: 0 4px 16px rgba(99,102,241,.15); padding: 2.5rem 2rem; text-align: center; }
.admin-login-logo { margin-bottom: 1.5rem; }
.admin-login-logo h1 { font-size: 1.5rem; font-weight: 700; color: #1e1b4b; }
.admin-login-logo p { font-size: .85rem; color: #64748b; margin-top: .3rem; }
.btn-google { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; background: #ffffff; color: #374151; border: 1px solid #d1d5db; padding: .65rem 1.5rem; border-radius: 8px; font-size: .95rem; font-weight: 500; cursor: pointer; width: 100%; transition: background .15s, box-shadow .15s; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.btn-google:hover { background: #f9fafb; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.btn-google svg { flex-shrink: 0; }
.admin-login-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; padding: .65rem 1rem; border-radius: 6px; font-size: .85rem; margin-bottom: 1rem; display: none; }
.admin-login-error.visible { display: block; }
.admin-login-note { font-size: .78rem; color: #64748b; margin-top: 1rem; }

/* ── レスポンシブ ── */
@media (max-width: 768px) {
  .admin-nav-links { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .search-form-row { flex-direction: column; }
  .search-form-group { width: 100%; }
  .search-form-group input,
  .search-form-group select { width: 100%; }
  .content-cell { max-width: 180px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ── 部署別ドリルダウン ── */
.dept-hint { font-size: .75rem; font-weight: 400; color: #94a3b8; margin-left: .5rem; }
.dept-toggle-icon { color: #94a3b8; font-size: .75rem; width: 20px; text-align: center; user-select: none; }
.dept-row:hover td { background: #f1f5f9; }
.dept-detail-row td { padding: 0; background: #f8fafc; border-top: none; }
.dept-detail-wrap { padding: .75rem 1rem; border-left: 3px solid #6366f1; }
.dept-detail-loading { color: #94a3b8; font-size: .85rem; }
.dept-detail-error { color: #dc2626; font-size: .85rem; }
.dept-detail-inner { display: flex; flex-direction: column; gap: 1rem; }
.dept-detail-section { width: 100%; }
.dept-detail-section-title { font-size: .8rem; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: .04em; margin-bottom: .5rem; }
.dept-detail-empty { color: #94a3b8; font-size: .85rem; }
.dept-inner-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.dept-inner-table th { background: #f1f5f9; padding: .3rem .6rem; text-align: left; font-weight: 600; color: #475569; font-size: .78rem; }
.dept-inner-table td { padding: .35rem .6rem; border-bottom: 1px solid #e2e8f0; }
.dept-pain-list { margin: 0; padding: 0; list-style: none; font-size: .85rem; display: flex; flex-direction: column; gap: .35rem; }
.dept-pain-list li { line-height: 1.5; word-break: break-word; }
.pain-label { font-weight: 600; color: #d97706; }

/* ── NotebookLM ボタン ── */
.btn-notebooklm { background: #f0fdf4; color: #15803d; border: 1.5px solid #86efac; border-radius: 8px; padding: .45rem .9rem; font-size: .85rem; font-weight: 600; text-decoration: none; transition: background .15s; cursor: not-allowed; opacity: .85; }
.btn-notebooklm:hover { background: #dcfce7; }

/* ── 部署別ドリルダウン（UXガイドライン準拠版） ── */
.dept-hint { font-size: .75rem; font-weight: 400; color: #94a3b8; margin-left: .5rem; }

/* トグルセル */
.dept-toggle-cell { width: 36px; text-align: center; }
.dept-toggle-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 4px;
  background: #e0e7ff; color: #4f46e5;
  font-size: .75rem; font-weight: 700;
  transition: background .15s, transform .2s;
  pointer-events: none;
}
.dept-row { cursor: pointer; transition: background .1s; }
.dept-row:hover td { background: #f1f5f9; }
.dept-row:hover .dept-toggle-icon { background: #c7d2fe; }
.dept-row-open .dept-toggle-icon { background: #4f46e5; color: #fff; transform: rotate(90deg); }
.dept-name-cell { font-weight: 500; }

/* 詳細エリア */
.dept-detail-row td { padding: 0; border-top: none; }
.dept-detail-wrap { padding: .75rem 1rem .75rem 2.5rem; border-left: 3px solid #6366f1; background: #f8fafc; }
.dept-detail-inner { display: flex; flex-direction: column; gap: 1rem; }
.dept-detail-section { width: 100%; }
.dept-detail-section-title { font-size: .78rem; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: .06em; margin-bottom: .5rem; }
.dept-detail-empty { color: #94a3b8; font-size: .85rem; }
.dept-detail-error { color: #dc2626; font-size: .85rem; }
.dept-inner-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.dept-inner-table th { background: #f1f5f9; padding: .3rem .6rem; text-align: left; font-weight: 600; color: #475569; font-size: .78rem; }
.dept-inner-table td { padding: .35rem .6rem; border-bottom: 1px solid #e2e8f0; }
.dept-pain-list { margin: 0; padding: 0; list-style: none; font-size: .85rem; display: flex; flex-direction: column; gap: .35rem; }
.dept-pain-list li { line-height: 1.5; word-break: break-word; }
.pain-label { font-weight: 600; color: #d97706; }

/* ── スケルトン（UXガイドライン: ドハティの閾値対応） ── */
@keyframes skeleton-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.dept-skeleton { padding: .25rem 0; }
.skeleton-title {
  height: 12px; width: 120px; border-radius: 4px; margin-bottom: .6rem;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.4s infinite linear;
}
.skeleton-table { display: flex; flex-direction: column; gap: .4rem; }
.skeleton-row { display: flex; gap: .5rem; }
.skeleton-cell {
  height: 10px; border-radius: 3px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.4s infinite linear;
}
.skeleton-cell.w10 { width: 10%; }
.skeleton-cell.w15 { width: 15%; }
.skeleton-cell.w20 { width: 20%; }
.skeleton-cell.w40 { width: 40%; }
.skeleton-cell.w60 { width: 60%; }
.skeleton-cell.w70 { width: 70%; }
.skeleton-cell.w80 { width: 80%; }

/* ── NotebookLM ボタン（ツールチップ付き） ── */
.btn-notebooklm {
  position: relative;
  background: #f0fdf4; color: #15803d;
  border: 1.5px solid #86efac; border-radius: 8px;
  padding: .45rem .9rem; font-size: .85rem; font-weight: 600;
  text-decoration: none; transition: background .15s;
  cursor: not-allowed; opacity: .85;
}
.btn-notebooklm:hover { background: #dcfce7; }
.btn-notebooklm::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff; font-size: .75rem; font-weight: 400;
  padding: .3rem .6rem; border-radius: 4px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.btn-notebooklm:hover::after { opacity: 1; }

/* ── ユーザー管理画面 ── */
.add-user-form { }
.add-form-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.add-form-note { font-size: .78rem; color: #94a3b8; margin-top: .6rem; }
.required-mark { color: #dc2626; }

.user-inactive-row td { opacity: .5; }

/* ロールバッジ */
.badge-role-sysadmin { background: #ede9fe; color: #6d28d9; border: 1px solid #c4b5fd; padding: .15rem .5rem; border-radius: 4px; font-size: .78rem; font-weight: 600; }
.badge-role-executive { background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; padding: .15rem .5rem; border-radius: 4px; font-size: .78rem; font-weight: 600; }

/* 状態バッジ */
.status-badge { font-size: .85rem; }
.status-active { color: #16a34a; }
.status-inactive { color: #94a3b8; }

/* 危険ボタン */
.btn-danger { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; border-radius: 6px; padding: .3rem .65rem; font-size: .82rem; cursor: pointer; transition: background .15s; }
.btn-danger:hover { background: #fee2e2; }

/* フラッシュメッセージ（UX: フィードバック） */
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; font-weight: 500; }
.flash-success { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; }
.flash-error   { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }

/* ── 今月の残業業務一覧 ── */
.overtime-reasons-list { display: flex; flex-direction: column; gap: 1rem; }
.ot-dept-group { border-left: 3px solid #d97706; padding-left: .75rem; }
.ot-dept-label { font-size: .8rem; font-weight: 700; color: #b45309; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem; }
.ot-entry { margin-bottom: .6rem; }
.ot-meta { font-size: .78rem; color: #94a3b8; margin-bottom: .2rem; }
.ot-content { font-size: .95rem; font-weight: 600; color: #1e293b; margin-bottom: .2rem; }
.ot-hours { font-size: .82rem; font-weight: 400; color: #64748b; margin-left: .4rem; }
.ot-sub { font-size: .85rem; color: #475569; margin-left: .75rem; line-height: 1.5; }
.ot-label-issue { font-weight: 600; color: #d97706; }
.ot-label-request { font-weight: 600; color: #2563eb; }

/* ── 残業アラートバッジ（部署行・展開前） ── */
.dept-alert-cell { white-space: nowrap; }
.dept-alert-badge {
  display: inline-flex; align-items: center; gap: .25rem;
  font-size: .78rem; font-weight: 700; padding: .15rem .5rem;
  border-radius: 9999px; margin-right: .25rem;
}
.dept-alert-red    { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.dept-alert-yellow { background: #fef9c3; color: #92400e; border: 1px solid #fde68a; }
.dept-alert-none   { color: #cbd5e1; font-size: .82rem; }

/* ── 個人アラート（展開後・ユーザー行） ── */
tr.user-alert-red    { background: #fff5f5 !important; }
tr.user-alert-yellow { background: #fffbeb !important; }

.user-alert-badge {
  display: inline-block; font-size: .72rem; font-weight: 700;
  padding: .1rem .45rem; border-radius: 9999px; margin-right: .2rem;
  white-space: nowrap;
}
.user-alert-badge-red    { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.user-alert-badge-yellow { background: #fef9c3; color: #92400e; border: 1px solid #fde68a; }
.user-alert-badge-weekly { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ── 残業時間セル ── */
.ot-hours-cell { font-size: .85rem; color: #475569; text-align: right; }

/* 部署行 — 週次アラートバッジ */
.dept-alert-weekly { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ── 残業アラート 7段階スタイル（法令準拠） ── */

/* 部署行バッジ */
.dept-alert-l1 { background: #fef9c3; color: #713f12; border: 1px solid #fde047; }           /* 注意      >40h */
.dept-alert-l2 { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }           /* 36協定超過 >45h */
.dept-alert-l3 { background: #fed7aa; color: #7c2d12; border: 1px solid #fb923c; }           /* 要エスカレ >55h */
.dept-alert-l4 { background: #fecaca; color: #7f1d1d; border: 1px solid #f87171; font-weight:700; } /* 産業医報告 >65h */
.dept-alert-l5 { background: #dc2626; color: #fff;    border: 1px solid #b91c1c; font-weight:700; } /* 過労死直前 >75h */
.dept-alert-l6 { background: #991b1b; color: #fff;    border: 1px solid #7f1d1d; font-weight:800; } /* 緊急     >=80h */
.dept-alert-l7 { background: #18181b; color: #fff;    border: 1px solid #000;   font-weight:800; letter-spacing:.03em; } /* 通報 >=100h */

/* 個人行バッジ */
.user-alert-l1-badge { background: #fef9c3; color: #713f12; border: 1px solid #fde047; }
.user-alert-l2-badge { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.user-alert-l3-badge { background: #fed7aa; color: #7c2d12; border: 1px solid #fb923c; }
.user-alert-l4-badge { background: #fecaca; color: #7f1d1d; border: 1px solid #f87171; font-weight:700; }
.user-alert-l5-badge { background: #dc2626; color: #fff;    border: 1px solid #b91c1c; font-weight:700; }
.user-alert-l6-badge { background: #991b1b; color: #fff;    border: 1px solid #7f1d1d; font-weight:800; }
.user-alert-l7-badge { background: #18181b; color: #fff;    border: 1px solid #000;   font-weight:800; }
.user-alert-weekly-badge { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* 個人行 背景ハイライト */
tr.user-alert-l1 { background: #fefce8 !important; }
tr.user-alert-l2 { background: #fff5f5 !important; }
tr.user-alert-l3 { background: #fff7ed !important; }
tr.user-alert-l4 { background: #fef2f2 !important; }
tr.user-alert-l5 { background: #fee2e2 !important; }
tr.user-alert-l6 { background: #fecaca !important; }
tr.user-alert-l7 { background: #fca5a5 !important; border-left: 3px solid #18181b; }
