/* ============================================================
   Groove Design System — Shared Stylesheet
   groove-ds.css
   すべてのDSページで読み込む共通スタイル
   ============================================================ */

/* ============================================================
   DS Top Navigation（ページ間リンク）
   ============================================================ */
.ds-topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 300;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 var(--space-24);
  height: 44px;
  overflow: visible;
}

.ds-topnav-brand {
  font-family: var(--font-en);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-blue);
  letter-spacing: -0.01em;
  white-space: nowrap;
  margin-right: var(--space-20);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.ds-topnav-brand-icon {
  width: 22px;
  height: 22px;
  background-color: var(--color-blue);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ds-topnav-divider {
  width: 1px;
  height: 20px;
  background: var(--color-border);
  margin: 0 var(--space-16);
  flex-shrink: 0;
}

.ds-topnav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.ds-topnav-links::-webkit-scrollbar { display: none; }
.ds-topnav-links::after {
  content: '';
  display: block;
  min-width: var(--space-8);
  flex-shrink: 0;
}

.ds-topnav-link {
  font-family: var(--font-ja);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}

.ds-topnav-link:hover {
  background-color: var(--color-bg-sunken);
  color: var(--color-text-primary);
}

.ds-topnav-link.active {
  background-color: var(--color-blue-light);
  color: var(--color-blue);
  font-weight: 600;
}

/* ダークモードトグル */
.ds-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  margin-left: var(--space-8);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ds-theme-toggle:hover {
  background: var(--color-bg-sunken);
  color: var(--color-text-primary);
}
.ds-theme-toggle svg {
  pointer-events: none;
}

/* キーカラーピッカー */
.ds-key-color-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}
.ds-key-color-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg-surface);
  cursor: pointer;
  flex-shrink: 0;
  margin-left: var(--space-4);
  transition: background 0.15s, border-color 0.15s;
  padding: 0;
}
.ds-key-color-btn:hover {
  background: var(--color-bg-sunken);
}
.key-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-blue);
  border: 2px solid rgba(0,0,0,0.12);
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}
.key-color-popover {
  position: fixed;
  top: 50px;
  right: 16px;
  width: 220px;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  padding: var(--space-16);
  z-index: 400;
  display: none;
}
.key-color-popover.open { display: block; }
.key-color-popover-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-12);
}
.key-color-presets {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 5px;
  margin-bottom: var(--space-12);
}
.key-color-preset {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s;
  outline: none;
}
.key-color-preset:hover { transform: scale(1.2); }
.key-color-preset.active {
  border-color: var(--color-text-primary);
  box-shadow: 0 0 0 1px var(--color-bg-surface);
}
.key-color-free-row {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  padding-top: var(--space-12);
  border-top: 1px solid var(--color-border);
}
.key-color-free-label {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  flex: 1;
}
.key-color-free-input {
  width: 36px;
  height: 26px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1px;
  cursor: pointer;
  background: none;
}
[data-theme="dark"] .key-color-popover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

/* ============================================================
   DS Page Shell（DSページ用のメインレイアウト）
   ============================================================ */

/* サイドバー付きレイアウト（非ダッシュボードのDSページ用） */
.ds-layout {
  display: flex;
  min-height: calc(100vh - var(--topnav-height));
}

.ds-sidebar {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: var(--topnav-height);
  height: calc(100vh - var(--topnav-height));
  overflow-y: auto;
  border-right: 1px solid var(--color-border);
  background: var(--color-bg-surface);
  padding: var(--space-24) var(--space-12);
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}
.ds-sidebar::-webkit-scrollbar { width: 4px; }
.ds-sidebar::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }

/* サイドバー内アンカーナビ */
.ds-anchor-nav-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  padding: var(--space-8) var(--space-8) var(--space-4);
  margin-top: var(--space-16);
}
.ds-anchor-nav-label:first-child { margin-top: 0; }

.ds-anchor-link {
  display: block;
  padding: 6px var(--space-8);
  font-size: var(--text-md);
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  line-height: 1.4;
}
.ds-anchor-link:hover {
  background: var(--color-bg-sunken);
  color: var(--color-text-primary);
}
.ds-anchor-link.active {
  background: var(--color-blue-light);
  color: var(--color-blue);
  border-left-color: var(--color-blue);
  font-weight: 600;
}

/* メインコンテンツエリア */
.ds-content {
  flex: 1;
  min-width: 0;
  padding: var(--space-48);
  max-width: 1440px;
}

/* 後方互換（旧 ds-page クラスも念のため保持） */
.ds-page {
  min-height: calc(100vh - 44px);
  padding: var(--space-48) clamp(24px, 4vw, 64px);
  max-width: 1200px;
  margin: 0 auto;
}

/* ページ先頭ヘッダー（全DSページ共通） */
.ds-page-header {
  margin-bottom: var(--space-48);
  padding: var(--space-32) 0;
  border-bottom: 1px solid var(--color-border);
}
.ds-page-header-tag {
  display: block;
  font-family: var(--font-en);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-blue);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  margin-bottom: var(--space-8);
}
.ds-page-header-title {
  font-family: var(--font-en);
  font-size: clamp(24px, 3.5vw, 36px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--color-text-primary);
  line-height: 1.2;
  margin-bottom: var(--space-12);
}
.ds-page-header-desc {
  font-size: var(--text-md);
  color: var(--color-text-secondary);
  line-height: 1.8;
  max-width: 600px;
}

/* 概要ページのみグラデーションヒーロー */
.ds-page-header--hero {
  padding: var(--space-40);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-lg);
  background-image: linear-gradient(135deg, var(--color-purple) 0%, var(--color-blue) 52%, var(--color-blue-muted) 100%);
}
.ds-page-header--hero .ds-page-header-tag {
  color: rgba(255, 255, 255, 0.7);
}
.ds-page-header--hero .ds-page-header-title {
  color: #ffffff;
  font-size: clamp(28px, 4vw, 40px);
}
.ds-page-header--hero .ds-page-header-desc {
  color: rgba(255, 255, 255, 0.82);
}

.ds-section {
  margin-bottom: var(--space-48);
}

.ds-section-title {
  font-family: var(--font-en);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
}

.ds-section-desc {
  font-size: var(--text-md);
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-24);
}

/* ============================================================
   Chip（選択可能なピル型ボタン）
   ============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  font-family: var(--font-ja);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: all 150ms ease;
  user-select: none;
  border: none;
  outline: none;
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
}

.chip:hover {
  background: var(--color-bg-sunken);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.10), 0 1px 3px rgba(0,0,0,0.06);
}

.chip.is-selected {
  background: var(--color-blue-light);
  color: var(--color-blue);
  box-shadow: 0 0 0 1.5px var(--color-blue), 0 0 0 3px var(--color-blue-muted);
}

.chip.is-selected:hover {
  background: var(--color-blue-icon-bg);
}

.chip:disabled,
.chip.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.chip-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Chipグループ（横並び） */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
}

/* ============================================================
   SegmentedControl（タブ型ラジオ）
   ============================================================ */
.segmented-control {
  display: inline-flex;
  background: var(--color-bg-sunken);
  border-radius: var(--radius-full);
  padding: 4px;
  gap: 2px;
  width: 100%;
}

.segmented-control-item {
  flex: 1;
  padding: 10px var(--space-16);
  border-radius: var(--radius-lg);
  font-family: var(--font-ja);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  text-align: center;
  cursor: pointer;
  transition: all 200ms ease;
  background: transparent;
  box-shadow: none;
  border: none;
  outline: none;
  white-space: nowrap;
}

.segmented-control-item:hover {
  color: var(--color-text-primary);
}

.segmented-control-item.is-active {
  background: var(--color-bg-surface);
  color: var(--color-blue);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
}

/* ============================================================
   Step Navigation
   ============================================================ */
.step-nav {
  display: flex;
  align-items: flex-start;
}

.step-nav-item {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
}

.step-nav-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  z-index: 1;
}

.step-nav-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  font-family: var(--font-en);
  transition: all 0.25s ease;
  flex-shrink: 0;
  /* pending (default) */
  border: 2px solid var(--color-border);
  background: var(--color-bg-surface);
  color: var(--color-text-tertiary);
}

.step-nav-circle.is-done {
  border-color: var(--color-blue);
  background: var(--color-blue);
  color: white;
}

.step-nav-circle.is-active {
  border-color: var(--color-blue);
  background: var(--color-blue);
  color: white;
  box-shadow: 0 0 0 4px var(--color-blue-light);
}

.step-nav-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-tertiary);
  margin-top: 8px;
  white-space: nowrap;
  font-family: var(--font-ja);
  letter-spacing: 0.01em;
  transition: color 0.25s ease;
}

.step-nav-label.is-active {
  color: var(--color-text-primary);
  font-weight: 700;
}

.step-nav-label.is-done {
  color: var(--color-text-secondary);
}

.step-nav-connector {
  flex: 1;
  height: 2px;
  background: var(--color-border);
  margin-bottom: 26px;
  transition: background 0.25s ease;
}

.step-nav-connector.is-done {
  background: var(--color-blue);
}

/* セクション白ボックス（全DSページ共通） */
.section-box {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-32);
}

/* セクション内デモエリア（section-box 内の個別デモブロック） */
.ds-demo-block {
  background: var(--color-bg-sunken);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-24);
  margin-top: var(--space-20);
}
.ds-demo-block + .ds-demo-block {
  margin-top: var(--space-12);
}

.ds-component-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: var(--space-8);
}

/* コンポーネントプレビュー枠 */
.ds-preview {
  background: var(--color-bg-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-32);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-16);
}

.ds-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-16);
  align-items: flex-start;
}

/* ============================================================
   Design Tokens
   ============================================================ */
:root {
  /* Color - Base */
  --color-bg-page: #f7f7f8;
  --color-bg-surface: #ffffff;
  --color-bg-sunken: #f2f2f4;
  --color-text-primary: #1a1b1e;
  --color-text-secondary: #57585f;
  --color-text-tertiary: #8a8b94;
  --color-border: #ebebee;

  /* Color - Primary (Blue) */
  --color-blue: #3b82f6;
  --color-blue-light: #eff6ff;
  --color-blue-muted: #93c5fd;
  --color-blue-icon-bg: #bfdbfe;

  /* Color - Accent */
  --color-purple: #a855f7;
  --color-purple-light: #faf5ff;
  --color-purple-icon-bg: #e9d5ff;
  --color-orange: #f97316;
  --color-orange-light: #fff7ed;
  --color-orange-icon-bg: #fed7aa;
  --color-green: #10b981;
  --color-green-light: #ecfdf5;
  --color-green-icon-bg: #a7f3d0;

  /* Color - Status */
  --color-success: #0d9e72;
  --color-success-dark: #0a7a59;
  --color-success-light: #ecfdf5;
  --color-warning: #d97706;
  --color-warning-light: #fffbeb;
  --color-danger: #dc2626;
  --color-danger-dark: #b91c1c;
  --color-danger-light: #fef2f2;
  --color-info: #3b82f6;
  --color-info-light: #eff6ff;

  /* Color - Hover states */
  --color-text-primary-hover: #2d2e34;
  --color-blue-hover: #2563eb;

  /* Typography */
  --font-ja: 'Noto Sans JP', sans-serif;
  --font-en: 'Plus Jakarta Sans', sans-serif;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 15px;
  --text-lg: 17px;
  --text-xl: 20px;
  --text-2xl: 24px;
  --text-3xl: 30px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-3xl: 24px;
  --radius-full: 9999px;

  /* Shadow */
  --shadow-xs: 0 1px 2px rgba(20,18,30,0.06);
  --shadow-sm: 0 2px 8px rgba(20,18,30,0.08), 0 1px 3px rgba(20,18,30,0.05);
  --shadow-md: 0 4px 16px rgba(20,18,30,0.10), 0 2px 6px rgba(20,18,30,0.05);
  --shadow-hover: 0 8px 24px rgba(20,18,30,0.12), 0 3px 8px rgba(20,18,30,0.06);

  /* Spacing */
  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  --space-32: 32px;
  --space-40: 40px;
  --space-48: 48px;

  /* Border */
  --border-width: 1px;

  /* DS Top Navigation — 本番環境では 0px に上書きする */
  --topnav-height: 44px;

  /* Dot pattern */
  --dot-color: rgba(20,18,30,0.12);
}

/* ============================================================
   Dark Mode Tokens
   ============================================================ */
[data-theme="dark"] {
  /* Dot pattern */
  --dot-color: rgba(255,255,255,0.06);

  /* Color - Base */
  --color-bg-page: #111214;
  --color-bg-surface: #1c1d21;
  --color-bg-sunken: #16171a;
  --color-text-primary: #f0f0f2;
  --color-text-secondary: #9a9ba5;
  --color-text-tertiary: #5e5f6a;
  --color-border: #2a2b31;

  /* Color - Primary (Blue) */
  --color-blue: #60a5fa;
  --color-blue-light: #1e2a40;
  --color-blue-muted: #3b82f6;
  --color-blue-icon-bg: #1e3a5f;

  /* Color - Accent */
  --color-purple: #c084fc;
  --color-purple-light: #2d1f40;
  --color-purple-icon-bg: #3b2060;
  --color-orange: #fb923c;
  --color-orange-light: #2d1f10;
  --color-orange-icon-bg: #4a2800;
  --color-green: #34d399;
  --color-green-light: #0f2820;
  --color-green-icon-bg: #0a3020;

  /* Color - Status */
  --color-success: #34d399;
  --color-success-dark: #10b981;
  --color-success-light: #0f2820;
  --color-warning: #fbbf24;
  --color-warning-light: #2d2010;
  --color-danger: #f87171;
  --color-danger-dark: #ef4444;
  --color-danger-light: #2d1010;
  --color-info: #60a5fa;
  --color-info-light: #1e2a40;

  /* Color - Hover states */
  --color-text-primary-hover: #d0d0d8;
  --color-blue-hover: #93c5fd;

  /* Shadow */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.3);
  --shadow-hover: 0 8px 24px rgba(0,0,0,0.6), 0 3px 8px rgba(0,0,0,0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Dot pattern */
    --dot-color: rgba(255,255,255,0.06);

    /* Color - Base */
    --color-bg-page: #111214;
    --color-bg-surface: #1c1d21;
    --color-bg-sunken: #16171a;
    --color-text-primary: #f0f0f2;
    --color-text-secondary: #9a9ba5;
    --color-text-tertiary: #5e5f6a;
    --color-border: #2a2b31;

    /* Color - Primary (Blue) */
    --color-blue: #60a5fa;
    --color-blue-light: #1e2a40;
    --color-blue-muted: #3b82f6;
    --color-blue-icon-bg: #1e3a5f;

    /* Color - Accent */
    --color-purple: #c084fc;
    --color-purple-light: #2d1f40;
    --color-purple-icon-bg: #3b2060;
    --color-orange: #fb923c;
    --color-orange-light: #2d1f10;
    --color-orange-icon-bg: #4a2800;
    --color-green: #34d399;
    --color-green-light: #0f2820;
    --color-green-icon-bg: #0a3020;

    /* Color - Status */
    --color-success: #34d399;
    --color-success-dark: #10b981;
    --color-success-light: #0f2820;
    --color-warning: #fbbf24;
    --color-warning-light: #2d2010;
    --color-danger: #f87171;
    --color-danger-dark: #ef4444;
    --color-danger-light: #2d1010;
    --color-info: #60a5fa;
    --color-info-light: #1e2a40;

    /* Color - Hover states */
    --color-text-primary-hover: #d0d0d8;
    --color-blue-hover: #93c5fd;

    /* Shadow */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.3);
    --shadow-hover: 0 8px 24px rgba(0,0,0,0.6), 0 3px 8px rgba(0,0,0,0.4);
  }
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topnav-height) + 20px); /* fixed topnav + 余白 */
}

body {
  padding-top: var(--topnav-height); /* fixed DS topnav の高さ分オフセット */
  font-family: var(--font-ja);
  background-color: var(--color-bg-page);
  background-image: radial-gradient(circle, var(--dot-color) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--color-text-primary);
  font-size: var(--text-md);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   Layout
   ============================================================ */
.layout {
  display: flex;
  min-height: calc(100vh - var(--topnav-height));
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background-color: var(--color-bg-surface);
  border-right: var(--border-width) solid var(--color-border);
  position: sticky;
  top: var(--topnav-height);
  height: calc(100vh - var(--topnav-height));
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: width 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-surface);
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 30, 0.45);
  z-index: 199;
  transition: opacity 0.25s ease;
}
body.sidebar-open .sidebar-overlay {
  display: block;
}

.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--color-bg-sunken);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: auto;
}

.sidebar-logo {
  padding: var(--space-24) var(--space-20);
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.sidebar-logo-icon {
  width: 28px;
  height: 28px;
  background-color: var(--color-bg-sunken);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-family: var(--font-en);
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ロゴ画像プレースホルダー */
.sidebar-logo-img-frame {
  flex: 1;
  min-width: 0;
  height: 64px;
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-sunken);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--color-text-tertiary);
  font-size: 10px;
  font-family: var(--font-en);
  letter-spacing: 0.04em;
  overflow: hidden;
}
.sidebar-logo-img-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.sidebar-logo-img-frame svg {
  flex-shrink: 0;
  opacity: 0.5;
}

/* サイトIDバッジ（プレイスホルダー表示） */
.sidebar-site-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: var(--color-bg-sunken);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-family: var(--font-en);
  letter-spacing: 0.02em;
  margin-top: 4px;
}

.sidebar-nav {
  padding: var(--space-8) var(--space-12);
  flex: 1;
}

.nav-section-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: var(--space-16) var(--space-8) var(--space-8);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  padding: 10px var(--space-12);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--text-md);
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: background-color 0.15s ease, color 0.15s ease;
  position: relative;
  margin-bottom: 2px;
  text-decoration: none;
}

.nav-item:hover {
  background-color: var(--color-bg-sunken);
  color: var(--color-text-primary);
}

.nav-item.active {
  background-color: var(--color-blue-light);
  color: var(--color-blue);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background-color: var(--color-blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: var(--space-12) var(--space-12) var(--space-16);
  border-top: var(--border-width) solid var(--color-border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  padding: var(--space-8);
  border-radius: var(--radius-md);
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background-color: var(--color-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-en);
  font-size: var(--text-sm);
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.sidebar-user-info {
  min-width: 0;
}

.sidebar-user-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

/* サイドバー フッターアクション行 */
.sidebar-footer-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

/* ============================================================
   Sidebar Dark（管理画面・アプリ専用モード）
   .sidebar--dark を .sidebar に追加するだけで適用
   ============================================================ */
.sidebar--dark {
  background-color: #1e2535;
  border-right-color: rgba(255,255,255,0.07);
}

/* ロゴ */
.sidebar--dark .sidebar-logo {
  border-bottom-color: rgba(255,255,255,0.07);
}
.sidebar--dark .sidebar-logo-text {
  color: rgba(255,255,255,0.92);
}
.sidebar--dark .sidebar-logo-img-frame {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.45);
}

/* ナビゲーション */
.sidebar--dark .nav-section-label {
  color: rgba(255,255,255,0.32);
}

.sidebar--dark .nav-item {
  color: rgba(255,255,255,0.6);
}
.sidebar--dark .nav-item:hover {
  background-color: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.92);
}
.sidebar--dark .nav-item.active {
  background-color: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.95);
}
.sidebar--dark .nav-item.active::before {
  background-color: var(--color-blue);
}

/* フッター */
.sidebar--dark .sidebar-footer {
  border-top-color: rgba(255,255,255,0.07);
}
.sidebar--dark .sidebar-user-name {
  color: rgba(255,255,255,0.85);
}
.sidebar--dark .sidebar-user-role {
  color: rgba(255,255,255,0.38);
}
.sidebar--dark .sidebar-close-btn {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.6);
}

/* ============================================================
   Main Content
   ============================================================ */
.main {
  flex: 1;
  min-width: 0;
  max-width: 1360px;
  padding: var(--space-32) clamp(24px, 3vw, 48px);
}

/* ============================================================
   Header
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-32);
}

.page-header-left h1 {
  font-family: var(--font-en);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-header-date {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  margin-top: var(--space-4);
}

.page-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-12);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: var(--border-width) solid var(--color-border);
  background-color: var(--color-bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-secondary);
  transition: background-color 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.icon-btn:hover {
  background-color: var(--color-bg-sunken);
  border-color: var(--color-blue-muted);
}

.notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background-color: var(--color-danger);
  border-radius: var(--radius-full);
  border: 2px solid var(--color-bg-surface);
}

.header-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background-color: var(--color-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-en);
  font-size: var(--text-sm);
  font-weight: 700;
  color: white;
  cursor: pointer;
  border: 2px solid var(--color-bg-surface);
  box-shadow: var(--shadow-xs);
}

/* ============================================================
   Card
   ============================================================ */
.card {
  background-color: var(--color-bg-surface);
  border-radius: var(--radius-2xl);
  padding: var(--space-24);
  box-shadow: var(--shadow-sm);
}

.card-radius-xl {
  border-radius: var(--radius-xl);
}

/* ============================================================
   KPI Cards
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-20);
  margin-bottom: var(--space-24);
}

.kpi-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-16);
}

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  font-weight: 500;
}

.kpi-value {
  font-family: var(--font-en);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: var(--space-8);
  font-feature-settings: "tnum", "lnum";
}

.kpi-full-chart {
  margin: var(--space-12) calc(-1 * var(--space-24)) calc(-1 * var(--space-24));
  border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
  overflow: hidden;
  line-height: 0;
}

.kpi-trend {
  font-size: var(--text-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.trend-up { color: var(--color-success); }
.trend-down { color: var(--color-danger); }
.trend-flat { color: var(--color-text-secondary); }

/* ============================================================
   Alert Banner
   ============================================================ */
.alert-banner {
  background-color: var(--color-orange-light);
  border: var(--border-width) solid var(--color-orange-icon-bg);
  border-radius: var(--radius-md);
  padding: var(--space-12) var(--space-16);
  display: flex;
  align-items: center;
  gap: var(--space-12);
  margin-bottom: var(--space-24);
  animation: slideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert-icon {
  flex-shrink: 0;
  color: var(--color-orange);
}

.alert-text {
  flex: 1;
  font-size: var(--text-md);
  color: var(--color-text-primary);
  line-height: 1.5;
}

.alert-pill {
  display: inline-flex;
  align-items: center;
  background-color: var(--color-orange-icon-bg);
  color: var(--color-orange);
  font-size: var(--text-sm);
  font-weight: 700;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  margin: 0 4px;
}

.alert-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-orange);
  border: var(--border-width) solid var(--color-orange);
  background: transparent;
  border-radius: var(--radius-full);
  padding: 5px 14px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.alert-btn:hover {
  background-color: var(--color-orange);
  color: white;
}

/* ============================================================
   2-Column Layout
   ============================================================ */
.two-col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-20);
  margin-bottom: var(--space-24);
}

/* ============================================================
   Chart Card
   ============================================================ */
.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-24);
}

.chart-card-title {
  font-family: var(--font-en);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

.chart-period-label {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  background-color: var(--color-bg-sunken);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-weight: 500;
}

.chart-wrap {
  width: 100%;
  overflow: visible;
}

/* ============================================================
   Activity Card
   ============================================================ */
.activity-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-20);
}

.activity-card-title {
  font-family: var(--font-en);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

.activity-list {
  list-style: none;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-12);
  padding: 12px 0;
}

.activity-item:not(:last-child) {
  border-bottom: var(--border-width) solid var(--color-border);
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--color-blue);
  flex-shrink: 0;
  margin-top: 7px;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-text {
  font-size: var(--text-md);
  color: var(--color-text-primary);
  line-height: 1.5;
}

.activity-time {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

/* ============================================================
   Table Card
   ============================================================ */
.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-20);
}

.table-card-title {
  font-family: var(--font-en);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
}

.link-btn {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-blue);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s ease;
}

.link-btn:hover {
  color: var(--color-text-primary);
}

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

.data-table thead tr {
  background-color: var(--color-bg-sunken);
}

.data-table th {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  text-align: left;
  padding: 12px 16px;
  white-space: nowrap;
}

.data-table th:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.data-table th:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.data-table td {
  padding: 0 16px;
  font-size: var(--text-md);
  color: var(--color-text-primary);
  height: 56px;
  border-bottom: var(--border-width) solid var(--color-border);
  vertical-align: middle;
}

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

.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
  background-color: var(--color-bg-sunken);
}

.cell-main     { font-weight: 500; }
.cell-secondary { color: var(--color-text-secondary); }
.cell-amount   { font-family: var(--font-en); font-feature-settings: "tnum","lnum"; font-weight: 600; }
.cell-deadline { font-size: var(--text-sm); color: var(--color-text-secondary); }

/* ============================================================
   Badge
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.badge-info    { background-color: var(--color-blue-icon-bg);   color: var(--color-blue); }
.badge-info    .badge-dot { background-color: var(--color-blue); }
.badge-warning { background-color: var(--color-orange-icon-bg); color: var(--color-orange); }
.badge-warning .badge-dot { background-color: var(--color-orange); }
.badge-purple  { background-color: var(--color-purple-icon-bg); color: var(--color-purple); }
.badge-purple  .badge-dot { background-color: var(--color-purple); }
.badge-success { background-color: var(--color-green-icon-bg);  color: var(--color-green); }
.badge-success .badge-dot { background-color: var(--color-green); }
.badge-neutral { background-color: #f3f4f6; color: #6b7280; }
.badge-neutral .badge-dot { background-color: #6b7280; }

/* ============================================================
   Utility
   ============================================================ */
.mt-24 { margin-top: var(--space-24); }
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ============================================================
   Welcome Card
   ============================================================ */
.welcome-card {
  background:
    radial-gradient(ellipse 58% 80% at 86% 28%, rgba(168,85,247,0.14) 0%, transparent 70%),
    radial-gradient(ellipse 48% 60% at 96% 86%, rgba(16,185,129,0.11) 0%, transparent 65%),
    radial-gradient(ellipse 52% 48% at 68% 4%, rgba(59,130,246,0.10) 0%, transparent 65%),
    radial-gradient(ellipse 38% 52% at 100% 54%, rgba(249,115,22,0.08) 0%, transparent 60%),
    #ffffff;
  border-radius: var(--radius-2xl);
  padding: var(--space-32);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-24);
  margin-bottom: var(--space-24);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.welcome-text { flex: 1; min-width: 0; }

.welcome-greeting {
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-4);
}

.welcome-name {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: var(--space-8);
}

.welcome-desc {
  font-size: var(--text-md);
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-20);
}

.welcome-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-blue);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}

.welcome-btn:hover {
  background: var(--color-blue-hover);
  transform: translateY(-1px);
}

.welcome-illo { flex-shrink: 0; }

@media (max-width: 900px) {
  .welcome-illo { display: none; }
}

/* ============================================================
   Kanban Board
   ============================================================ */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-16);
  margin-bottom: var(--space-24);
  overflow-x: auto;
}

.kanban-col { min-width: 200px; }

.kanban-header {
  border-radius: var(--radius-xl);
  padding: var(--space-16) var(--space-16) var(--space-12);
  margin-bottom: var(--space-12);
}

.kanban-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.kanban-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.kanban-count {
  font-size: var(--text-md);
  font-weight: 500;
  opacity: 0.75;
  margin-left: 4px;
}

.kanban-sub {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.72);
  line-height: 1.4;
}

.kanban-menu-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: var(--radius-sm);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

.kanban-menu-btn:hover { background: rgba(255,255,255,0.32); }

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.kanban-card {
  background: var(--color-bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-12) var(--space-16);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: box-shadow 0.2s cubic-bezier(0.16,1,0.3,1), transform 0.2s cubic-bezier(0.16,1,0.3,1);
}

.kanban-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.kanban-card-add {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  background: var(--color-bg-sunken);
  border-style: dashed;
  cursor: default;
}

.kanban-tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-8);
}

.kanban-card-title {
  font-size: var(--text-md);
  color: var(--color-text-primary);
  line-height: 1.5;
  font-weight: 500;
}

/* ============================================================
   Responsive
   ============================================================ */

/* タブレット横（〜1200px） */
@media (max-width: 1200px) {
  .sidebar { width: 64px; }
  .nav-label,
  .nav-section-label,
  .sidebar-user-info { display: none; }
  .sidebar-logo { justify-content: center; padding: var(--space-20) 0; }
  .sidebar-logo-img-frame { width: 40px; height: 40px; font-size: 0; gap: 0; border-radius: var(--radius-sm); }
  .sidebar-logo-img-frame svg { opacity: 0.4; }
  .nav-item { justify-content: center; padding: 10px 0; }
  .nav-item::before { display: none; }
  .sidebar-footer { padding: var(--space-12) 0; }
  .sidebar-user { justify-content: center; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* タブレット縦（〜900px） */
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .main { padding: var(--space-24) var(--space-20); }
  .kanban-board { grid-template-columns: repeat(2, 1fr); }
}

/* モバイル（〜640px） */
@media (max-width: 640px) {
  .sidebar {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 260px;
    height: 100%;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-hover);
    flex-shrink: unset;
  }
  body.sidebar-open .sidebar {
    display: flex;
    transform: translateX(0);
  }
  body.sidebar-open .sidebar .sidebar-logo-img-frame { width: auto; font-size: 10px; gap: 5px; }
  body.sidebar-open .sidebar .nav-label,
  body.sidebar-open .sidebar .nav-section-label,
  body.sidebar-open .sidebar .sidebar-user-info { display: block !important; }
  body.sidebar-open .sidebar .nav-item { justify-content: flex-start !important; padding: 10px 12px !important; }
  body.sidebar-open .sidebar .sidebar-logo { justify-content: flex-start !important; padding: var(--space-24) var(--space-20) !important; }
  body.sidebar-open .sidebar .sidebar-user { justify-content: flex-start !important; }
  .hamburger-btn { display: flex; }
  .sidebar-close-btn { display: flex; }
  .kpi-grid { grid-template-columns: 1fr; gap: var(--space-12); }
  .main { padding: var(--space-16); }
  .page-header { flex-direction: row; gap: var(--space-12); align-items: center; }
  .page-header-left h1 { font-size: var(--text-xl); }
  .table-wrapper { overflow-x: auto; }
  table { min-width: 640px; }
  .kanban-board { grid-template-columns: repeat(2, minmax(200px, 1fr)); }

  /* DS top nav on mobile */
  .ds-topnav { padding: 0 var(--space-16); }
}
