:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-sub: #6e6e73;
  --accent: #0071e3;
  --border: rgba(0, 0, 0, 0.08);
  --nav-bg: rgba(251, 251, 253, 0.8);
  --ok: #30d158;
  --warn: #ffd60a;
  --bad: #ff453a;
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --text: #f5f5f7;
    --text-sub: #86868b;
    --border: rgba(255, 255, 255, 0.12);
    --nav-bg: rgba(22, 22, 23, 0.8);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro JP", "SF Pro Text",
    "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

/* すりガラスの固定ヘッダー */
.nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.nav-brand { font-size: 15px; font-weight: 600; }
.nav-status { font-size: 12px; color: var(--text-sub); }
.nav-pill {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-sub);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.nav-pill:hover { border-color: var(--text-sub); }
.nav-pill.is-on { color: var(--accent); border-color: var(--accent); }

/* ハンバーガー */
.nav-burger {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  border-radius: 8px;
}
.nav-burger:hover { background: var(--border); }
.nav-burger span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav-burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger.is-open span:nth-child(2) { opacity: 0; }
.nav-burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* 左ドロワー */
.drawer {
  position: fixed;
  top: 48px;
  left: 0;
  bottom: 0;
  width: 260px;
  z-index: 25;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
}
.drawer.is-open { transform: translateX(0); }
.drawer-nav { display: flex; flex-direction: column; gap: 4px; }
.drawer-item {
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}
.drawer-item:hover { background: var(--border); }
.drawer-item.is-active { background: var(--text); color: var(--bg); font-weight: 600; }
.drawer-foot { margin-top: auto; font-size: 11px; color: var(--text-sub); padding: 0 14px; }

.drawer-overlay {
  position: fixed;
  inset: 48px 0 0 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.drawer-overlay.is-open { opacity: 1; pointer-events: auto; }

main { max-width: 880px; margin: 0 auto; padding: 40px 22px 80px; }

.view { display: none; }
.view.is-active { display: block; animation: view-in 0.3s ease; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-title {
  margin: 8px 0 4px;
  font-size: clamp(32px, 5vw, 44px);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.view-sub { margin: 0 0 28px; font-size: 15px; color: var(--text-sub); }
.section-title { font-size: 20px; font-weight: 600; margin: 36px 0 14px; }

/* カード共通 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--border);
}
.card-head { display: flex; align-items: center; gap: 10px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.card-name { font-size: 15px; font-weight: 600; }
.card-sub { margin: 6px 0 0; font-size: 13px; color: var(--text-sub); }

/* 障害・メンテカード */
.incident {
  background: var(--surface);
  border: 1px solid var(--bad);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 0 0 14px;
}
.incident.muted { border-color: var(--border); }
.incident.maint { border-color: var(--warn); }
.incident h3 { margin: 0 0 4px; font-size: 16px; }
.incident p { margin: 4px 0 0; font-size: 14px; color: var(--text-sub); }
.empty-note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  font-size: 14px;
  color: var(--text-sub);
  text-align: center;
}

/* 全体ステータスバナー */
.banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 22px;
  margin: 0 0 24px;
  font-size: 16px;
  font-weight: 600;
}

/* フィード */
.feed { display: flex; flex-direction: column; gap: 14px; }
.entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.entry.is-new { border-color: var(--accent); }
.entry-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-sub); }
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-sub);
}
.badge.feature { background: rgba(0, 113, 227, 0.12); color: var(--accent); }
.badge.changelog { background: rgba(48, 209, 88, 0.14); color: #1d8a41; }
.badge.docs { background: rgba(191, 90, 242, 0.14); color: #bf5af2; }
.badge.new { background: var(--accent); color: #fff; }
.entry-title { margin: 8px 0 2px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.entry-orig { margin: 0; font-size: 13px; color: var(--text-sub); }
.entry-body { margin-top: 12px; font-size: 14px; }
.wwh { margin: 10px 0 0; }
.wwh dt {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 10px;
}
.wwh dd { margin: 2px 0 0; }
.entry-body ul { margin: 6px 0 0; padding-left: 20px; }
.entry-body li { margin: 3px 0; }
.entry-more { display: inline-block; margin-top: 12px; font-size: 13px; color: var(--accent); text-decoration: none; }
.entry-more:hover { text-decoration: underline; }
.entry-noja { margin-top: 12px; font-size: 13px; color: var(--text-sub); }

/* リンク集 */
.links-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.link-card { display: block; text-decoration: none; color: inherit; transition: transform 0.15s ease; }
.link-card:hover { transform: translateY(-2px); }
.link-card .card-sub { word-break: break-all; }

.footer {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 22px 48px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-sub);
}
.footer a { color: inherit; }

/* フィルタバー */
.filter-bar { margin: 0 0 20px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-sub);
  font: inherit;
  font-size: 13px;
  padding: 5px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }
.date-range { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-sub); }
.date-range input {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
  margin-left: 4px;
}

.badge.client { background: rgba(255, 159, 10, 0.14); color: #e08700; }

/* ガイド変更履歴の構造化要約 */
.docs-overview { margin: 4px 0 8px; color: var(--text-sub); }
.docs-section { margin-top: 10px; }
.docs-area {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.docs-section ul { margin: 2px 0 0; }

/* メンテナンス要約 */
.maint-summary { color: var(--text) !important; }

/* メンテナンスカレンダー (JST) */
.cal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 0 0 24px;
}
.cal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cal-title { font-size: 15px; font-weight: 600; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-dows { margin-bottom: 4px; }
.cal-dow { text-align: center; font-size: 11px; color: var(--text-sub); }
.cal-day {
  min-height: 66px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  overflow: hidden;
}
.cal-day.is-empty { border: none; }
.cal-day.is-today { border-color: var(--accent); }
.cal-daynum { font-size: 11px; color: var(--text-sub); }
.cal-day.is-today .cal-daynum { color: var(--accent); font-weight: 700; }
.cal-chip {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.5;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 214, 10, 0.18);
  color: #b08c00;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-chip.in_progress { background: rgba(255, 159, 10, 0.25); color: #cc7a00; }
.cal-chip.completed { background: var(--bg); color: var(--text-sub); }
@media (prefers-color-scheme: dark) {
  .cal-chip { color: #ffd60a; }
  .cal-chip.in_progress { color: #ff9f0a; }
}
.flash { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ホームの統計カード */
.stats-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin: 20px 0 8px; }
.stat-card {
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: transform 0.15s ease;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-num { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.stat-label { font-size: 13px; color: var(--text-sub); }

/* コンパクトなフィード項目 (ホーム用) */
.entry.compact { padding: 14px 20px; }
.entry.compact .entry-title { font-size: 15px; margin: 6px 0 0; }
.view-all {
  align-self: flex-start;
  border: none;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  padding: 4px 2px;
  cursor: pointer;
}
.view-all:hover { text-decoration: underline; }

/* トースト */
.toast-area {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 40;
}
.toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 18px;
  font-size: 13px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  max-width: 320px;
  animation: toast-in 0.3s ease;
}
@keyframes toast-in {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
