:root {
  --sidebar-bg: #0d0f1e;
  --sidebar-text: #7a85a3;
  --sidebar-active-bg: rgba(108, 92, 231, 0.18);
  --sidebar-active-text: #a29bfe;
  --header-bg: #12152a;
  --main-bg: #f0f2f7;
  --card-bg: #ffffff;
  --accent: #6c5ce7;
  --accent2: #00cec9;
  --accent3: #fd79a8;
  --text: #2d3436;
  --text-light: #636e72;
  --border: #e2e8f0;
  --done: #00b894;
  --shadow: 0 2px 8px rgba(0,0,0,0.07);
  --radius: 12px;
}

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

body {
  font-family: -apple-system, 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Meiryo', sans-serif;
  background: var(--main-bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Header ── */
.header {
  background: var(--header-bg);
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.header-left { display: flex; align-items: center; gap: 0.75rem; }
.logo {
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  color: white;
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 6px;
}
.header-title { color: #dfe6e9; font-size: 0.95rem; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 1rem; }
.live-indicator { display: flex; align-items: center; gap: 5px; font-size: 0.7rem; color: var(--accent2); font-weight: 600; letter-spacing: 0.06em; }
.live-dot { width: 7px; height: 7px; background: var(--accent2); border-radius: 50%; animation: blink 2s ease infinite; }
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0.3;} }
.clock { font-size: 0.82rem; color: #7a85a3; font-variant-numeric: tabular-nums; }
.days-counter {
  display: flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, rgba(108,92,231,0.25), rgba(253,121,168,0.2));
  border: 1px solid rgba(108,92,231,0.4);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #a29bfe;
  white-space: nowrap;
  letter-spacing: 0.03em;
}
.update-toast {
  background: var(--accent);
  color: white;
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 20px;
  animation: fadeIn 0.3s;
}
@keyframes fadeIn { from{opacity:0;transform:translateY(-4px);} to{opacity:1;transform:translateY(0);} }

/* ── Layout ── */
.layout { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: 210px;
  background: var(--sidebar-bg);
  flex-shrink: 0;
  overflow-y: auto;
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #3d4465;
  font-weight: 700;
  padding: 0 0.5rem;
  margin-bottom: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 0.855rem;
  transition: all 0.15s ease;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #c4c9d4; }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); font-weight: 600; }
.nav-icon { font-size: 0.95rem; width: 18px; text-align: center; flex-shrink: 0; }

/* ── Main ── */
.main { flex: 1; overflow-y: auto; padding: 1.75rem 2rem; }

/* ── Page Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.35rem; font-weight: 700; color: var(--text); }
.page-header .meta { font-size: 0.78rem; color: var(--text-light); background: var(--border); padding: 4px 12px; border-radius: 20px; }

/* ── Cards ── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

/* ── Overview Grid ── */
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.dept-card { border-left: 3px solid var(--accent); }
.dept-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.dept-icon-name { display: flex; align-items: center; gap: 0.5rem; }
.dept-icon { font-size: 1.2rem; }
.dept-name { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.pct-badge {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
}
.pct-badge.complete { color: var(--done); }

.progress-track { height: 6px; background: #edf2f7; border-radius: 3px; overflow: hidden; margin-bottom: 0.5rem; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px;
  transition: width 0.6s ease;
}
.progress-fill.complete { background: linear-gradient(90deg, var(--done), var(--accent2)); }
.dept-footer { font-size: 0.72rem; color: var(--text-light); }
.dept-activity { font-size: 0.70rem; color: var(--text-light); margin: 2px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yesterday-badge { font-size: 0.65rem; background: #e6f4ea; color: #2d7a4f; border-radius: 4px; padding: 1px 5px; font-weight: 600; }

/* ── Phase Card ── */
.phase-card { background: linear-gradient(135deg, #0d0f1e, #1a1d3a); color: white; }
.phase-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(255,255,255,0.4); margin-bottom: 0.5rem; }
.phase-name { font-size: 1.2rem; font-weight: 700; color: white; margin-bottom: 1rem; }
.phase-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.phase-item {}
.phase-item-label { font-size: 0.68rem; color: rgba(255,255,255,0.45); margin-bottom: 2px; }
.phase-item-value { font-size: 0.9rem; font-weight: 600; color: rgba(255,255,255,0.9); }

/* ── Section Label ── */
.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

/* ── Roadmap ── */
.overall-track { height: 10px; background: #edf2f7; border-radius: 5px; overflow: hidden; margin-bottom: 1.5rem; }
.overall-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 5px;
  transition: width 0.6s;
}
.task-group { margin-bottom: 0.75rem; }
.task-group-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-light);
  padding: 0 0 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
.task-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.845rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.1s;
  padding-left: 0.25rem;
}
.task-row:hover { background: #f7f8fc; }
.task-row.done .task-text { color: var(--text-light); text-decoration: line-through; }
.task-check { flex-shrink: 0; font-size: 0.9rem; }
.task-text { line-height: 1.45; }

/* ── Markdown ── */
.md-body { font-size: 0.86rem; line-height: 1.75; }
.md-body h1 { font-size: 1.15rem; margin: 1.5rem 0 0.75rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--border); }
.md-body h2 { font-size: 1rem; margin: 1.25rem 0 0.6rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border); color: var(--accent); }
.md-body h3 { font-size: 0.92rem; margin: 1rem 0 0.4rem; }
.md-body h4 { font-size: 0.86rem; margin: 0.75rem 0 0.3rem; color: var(--text-light); }
.md-body p { margin-bottom: 0.65rem; color: var(--text-light); }
.md-body strong { color: var(--text); }
.md-body table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.8rem; }
.md-body th { background: #f7f8fc; padding: 0.45rem 0.75rem; text-align: left; font-weight: 600; border: 1px solid var(--border); font-size: 0.78rem; }
.md-body td { padding: 0.45rem 0.75rem; border: 1px solid var(--border); }
.md-body tr:hover td { background: #fafbff; }
.md-body code { background: #f0f0f7; padding: 0.1em 0.35em; border-radius: 3px; font-size: 0.82em; color: var(--accent); }
.md-body pre { background: #1a1d3a; color: #e2e8f0; padding: 1rem; border-radius: 8px; overflow-x: auto; margin: 0.75rem 0; }
.md-body ul, .md-body ol { padding-left: 1.4rem; margin-bottom: 0.6rem; }
.md-body li { margin-bottom: 0.2rem; }
.md-body blockquote { border-left: 3px solid var(--accent); padding-left: 1rem; color: var(--text-light); margin: 0.75rem 0; }

/* ── Files ── */
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.6rem; }
.file-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.78rem;
  transition: all 0.15s;
}
.file-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.file-card.active { border-color: var(--accent); background: rgba(108,92,231,0.04); }
.file-card-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.file-card-name { word-break: break-all; line-height: 1.35; color: var(--text); }
#file-viewer { margin-top: 1rem; }
#file-viewer .file-viewer-title {
  font-size: 0.78rem;
  color: var(--text-light);
  background: #f7f8fc;
  border-radius: 6px;
  padding: 6px 12px;
  margin-bottom: 1rem;
  font-family: monospace;
}

/* ── Misc ── */
.loading {
  display: flex; align-items: center; justify-content: center;
  height: 200px; color: var(--text-light); font-size: 0.875rem;
}
.stat-pill {
  display: inline-block;
  background: rgba(108,92,231,0.1);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}
.day-badge {
  font-size: 0.72rem;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.day-badge.threads { background: var(--accent); }
.day-badge.note { background: var(--accent2); }

/* ── Metrics ── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.9rem;
  margin-bottom: 0.5rem;
}
.metric-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
  border-top: 3px solid var(--border);
  transition: transform 0.15s, box-shadow 0.15s;
}
.metric-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.1); }
.metric-card.threads { border-top-color: var(--accent); }
.metric-card.note    { border-top-color: var(--accent2); }
.metric-card.er      { border-top-color: #fdcb6e; }
.metric-card.buzz    { border-top-color: var(--accent3); }
.metric-card.revenue { border-top-color: var(--done); }
.metric-label { font-size: 0.72rem; color: var(--text-light); font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.metric-value { font-size: 1.65rem; font-weight: 800; color: var(--text); line-height: 1.1; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.metric-sub   { font-size: 0.7rem; color: var(--text-light); }

/* ── Buttons ── */
.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.83rem;
  font-weight: 600;
  transition: opacity 0.15s;
}
.btn-primary:hover    { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ── */
.form-label { display: block; font-size: 0.72rem; font-weight: 600; color: var(--text-light); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.form-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 0.85rem;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s;
  font-family: inherit;
}
.form-input:focus { outline: none; border-color: var(--accent); }
.manual-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.75rem; }
.form-group {}

/* ── Badges ── */
.src-badge { font-size: 0.68rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.src-badge.api    { background: rgba(108,92,231,0.12); color: var(--accent); }
.src-badge.manual { background: rgba(0,206,201,0.12);  color: var(--accent2); }
.badge-ok { font-size: 0.8rem; color: var(--done); font-weight: 600; }
.badge-ng { font-size: 0.8rem; color: #e17055; font-weight: 600; }

/* ── Alerts ── */
.alert-ok    { background: rgba(0,184,148,0.1);  color: #00897b; border-left: 3px solid var(--done); padding: 10px 14px; border-radius: 8px; font-size: 0.83rem; margin-bottom: 1rem; }
.alert-error { background: rgba(225,112,85,0.1); color: #c0392b; border-left: 3px solid #e17055;     padding: 10px 14px; border-radius: 8px; font-size: 0.83rem; margin-bottom: 1rem; }

/* ── History Table ── */
.history-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; white-space: nowrap; }
.history-table th { background: #f7f8fc; padding: 0.4rem 0.65rem; text-align: left; font-weight: 600; border: 1px solid var(--border); font-size: 0.72rem; color: var(--text-light); }
.history-table td { padding: 0.4rem 0.65rem; border: 1px solid var(--border); color: var(--text); }
.history-table tr:hover td { background: #fafbff; }

/* ── CEO 確認待ちバナー ── */
.ceo-banner {
  display: flex; align-items: flex-start; gap: 10px;
  background: rgba(253,121,168,0.08); border-left: 4px solid #fd79a8;
  border-radius: 10px; padding: 12px 16px; margin-bottom: 1.25rem;
  font-size: 0.83rem; transition: background 0.2s;
}
.ceo-banner:hover { background: rgba(253,121,168,0.14); }
.ceo-banner-ok { background: rgba(0,184,148,0.07); border-left-color: var(--done); }
.ceo-banner-ok:hover { background: rgba(0,184,148,0.12); }
.ceo-banner-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.ceo-banner-text { flex: 1; line-height: 1.6; }
.ceo-banner-item { display: inline-block; margin-right: 4px; color: var(--text-light); font-size: 0.78rem; }
.ceo-banner-arrow { font-size: 0.78rem; color: var(--accent); font-weight: 600; white-space: nowrap; margin-top: 2px; }

/* ── CEO 案件カード ── */
.ceo-item-card {
  background: var(--card-bg); border-radius: 10px; padding: 14px 16px;
  margin-bottom: 10px; box-shadow: var(--shadow); border-left: 4px solid #fd79a8;
}
.ceo-item-card.ceo-inprogress { border-left-color: var(--accent); }
.ceo-item-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.ceo-item-num { font-weight: 700; font-size: 0.8rem; color: var(--text-light); }
.ceo-item-dept { font-size: 0.78rem; font-weight: 600; color: var(--accent); }
.ceo-item-status { font-size: 0.68rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.status-pending    { background: rgba(253,121,168,0.15); color: #e84393; }
.status-inprogress { background: rgba(108,92,231,0.15);  color: var(--accent); }
.ceo-item-deadline { font-size: 0.72rem; color: var(--text-light); margin-left: auto; }
.ceo-item-topic { font-size: 0.88rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.ceo-item-meta { font-size: 0.72rem; color: var(--text-light); }
.ceo-item-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.ceo-link-btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; font-weight: 600;
  color: var(--accent); background: rgba(108,92,231,0.08);
  border: 1px solid rgba(108,92,231,0.25); border-radius: 6px;
  padding: 3px 9px; text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.ceo-link-btn:hover { background: rgba(108,92,231,0.18); border-color: var(--accent); }

/* ── stat-pill 追加色 ── */
:root { --accent-light: rgba(108,92,231,0.1); --done-light: rgba(0,184,148,0.1); }
.stat-pill[style*="accent-light"] { color: var(--accent); }
.stat-pill[style*="done-light"]   { color: var(--done); }

/* ── CEO 回答フォーム ── */
.ceo-answer-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.ceo-answer-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s;
  background: #fafbff;
  color: var(--text);
}
.ceo-answer-input:focus {
  outline: none;
  border-color: var(--done);
  background: #fff;
}
.btn-answer {
  background: var(--done);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-answer:hover  { opacity: 0.85; }
.btn-answer:disabled { opacity: 0.5; cursor: default; }

/* ── 全部門統合カレンダー ── */
.cal-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.cal-nav-btn {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 5px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.cal-nav-btn:hover { background: #f0f2f7; border-color: var(--accent); }
.today-btn { color: var(--accent); border-color: var(--accent); }
.cal-week-label { font-size: 0.9rem; font-weight: 700; color: var(--text); flex: 1; text-align: center; }

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 1rem;
}
.cal-legend-item {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1.5px solid;
  display: flex;
  align-items: center;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .cal-grid { grid-template-columns: repeat(3, 1fr); }
}

.cal-col {
  background: var(--card-bg);
  border-radius: 10px;
  border: 1.5px solid var(--border);
  overflow: hidden;
  min-height: 120px;
}
.cal-col.cal-today {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.15);
}
.cal-col.cal-past { opacity: 0.6; }

.cal-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.cal-today .cal-col-header { background: rgba(108, 92, 231, 0.08); }
.cal-day-name { font-size: 0.7rem; font-weight: 700; color: var(--text-light); text-transform: uppercase; }
.cal-date-num { font-size: 0.9rem; font-weight: 800; color: var(--text); }
.cal-date-num.today-dot {
  background: var(--accent);
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
}

.cal-events { padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.cal-empty { color: var(--text-light); font-size: 0.75rem; text-align: center; padding: 8px 0; }

.cal-event {
  padding: 5px 7px;
  border-radius: 6px;
  font-size: 0.72rem;
}
.cal-event-dept { font-weight: 700; margin-bottom: 2px; font-size: 0.68rem; }
.cal-event-title { font-size: 0.72rem; color: var(--text); line-height: 1.3; margin-bottom: 2px; }
.cal-event-meta { font-size: 0.65rem; color: var(--text-light); display: flex; align-items: center; gap: 4px; }
.cal-status {
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 700;
}
.cal-status.done   { background: #dcfce7; color: #166534; }
.cal-status.urgent { background: #fee2e2; color: #991b1b; }

/* 直近イベントリスト */
.upcoming-event {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.upcoming-event:last-child { border-bottom: none; }
.upcoming-date {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-light);
  min-width: 80px;
  padding-top: 2px;
}
.upcoming-body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-left: 8px;
}
.upcoming-dept  { font-size: 0.75rem; font-weight: 700; }
.upcoming-title { font-size: 0.82rem; color: var(--text); flex: 1; }
.upcoming-type  { font-size: 0.68rem; color: var(--text-light); background: #f1f5f9; padding: 1px 6px; border-radius: 4px; }

/* ═══════════════════════════════════════════════
   モバイル / レスポンシブ
   ═══════════════════════════════════════════════ */

/* ── ハンバーガーボタン ── */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: #dfe6e9;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.15s;
}
.hamburger:hover { background: rgba(255,255,255,0.1); }

/* ── サイドバーオーバーレイ ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 98;
  backdrop-filter: blur(2px);
}

/* ── 下部ナビ ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: var(--sidebar-bg);
  border-top: 1px solid rgba(255,255,255,0.07);
  z-index: 50;
  padding: 0 4px env(safe-area-inset-bottom, 0);
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: 8px;
  transition: background 0.15s;
  color: var(--sidebar-text);
}
.bottom-nav-item:hover,
.bottom-nav-item.active { color: var(--sidebar-active-text); background: var(--sidebar-active-bg); }
.bottom-nav-icon { font-size: 1.25rem; line-height: 1; }
.bottom-nav-label { font-size: 0.6rem; font-weight: 600; letter-spacing: 0.02em; }

/* ── 指示送信モーダル ── */
.instruction-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  backdrop-filter: blur(3px);
}
.instruction-backdrop.open { display: block; }

.instruction-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border-radius: 20px 20px 0 0;
  padding: 0 0 env(safe-area-inset-bottom, 16px);
  z-index: 201;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 92vh;
  overflow-y: auto;
}
.instruction-sheet.open { transform: translateY(0); }

.instruction-sheet-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 12px auto 0;
}
.instruction-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.instruction-sheet-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.instruction-close-btn {
  background: #f1f5f9; border: none; border-radius: 50%;
  width: 28px; height: 28px;
  font-size: 0.8rem; color: var(--text-light);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.instruction-sheet-body { padding: 16px 20px 20px; }

/* ─── コンプライアンス ─────────────────────────── */

/* 概要ページ — BLOCKアラートバナー */
.compliance-alert-banner {
  background: linear-gradient(135deg, #ff4757, #c0392b);
  color: #fff;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 1rem;
  box-shadow: 0 4px 16px rgba(255,71,87,0.3);
  animation: pulse-red 2s ease-in-out infinite;
}
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 4px 16px rgba(255,71,87,0.3); }
  50%       { box-shadow: 0 4px 24px rgba(255,71,87,0.6); }
}
.compliance-alert-header {
  display: flex; align-items: center; gap: 10px;
  font-size: 1rem; font-weight: 700; margin-bottom: 10px;
}
.compliance-alert-icon { font-size: 1.4rem; }
.compliance-alert-arrow {
  margin-left: auto; font-size: 0.85rem;
  background: rgba(255,255,255,0.2); padding: 3px 10px;
  border-radius: 20px; white-space: nowrap;
}
.compliance-alert-items {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.compliance-alert-item {
  background: rgba(255,255,255,0.15);
  padding: 5px 12px; border-radius: 20px;
  font-size: 0.82rem; display: flex; align-items: center; gap: 6px;
}
.compliance-alert-more {
  background: rgba(255,255,255,0.1);
  padding: 5px 12px; border-radius: 20px; font-size: 0.82rem;
}

/* コンプライアンスページ — 上部ステータス */
.compliance-top-alert {
  background: linear-gradient(135deg, #ff4757, #c0392b);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 24px;
  margin-bottom: 1.5rem;
  display: flex; align-items: center; gap: 14px;
  font-size: 1.05rem;
  box-shadow: 0 4px 20px rgba(255,71,87,0.35);
}
.compliance-top-ok {
  background: linear-gradient(135deg, #00b894, #00cec9);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 24px;
  margin-bottom: 1.5rem;
  display: flex; align-items: center; gap: 14px;
  font-size: 1.05rem;
  box-shadow: 0 4px 12px rgba(0,184,148,0.3);
}

/* 統計グリッド */
.compliance-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.compliance-stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 4px solid transparent;
}
.compliance-stat-card.blocked { border-top-color: #ff4757; }
.compliance-stat-card.warned  { border-top-color: #ffa502; }
.compliance-stat-card.passed  { border-top-color: #00b894; }
.compliance-stat-card.total   { border-top-color: var(--accent); }
.compliance-stat-number {
  font-size: 2.4rem; font-weight: 800; line-height: 1;
  margin-bottom: 6px;
}
.compliance-stat-card.blocked .compliance-stat-number { color: #ff4757; }
.compliance-stat-card.warned  .compliance-stat-number { color: #ffa502; }
.compliance-stat-card.passed  .compliance-stat-number { color: #00b894; }
.compliance-stat-card.total   .compliance-stat-number { color: var(--accent); }
.compliance-stat-label { font-size: 0.9rem; font-weight: 700; margin-bottom: 4px; }
.compliance-stat-desc  { font-size: 0.75rem; color: var(--text-light); }

/* 最終BLOCK情報 */
.compliance-last-block {
  background: #fff5f5;
  border: 2px solid #ff4757;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 1.5rem;
}
.compliance-last-block-title { font-size: 1rem; font-weight: 700; color: #c0392b; margin-bottom: 12px; }
.compliance-last-block-info {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  margin-bottom: 10px; font-size: 0.9rem;
}
.compliance-last-block-hint {
  font-size: 0.82rem; color: var(--text-light);
  background: rgba(255,71,87,0.06); padding: 8px 12px; border-radius: 8px;
}
.compliance-no-block {
  background: #f0fdf4; border: 2px solid #00b894; border-radius: var(--radius);
  padding: 18px 24px; color: #00b894; font-weight: 700;
  margin-bottom: 1.5rem;
}

/* ステータスバッジ */
.compliance-badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em;
}
.compliance-badge.blocked { background: #ff4757; color: #fff; }
.compliance-badge.warn    { background: #ffa502; color: #fff; }
.compliance-badge.pass    { background: #00b894; color: #fff; }

/* ログタイムライン */
.compliance-timeline {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.compliance-log-row {
  display: grid;
  grid-template-columns: 130px 1fr 1fr;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 0.87rem;
  transition: background 0.15s;
}
.compliance-log-row:hover { background: #f8fafc; }
.compliance-log-row.blocked { border-left: 4px solid #ff4757; background: #fff8f8; }
.compliance-log-row.warn    { border-left: 4px solid #ffa502; background: #fffdf0; }
.compliance-log-row.pass    { border-left: 4px solid #00b894; }
.compliance-log-status { font-weight: 700; }
.compliance-log-row.blocked .compliance-log-status { color: #c0392b; }
.compliance-log-row.warn    .compliance-log-status { color: #e67e22; }
.compliance-log-row.pass    .compliance-log-status { color: #00b894; }
.compliance-log-time { color: var(--text-light); }
.compliance-log-detail { text-align: right; color: var(--text-light); font-size: 0.8rem; }
.compliance-empty {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 40px; text-align: center; color: var(--text-light);
  font-size: 0.9rem;
}

/* ─── コンプライアンス カード UI ──────────────────── */

.compliance-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  transition: border-color 0.2s;
}
.compliance-card.unresolved { border-color: #ff4757; }
.compliance-card.resolved   { border-color: #00b894; opacity: 0.88; }

/* カードヘッダー */
.compliance-card-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  padding: 16px 20px;
  background: #1a1c2e; color: #fff;
}
.compliance-card.resolved .compliance-card-header { background: #0f2922; }
.compliance-card-header-left { display: flex; align-items: center; gap: 10px; }
.compliance-card-header-right { display: flex; align-items: center; gap: 14px; }
.compliance-card-time { font-size: 0.9rem; color: #b2bec3; }
.compliance-card-count { font-size: 0.87rem; color: #b2bec3; }
.compliance-resolved-badge {
  background: #00b894; color: #fff; padding: 3px 10px;
  border-radius: 20px; font-size: 0.78rem; font-weight: 700;
}
.compliance-unresolved-badge {
  background: #ff4757; color: #fff; padding: 3px 10px;
  border-radius: 20px; font-size: 0.78rem; font-weight: 700;
}
.compliance-badge-sm {
  padding: 2px 8px; border-radius: 20px; font-size: 0.72rem; font-weight: 700;
}
.compliance-badge-sm.resolved { background: #00b894; color: #fff; }

/* カードセクション */
.compliance-card-section {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.compliance-section-title {
  font-size: 0.95rem; font-weight: 700; margin-bottom: 8px; color: var(--text);
}
.compliance-section-sub {
  font-size: 0.8rem; color: var(--text-light); margin-bottom: 10px;
}

/* H003 自動検出内容 */
.compliance-auto-section {
  background: #fff8f8;
  border-left: 3px solid #ff4757;
}
.compliance-detected-file {
  font-size: 0.8rem; color: var(--text-light); margin-bottom: 10px;
}
.compliance-detected-file code {
  background: #f1f2f6; padding: 2px 6px; border-radius: 4px; font-size: 0.8rem;
}
.compliance-detected-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-radius: 8px; margin-bottom: 6px;
}
.compliance-detected-item.c-blocked { background: #fff0f0; border: 1px solid #ffb3b3; }
.compliance-detected-item.c-warned  { background: #fffbf0; border: 1px solid #ffd980; }
.compliance-detected-badge {
  font-size: 0.72rem; font-weight: 700; white-space: nowrap;
  padding: 2px 6px; border-radius: 4px; flex-shrink: 0;
}
.c-blocked .compliance-detected-badge { background: #ff4757; color: #fff; }
.c-warned  .compliance-detected-badge { background: #ffa502; color: #fff; }
.compliance-detected-body {
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.compliance-detected-code {
  font-size: 0.78rem; font-weight: 700; color: #c0392b; font-family: monospace;
}
.c-warned .compliance-detected-code { color: #b7860b; }
.compliance-detected-desc {
  font-size: 0.82rem; color: var(--text); line-height: 1.5;
}

/* BLOCKファイル アコーディオン（CEO確認待ちリスト同設計） */
.compliance-blocked-file-wrap {
  margin-bottom: 4px;
}
.compliance-blocked-file-label {
  font-size: 0.75rem; font-weight: 700; color: #c0392b;
  margin-bottom: 6px; letter-spacing: 0.02em;
}
.compliance-file-accordion-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 14px;
  background: #fff0f0; border: 1.5px solid #ffb3b3;
  border-radius: 8px; cursor: pointer;
  font-size: 0.85rem; text-align: left;
  transition: background 0.15s;
}
.compliance-file-accordion-btn:hover { background: #ffe4e4; }
.compliance-file-accordion-icon { font-size: 1rem; flex-shrink: 0; }
.compliance-file-accordion-name {
  font-weight: 700; color: var(--text); flex-shrink: 0;
}
.compliance-file-accordion-path {
  font-size: 0.72rem; color: var(--text-light);
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.compliance-file-accordion-arrow {
  font-size: 0.72rem; color: var(--text-light); flex-shrink: 0;
}
.compliance-no-auto-file {
  font-size: 0.8rem; color: var(--text-light);
  padding: 8px 12px; background: var(--bg-card);
  border: 1px dashed var(--border); border-radius: 8px;
}
.compliance-old-log-notice {
  font-size: 0.82rem; color: #b7860b;
  padding: 10px 14px; background: #fffbf0;
  border: 1px solid #ffd980; border-radius: 8px;
  line-height: 1.6;
}
.compliance-extra-files-wrap {
  margin-top: 4px;
}

/* WARNログ詳細 */
.compliance-log-warn-details {
  padding: 6px 0 2px 8px;
}
.compliance-log-warn-item {
  font-size: 0.78rem; color: #b7860b; padding: 3px 0; line-height: 1.4;
}
.compliance-log-file {
  font-size: 0.75rem; color: var(--text-light); background: #f1f2f6;
  padding: 2px 6px; border-radius: 4px;
}

/* 違反チェックリスト */
.compliance-vcheck-list {
  display: flex; flex-direction: column; gap: 8px;
}
.compliance-vcheck {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; font-size: 0.88rem;
  padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--border);
  transition: background 0.15s, border-color 0.15s;
}
.compliance-vcheck:hover { background: #f8fafc; }
.compliance-vcheck:has(input:checked) {
  background: #fff5f5; border-color: #ff4757; color: #c0392b; font-weight: 600;
}
.compliance-vcheck-input { width: 16px; height: 16px; accent-color: #ff4757; flex-shrink: 0; }

/* テキストエリア（共通） */
.compliance-textarea {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.88rem; font-family: inherit; line-height: 1.6;
  resize: vertical; transition: border-color 0.15s;
  background: var(--card-bg); color: var(--text);
}
.compliance-textarea:focus { outline: none; border-color: var(--accent); }

/* 添付ファイル */
.compliance-file-tags {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; min-height: 0;
}
.compliance-file-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: #f1f3f9; border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 10px; font-size: 0.82rem;
}
.compliance-file-tag button {
  background: none; border: none; cursor: pointer;
  color: var(--text-light); font-size: 0.85rem; padding: 0; line-height: 1;
}
.compliance-file-tag button:hover { color: #e17055; }
.compliance-file-tag-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compliance-file-input-row {
  display: flex; gap: 8px; align-items: center;
}
.compliance-file-input {
  flex: 1; padding: 8px 12px; border: 1px dashed var(--border);
  border-radius: 8px; font-size: 0.83rem; color: var(--text);
  background: var(--card-bg); font-family: monospace;
  transition: border-color 0.15s;
}
.compliance-file-input:focus { outline: none; border-color: var(--accent); border-style: solid; }
.compliance-file-add-btn {
  padding: 8px 16px; background: var(--accent); color: #fff;
  border: none; border-radius: 8px; cursor: pointer;
  font-size: 0.83rem; white-space: nowrap;
  transition: opacity 0.15s;
}
.compliance-file-add-btn:hover { opacity: 0.85; }
.compliance-files-viewer { margin-top: 12px; }
.compliance-file-card {
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; margin-bottom: 0.75rem;
}
.compliance-file-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; background: #f8fafc; border-bottom: 1px solid var(--border);
  font-size: 0.85rem; font-weight: 700; gap: 10px; flex-wrap: wrap;
}
.compliance-file-card-body {
  padding: 12px 16px; max-height: 400px; overflow-y: auto;
}
.compliance-file-loading {
  padding: 12px; color: var(--text-light); font-size: 0.82rem;
}
.compliance-file-error {
  border: 1px solid #fca5a5; border-radius: 8px;
  padding: 10px 14px; background: #fef2f2;
  color: #ef4444; font-size: 0.82rem; margin-bottom: 0.75rem;
}

/* 4択アクションボタン */
.compliance-action-grid {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 12px;
}
.compliance-action-btn {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: 10px;
  border: 2px solid var(--border); background: var(--card-bg);
  cursor: pointer; font-size: 0.9rem; text-align: left;
  transition: all 0.15s; color: var(--text);
}
.compliance-action-btn:hover {
  border-color: var(--btn-color, var(--accent));
  background: color-mix(in srgb, var(--btn-color, var(--accent)) 8%, white);
}
.compliance-action-btn.selected {
  border-color: var(--btn-color, var(--accent));
  background: color-mix(in srgb, var(--btn-color, var(--accent)) 12%, white);
  font-weight: 700;
}
.compliance-action-key {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 8px; font-weight: 800;
  font-size: 0.95rem; flex-shrink: 0;
  background: color-mix(in srgb, var(--btn-color, var(--accent)) 15%, white);
  color: var(--btn-color, var(--accent));
  border: 1.5px solid var(--btn-color, var(--accent));
}
.compliance-action-btn.selected .compliance-action-key {
  background: var(--btn-color, var(--accent)); color: #fff;
}
.compliance-action-custom {
  margin-top: 8px;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; } }

/* 送信ボタン */
.compliance-card-footer {
  padding: 16px 22px; display: flex; align-items: center; gap: 14px;
  background: #fafbfd;
}
.compliance-submit-btn {
  padding: 11px 24px; background: var(--accent); color: #fff;
  border: none; border-radius: 10px; cursor: pointer;
  font-size: 0.9rem; font-weight: 700;
  transition: opacity 0.15s, box-shadow 0.15s;
}
.compliance-submit-btn:hover { opacity: 0.9; box-shadow: 0 4px 12px rgba(108,92,231,0.3); }
.compliance-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.compliance-submit-btn.dirty {
  animation: pulse-accent 1.5s ease-in-out infinite;
}
@keyframes pulse-accent {
  0%, 100% { box-shadow: 0 0 0 0 rgba(108,92,231,0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(108,92,231,0); }
}
.compliance-submit-status { font-size: 0.85rem; }

/* デスクトップでは中央モーダルとして表示 */
@media (min-width: 769px) {
  .instruction-sheet {
    left: 50%; right: auto;
    width: 480px;
    transform: translateX(-50%) translateY(100%);
    bottom: 40px;
    border-radius: 16px;
    max-height: 80vh;
  }
  .instruction-sheet.open {
    transform: translateX(-50%) translateY(0);
  }
  .instruction-sheet-handle { display: none; }
}

/* ════════════════════════
   スマホ専用スタイル
   ════════════════════════ */
@media (max-width: 768px) {

  body { height: 100dvh; }

  .hamburger { display: flex; }

  /* サイドバー：スライドイン式ドロワー */
  .sidebar {
    position: fixed;
    left: -230px;
    top: 58px;
    bottom: 0;
    width: 220px;
    z-index: 99;
    transition: left 0.25s ease;
    overflow-y: auto;
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay.open { display: block; }

  /* メインエリア：下部ナビ分の余白 */
  .main { padding: 1rem; padding-bottom: 72px; }

  /* 下部ナビ */
  .bottom-nav { display: flex; }

  /* グリッド：2カラム */
  .dept-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .manual-form-grid { grid-template-columns: 1fr; }
  .files-grid { grid-template-columns: 1fr 1fr; }
  .phase-grid { grid-template-columns: 1fr 1fr; }
  .cal-grid { grid-template-columns: repeat(2, 1fr); }

  /* カード余白 */
  .card { padding: 1rem; }
  .ceo-item-card { padding: 12px 14px; }

  /* テーブルはスクロール */
  .history-table-wrap { overflow-x: auto; }
  .history-table { white-space: nowrap; }
  .md-body table { font-size: 0.72rem; }
  .md-body td, .md-body th { padding: 0.3rem 0.5rem; }

  /* ページヘッダー */
  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-header h1 { font-size: 1.15rem; }

  /* フォーム入力は大きめ */
  .form-input { font-size: 1rem; padding: 10px 12px; }
  .btn-answer { padding: 12px 18px; font-size: 0.9rem; }

  /* ヘッダーのテキスト省略 */
  .header-title { font-size: 0.82rem; }
  .clock { font-size: 0.72rem; }

  /* メトリクス値を少し小さく */
  .metric-value { font-size: 1.35rem; }

  /* コンプライアンス */
  .compliance-stats-grid { grid-template-columns: 1fr 1fr; }
  .compliance-log-row { grid-template-columns: 100px 1fr; }
  .compliance-log-detail { display: none; }
  .compliance-alert-items { flex-direction: column; gap: 6px; }
  .compliance-card-header { flex-direction: column; align-items: flex-start; gap: 6px; }
  .compliance-card-header-right { gap: 8px; }
  .compliance-file-input-row { flex-direction: column; }
  .compliance-file-add-btn { width: 100%; text-align: center; padding: 10px; }
  .compliance-card-section { padding: 14px 16px; }
  .compliance-card-footer { flex-direction: column; align-items: stretch; }
  .compliance-submit-btn { text-align: center; }
}

/* ─── 指示トラッカー ─────────────────────────────── */
.itk-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 10px;
  border-left: 4px solid #e2e8f0;
  transition: opacity 0.2s;
}
.itk-card.itk-done {
  opacity: 0.55;
  border-left-color: var(--done);
}
.itk-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.itk-cat {
  font-size: 0.72rem;
  color: var(--text-light);
  flex: 1;
}
.itk-time {
  font-size: 0.72rem;
  color: var(--text-light);
}
.itk-body {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.5;
}
.itk-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.itk-badge.pending { background: #f1f2f6; color: #636e72; }
.itk-badge.wip     { background: #fff0d4; color: #c47c00; animation: itk-pulse 1.5s ease-in-out infinite; }
.itk-badge.done    { background: rgba(0,184,148,0.12); color: var(--done); }

@keyframes itk-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

.itk-card.itk-running {
  border-left-color: #fdcb6e;
  box-shadow: 0 0 0 2px rgba(253,203,110,0.25);
}

.itk-elapsed-badge {
  font-size: 0.7rem;
  color: #c47c00;
  background: #fff8e8;
  padding: 2px 7px;
  border-radius: 8px;
  font-weight: 600;
  white-space: nowrap;
}

.itk-log-wrap {
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.itk-log-label {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-bottom: 5px;
}

.itk-log-output {
  background: #0d1117;
  color: #c9d1d9;
  font-size: 0.68rem;
  line-height: 1.5;
  padding: 8px 10px;
  border-radius: 6px;
  max-height: 160px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

.itk-empty {
  color: var(--text-light);
  font-size: 0.85rem;
  padding: 1rem 0;
}
/* 朝実行・夜実行ボタン */
.schedule-run-row {
  display: flex;
  gap: 10px;
  margin-bottom: 6px;
}
.schedule-run-btn {
  flex: 1;
  border: none;
  border-radius: var(--radius);
  padding: 14px 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}
.schedule-run-btn.morning { background: #fff3cd; color: #856404; }
.schedule-run-btn.evening { background: #1a1a2e; color: #a29bfe; }
.schedule-run-btn:disabled { opacity: 0.5; cursor: default; }
.schedule-run-desc {
  font-size: 0.72rem;
  color: var(--text-light);
  text-align: center;
  margin-bottom: 12px;
}
.instruction-divider {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-light);
  margin: 10px 0 14px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.itk-exec-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 4px;
}
.itk-exec-btn:disabled { opacity: 0.6; cursor: default; }

/* ─── 配信スロット ──────────────── */
#broadcast-slots-container .card {
  transition: border-left-color 0.3s, box-shadow 0.3s;
}
#broadcast-slots-container .card:has([id^="broadcast-progress-area-"][style*="block"]) {
  box-shadow: 0 4px 16px rgba(108,92,231,0.12);
}
.compliance-block-card { border-radius: var(--radius); padding: 0.9rem 1rem; background: var(--card-bg); }
.tag { display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.tag-block { background: rgba(231,76,60,0.12); color: #e17055; }
.tag-warn  { background: rgba(253,203,110,0.2); color: #e6a817; }
.btn-sm { padding: 4px 10px; font-size: 0.78rem; font-weight: 600; border-radius: 6px; border: 1.5px solid var(--border); background: transparent; color: var(--text); cursor: pointer; }
.btn-sm:hover { background: var(--bg2); }
.btn-xs { padding: 2px 8px; font-size: 0.72rem; font-weight: 600; border-radius: 5px; border: 1.5px solid var(--border); background: transparent; color: var(--text); cursor: pointer; }
.btn-xs:hover { background: var(--bg2); }
.kpi-mini { background: var(--bg2); border-radius: 10px; padding: 0.6rem 1rem; text-align: center; min-width: 80px; }
.kpi-mini-val { font-size: 1.3rem; font-weight: 700; color: var(--accent); }
.kpi-mini-lbl { font-size: 0.72rem; color: var(--text-light); margin-top: 0.1rem; }
.compliance-empty { text-align: center; padding: 1.5rem; color: var(--text-light); font-size: 0.88rem; }

/* ── パイプライン ── */
.pipeline-stages { display: flex; flex-direction: column; gap: 0; }
.pipeline-stage {
  display: flex; align-items: stretch; gap: 1rem;
  padding: 0.9rem 1.1rem; background: var(--card-bg);
  border-radius: var(--radius); margin-bottom: 0.5rem;
  border-left: 4px solid var(--border); box-shadow: var(--shadow);
  transition: border-color 0.2s;
}
.pipeline-stage.done  { border-left-color: var(--done); }
.pipeline-stage.warn  { border-left-color: #fdcb6e; }
.pipeline-stage.error { border-left-color: #e17055; }
.pipeline-stage.pending { border-left-color: #b2bec3; }
.pipeline-stage-icon { font-size: 1.5rem; display: flex; align-items: center; }
.pipeline-stage-body { flex: 1; }
.pipeline-stage-label { font-size: 0.82rem; font-weight: 700; color: var(--text-light); margin-bottom: 2px; }
.pipeline-stage-value { font-size: 1.25rem; font-weight: 800; color: var(--text); }
.pipeline-stage-detail { font-size: 0.78rem; color: var(--text-light); margin-top: 2px; }
.pipeline-stage-badge { display: flex; align-items: center; }
.pipeline-connector { text-align: center; color: var(--text-light); font-size: 1.1rem; margin: -2px 0; }

/* ── 投稿管理 ── */
.post-card {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 0.85rem 1rem; margin-bottom: 0.5rem;
  box-shadow: var(--shadow); display: flex; gap: 0.75rem; align-items: flex-start;
}
.post-card-body { flex: 1; min-width: 0; }
.post-card-title { font-size: 0.88rem; font-weight: 700; color: var(--text); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-card-preview { font-size: 0.78rem; color: var(--text-light); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card-meta { font-size: 0.72rem; color: var(--text-light); margin-top: 4px; }
.post-card-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; padding-top: 2px; }
.post-status-btn {
  font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: 20px;
  border: none; cursor: pointer; transition: opacity 0.15s;
}
.post-status-draft     { background: rgba(178,190,195,0.25); color: var(--text-light); }
.post-status-published { background: rgba(0,184,148,0.15);   color: var(--done); }
.post-status-rejected  { background: rgba(231,76,60,0.12);   color: #e17055; }
.post-copy-btn { font-size: 0.7rem; padding: 3px 8px; border-radius: 20px; border: 1px solid var(--border); background: transparent; cursor: pointer; color: var(--text-light); }
.post-filter-bar { display: flex; gap: 8px; margin-bottom: 0.75rem; flex-wrap: wrap; }
.post-filter-btn { font-size: 0.78rem; padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border); background: var(--card-bg); cursor: pointer; color: var(--text-light); }
.post-filter-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

/* ── Cronタイムライン ── */
.cron-timeline { display: flex; flex-direction: column; gap: 0; position: relative; }
.cron-timeline::before {
  content: ''; position: absolute; left: 28px; top: 12px; bottom: 12px; width: 2px;
  background: var(--border); z-index: 0;
}
.cron-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.75rem; position: relative; z-index: 1;
}
.cron-dot {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  border: 3px solid white; box-shadow: 0 0 0 2px currentColor;
  z-index: 2;
}
.cron-dot.done    { background: var(--done);    color: var(--done); }
.cron-dot.error   { background: #e17055;        color: #e17055; }
.cron-dot.missed  { background: #fdcb6e;        color: #fdcb6e; }
.cron-dot.pending { background: #dfe6e9;        color: #b2bec3; }
.cron-body { flex: 1; }
.cron-label { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.cron-time  { font-size: 0.72rem; color: var(--text-light); }
.cron-status-badge {
  font-size: 0.7rem; font-weight: 700; padding: 2px 8px;
  border-radius: 20px; border: none; white-space: nowrap;
}
.cron-status-badge.done    { background: rgba(0,184,148,0.12);   color: var(--done); }
.cron-status-badge.error   { background: rgba(231,76,60,0.12);   color: #e17055; }
.cron-status-badge.missed  { background: rgba(253,203,110,0.2);  color: #e6a817; }
.cron-status-badge.pending { background: rgba(178,190,195,0.2);  color: var(--text-light); }
.cron-summary-bar { display: flex; gap: 1rem; padding: 0.75rem 1rem; background: var(--card-bg); border-radius: var(--radius); margin-bottom: 1rem; box-shadow: var(--shadow); flex-wrap: wrap; }
.cron-summary-item { text-align: center; }
.cron-summary-count { font-size: 1.3rem; font-weight: 800; }
.cron-summary-label { font-size: 0.7rem; color: var(--text-light); }

/* ── KPIトレンドグラフ ── */
.kpi-chart-container { background: var(--card-bg); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.kpi-chart-title { font-size: 0.85rem; font-weight: 700; color: var(--text-light); margin-bottom: 0.5rem; }
.kpi-period-tabs { display: flex; gap: 6px; margin-bottom: 1rem; }
.kpi-period-tab { font-size: 0.78rem; padding: 4px 12px; border-radius: 20px; border: 1px solid var(--border); background: var(--card-bg); cursor: pointer; color: var(--text-light); }
.kpi-period-tab.active { background: var(--accent); color: white; border-color: var(--accent); }
.chart-canvas-wrap { position: relative; height: 220px; }

/* ── ナレッジ更新ログ ── */
.knowledge-item {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 0.8rem 1rem; margin-bottom: 0.5rem; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 0.75rem;
  border-left: 3px solid var(--border);
}
.knowledge-item.updated { border-left-color: var(--accent); }
.knowledge-item.missing { border-left-color: #e17055; opacity: 0.6; }
.knowledge-icon { font-size: 1.4rem; flex-shrink: 0; }
.knowledge-body { flex: 1; min-width: 0; }
.knowledge-label { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.knowledge-meta  { font-size: 0.75rem; color: var(--text-light); margin-top: 2px; }
.knowledge-preview { font-size: 0.75rem; color: var(--text-light); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.knowledge-size-badge { font-size: 0.7rem; font-weight: 700; padding: 2px 7px; border-radius: 20px; background: rgba(108,92,231,0.1); color: var(--accent); white-space: nowrap; }

/* ── アウトプット一覧 ── */
.output-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 0.9rem; background: var(--card-bg);
  border-radius: var(--radius); margin-bottom: 0.4rem;
  box-shadow: var(--shadow); cursor: pointer; transition: background 0.15s;
}
.output-item:hover { background: rgba(108,92,231,0.04); }
.output-item-icon { font-size: 1.2rem; flex-shrink: 0; }
.output-item-body { flex: 1; min-width: 0; }
.output-item-file { font-size: 0.82rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.output-item-dept { font-size: 0.72rem; color: var(--text-light); }
.output-item-mtime { font-size: 0.72rem; color: var(--text-light); white-space: nowrap; }

/* ── 検索 ── */
.search-input-bar { display: flex; gap: 8px; margin-bottom: 1rem; }
.search-input {
  flex: 1; padding: 10px 14px; border-radius: var(--radius);
  border: 2px solid var(--border); font-size: 0.95rem;
  background: var(--card-bg); color: var(--text); outline: none;
  transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--accent); }
.search-result-item {
  background: var(--card-bg); border-radius: var(--radius);
  padding: 0.75rem 1rem; margin-bottom: 0.4rem; box-shadow: var(--shadow);
  cursor: pointer; transition: background 0.15s;
}
.search-result-item:hover { background: rgba(108,92,231,0.04); }
.search-result-path { font-size: 0.72rem; color: var(--accent); font-family: monospace; margin-bottom: 4px; }
.search-result-snippet {
  font-size: 0.8rem; color: var(--text-light); line-height: 1.5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-result-count { display: inline-block; font-size: 0.68rem; font-weight: 700; padding: 1px 6px; border-radius: 20px; background: rgba(108,92,231,0.1); color: var(--accent); float: right; }
.search-empty { text-align: center; color: var(--text-light); padding: 2rem; font-size: 0.88rem; }

/* ── FAB (フローティングアクションボタン) ── */
.fab-container {
  position: fixed; bottom: 80px; right: 18px; z-index: 1200;
  display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 10px;
}
@media (min-width: 769px) { .fab-container { bottom: 24px; } }
.fab-main {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: white; border: none; cursor: pointer;
  font-size: 1.4rem; box-shadow: 0 4px 14px rgba(108,92,231,0.45);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s, background 0.2s;
}
.fab-main:hover { background: #5a4fcf; }
.fab-main.open { transform: rotate(45deg); background: #e17055; }
.fab-menu {
  display: flex; flex-direction: column-reverse; gap: 8px; align-items: flex-end;
  overflow: hidden; max-height: 0; transition: max-height 0.3s ease;
}
.fab-menu.open { max-height: 300px; }
.fab-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px;
  background: var(--card-bg); border: none; border-radius: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12); cursor: pointer;
  white-space: nowrap; transition: background 0.15s;
}
.fab-item:hover { background: rgba(108,92,231,0.07); }
.fab-item-icon { font-size: 1.1rem; }
.fab-item-label { font-size: 0.8rem; font-weight: 600; color: var(--text); }

/* ── 通知バナー ── */
.notif-banner {
  position: fixed; bottom: 140px; left: 50%; transform: translateX(-50%);
  background: #2d3436; color: white; border-radius: var(--radius);
  padding: 0.75rem 1rem; font-size: 0.82rem;
  display: flex; align-items: center; gap: 0.75rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25); z-index: 1300; max-width: 420px; width: 90%;
}
.notif-banner button {
  padding: 4px 12px; border-radius: 20px; border: none; cursor: pointer;
  font-size: 0.78rem; font-weight: 700; background: var(--accent); color: white;
}
.notif-banner button:last-child { background: transparent; color: #b2bec3; padding: 4px 6px; }

/* ─── 動画分析AI ─────────────────────────────── */
.va-card { padding: 14px 16px; margin-bottom: 12px; }
.va-section-label { font-size: 0.75rem; font-weight: 700; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.va-input { width: 100%; box-sizing: border-box; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 0.9rem; color: var(--text); outline: none; transition: border-color 0.2s; }
.va-input:focus { border-color: var(--accent); }
.va-check { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; padding: 5px 0; cursor: pointer; }
.va-check input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.va-run-btn { width: 100%; background: linear-gradient(135deg, #6c5ce7, #a29bfe); color: #fff; border: none; border-radius: 12px; padding: 16px; font-size: 1rem; font-weight: 700; cursor: pointer; transition: opacity 0.2s, transform 0.1s; margin-top: 4px; }
.va-run-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.va-run-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.va-progress-msg { font-size: 0.88rem; font-weight: 600; color: var(--accent); margin-bottom: 10px; }
.va-progress-track { background: var(--border); border-radius: 6px; height: 8px; overflow: hidden; }
.va-progress-fill { height: 100%; background: linear-gradient(90deg, #6c5ce7, #00b894); border-radius: 6px; transition: width 0.4s ease; }
.va-result-block { padding: 14px 16px; }
.va-result-title { font-size: 0.9rem; font-weight: 700; margin-bottom: 10px; }
.va-result-body { font-size: 0.82rem; line-height: 1.75; color: var(--text); white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow-y: auto; background: var(--bg); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.va-copy-btn { background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px; padding: 6px 14px; font-size: 0.8rem; cursor: pointer; color: var(--text); transition: background 0.15s; }
.va-copy-btn:hover { background: var(--border); }
