/* CSS変数 */
:root {
    --color-primary: #1976d2;
    --color-primary-dark: #1565c0;
    --color-primary-light: #e3f2fd;
    --color-success: #2e7d32;
    --color-success-light: #e8f5e9;
    --color-warning: #e65100;
    --color-warning-light: #fff3e0;
    --color-danger: #c62828;
    --color-danger-light: #ffebee;
    --color-accent: #f39c12;
    --color-nav: #1a1a2e;
    --color-bg: #f5f7fa;
    --color-card: #fff;
    --color-border: #e0e0e0;
    --color-border-light: #f0f0f0;
    --color-text: #333;
    --color-text-secondary: #666;
    --color-text-muted: #999;
    --font-base: 15px;
    --font-sm: 13px;
    --font-xs: 12px;
    --font-lg: 18px;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow: 0 1px 4px rgba(0,0,0,.08);
    --shadow-md: 0 3px 10px rgba(0,0,0,.12);

    /* Phase 1-3 統一カラー */
    --color-blue: #4a90d9;
    --color-cyan: #5dade2;
    --color-green: #27ae60;
    --color-green-light: #2ecc71;
    --color-orange: #f39c12;
    --color-red: #e74c3c;
    --color-purple: #8e44ad;
    --color-navy: #2c3e50;
    --color-light-blue: #d4e6f9;
    --color-gray: #95a5a6;
}

/* ベース */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
    font-size: var(--font-base);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

/* ナビバー */
.navbar {
    background: #1a1a2e;
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 24px;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
    gap: 8px;
}
.nav-brand {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    margin-right: 16px;
    white-space: nowrap;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}
.nav-links > a.nav-item {
    color: #ccc;
    text-decoration: none;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background .2s, color .2s;
    white-space: nowrap;
}
.nav-links > a.nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,.1);
}

/* ドロップダウン */
.nav-dropdown {
    position: relative;
}
.nav-dropdown-btn {
    background: none;
    border: none;
    color: #ccc;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .2s, color .2s;
    white-space: nowrap;
    font-family: inherit;
}
.nav-dropdown-btn:hover,
.nav-dropdown:hover .nav-dropdown-btn {
    color: #fff;
    background: rgba(255,255,255,.1);
}
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #252547;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    min-width: 180px;
    padding: 6px 0;
    margin-top: 0;
    padding-top: 10px;
    z-index: 200;
}
.nav-dropdown:hover .nav-dropdown-menu {
    display: block;
}
.nav-dropdown-menu a {
    display: block;
    color: #ccc;
    text-decoration: none;
    padding: 10px 16px;
    font-size: 13px;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.nav-dropdown-menu a:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}

/* ハンバーガー（モバイル） */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    margin-left: auto;
}

/* アクティブページ */
.nav-active {
    color: #fff !important;
    background: rgba(255,255,255,.12);
}
.nav-dropdown-menu .nav-active {
    border-left: 3px solid #6c63ff;
    padding-left: 13px;
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: #1a1a2e;
        flex-direction: column;
        padding: 8px 16px 16px;
        gap: 2px;
        box-shadow: 0 4px 12px rgba(0,0,0,.3);
    }
    .nav-links.open { display: flex; }
    .nav-hamburger { display: block; }
    .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        margin-top: 0;
        padding-left: 16px;
        background: transparent;
    }
    .nav-dropdown:hover .nav-dropdown-menu { display: none; }
    .nav-dropdown.open .nav-dropdown-menu { display: block; }
    .nav-dropdown-btn { width: 100%; text-align: left; }
}

/* コンテナ */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }

/* ページヘッダー */
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 22px; margin-bottom: 4px; }
.page-header p { color: #666; }
.site-url { font-size: 12px; color: var(--color-primary); word-break: break-all; }

/* カード */
.card {
    background: var(--color-card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.card h2 { font-size: 16px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* フォーム */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
.form-group.full-width { grid-column: 1 / -1; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color .2s;
}
.form-control:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(25,118,210,.15); }
.hint { font-size: 12px; color: #888; margin-top: 4px; }
.required { color: #e74c3c; }
textarea.form-control { resize: vertical; font-family: inherit; }
.email-body { font-size: 13px; }

/* ボタン */
.btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all .2s;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); }
.btn-secondary { background: #f0f2f5; color: #333; }
.btn-secondary:hover:not(:disabled) { background: #e0e4ea; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* 進捗バー */
.progress-bar-container {
    background: #eee;
    border-radius: 999px;
    height: 16px;
    overflow: hidden;
    margin: 12px 0;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), #64b5f6);
    border-radius: 999px;
    width: 0%;
    transition: width .4s ease;
}
.progress-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
#progress-text { font-size: 14px; font-weight: 600; }
.progress-eta { font-size: 13px; color: #888; }
.current-url { font-size: 11px; color: #888; margin-top: 4px; word-break: break-all; }
.current-url a { color: var(--color-primary); text-decoration: none; }
.current-url a:hover { text-decoration: underline; }

/* テーブル */
.table-card { padding: 0; overflow: hidden; }
.table-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    flex-wrap: wrap;
}
.filter-input { max-width: 280px; }
.table-summary { font-size: 13px; color: #666; margin-left: auto; }
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
    background: #f8f9fb;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #eee;
    white-space: nowrap;
}
.table td { padding: 10px 14px; border-bottom: 1px solid #f2f2f2; vertical-align: middle; }
.table tr:hover td { background: #fafbff; }

/* スコアバッジ */
.score-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}
.score-high { background: #fde8e8; color: #c0392b; }
.score-mid  { background: #fef3cd; color: #e67e22; }
.score-low  { background: #e8f5e9; color: #27ae60; }

/* バッジ */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.badge-ok { background: #d4edda; color: #155724; }
.badge-ng { background: #f8d7da; color: #721c24; }
.badge-unknown { background: #e9ecef; color: #6c757d; }
.badge-new { background: #cce5ff; color: #004085; }
.badge-analyzing { background: #fff3cd; color: #856404; }
.badge-analyzed { background: #d4edda; color: #155724; }
.badge-email_generated { background: #d1ecf1; color: #0c5460; }
.badge-sent { background: #c3e6cb; color: #155724; }
.badge-replied { background: #d4edda; color: #155724; }
.badge-error { background: #f8d7da; color: #721c24; }
.badge-meeting { background: #e8f0fe; color: #2271b1; }
.badge-closed { background: #d5f5e3; color: #0e6b31; }
.badge-excluded { background: #e9ecef; color: #6c757d; }
.badge-pending { background: #e2e3e5; color: #383d41; }
.badge-running { background: #fff3cd; color: #856404; }
.badge-completed { background: #d4edda; color: #155724; }
.badge-failed { background: #f8d7da; color: #721c24; }

/* ドメインセル */
.domain-cell { display: flex; flex-direction: column; gap: 2px; }
.domain-link { color: var(--color-primary); text-decoration: none; font-weight: 600; }
.domain-link:hover { text-decoration: underline; }
.site-title { font-size: 11px; color: #888; }

.text-warning { color: #e67e22; font-weight: 600; }

/* 詳細画面グリッド */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 900px) {
    .detail-grid { grid-template-columns: 1fr; }
}

/* 分析アイテム */
.analysis-items { display: flex; flex-direction: column; gap: 8px; }
.analysis-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #f8f9fa;
}
.analysis-item.problem { background: #fef8f8; border-left: 3px solid #e74c3c; }
.analysis-item.ok { background: #f0faf5; border-left: 3px solid #27ae60; }
.analysis-item.neutral { background: #f8f9fa; border-left: 3px solid #aaa; }
.item-icon { font-size: 18px; flex-shrink: 0; }
.item-content { flex: 1; }
.item-label { font-weight: 600; font-size: 13px; }
.item-value { font-size: 13px; color: #555; margin-top: 2px; }
.score-chip {
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    flex-shrink: 0;
    align-self: center;
}

/* 連絡先 */
.contact-info { display: flex; flex-direction: column; gap: 10px; }
.contact-item { display: flex; flex-direction: column; gap: 3px; }
.contact-label { font-weight: 600; font-size: 13px; color: #555; }
.contact-value a { color: var(--color-primary); text-decoration: none; }
.contact-value a:hover { text-decoration: underline; }

/* メールアクション */
.email-actions { margin-bottom: 16px; }
.email-send-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* アラート */
.alert {
    padding: 10px 14px;
    border-radius: 6px;
    margin-top: 12px;
    font-size: 13px;
}
.alert-success { background: #d4edda; color: #155724; }
.alert-error { background: #f8d7da; color: #721c24; }
.alert-warning { background: #fff3cd; color: #856404; }
.hidden { display: none !important; }

/* フィルターセクション (index.html 検索画面) */
.filter-section {
    background: #f8f9fb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    border: 1px solid #e8eaed;
}
.filter-section-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 10px;
    color: #444;
}
.filter-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.filter-row:last-child { margin-bottom: 0; }
.filter-label {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    white-space: nowrap;
}
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.checkbox-label input[type="checkbox"] {
    accent-color: var(--color-primary);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* コストプレビュー (index.html) */
.cost-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f0f7ff;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #555;
    flex-wrap: wrap;
}
.cost-label { font-weight: 600; color: #333; }
.cost-sep { color: #ccc; }

/* コストチップ (ジョブ一覧テーブル) */
.cost-chip {
    display: inline-block;
    background: #e8f4fd;
    color: #2c7be5;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* コストバー (leads.html) */
.cost-bar {
    background: #f0f7ff;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    color: #555;
    margin-bottom: 20px;
    border: 1px solid #d4e6f9;
}

/* フィルタートグルグループ (leads.html) */
.filter-toggle-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.filter-toggle {
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 12px;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.filter-toggle:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.filter-toggle.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.filter-clear {
    color: #999;
    border-color: #eee;
}
.filter-clear:hover {
    color: #e74c3c;
    border-color: #e74c3c;
    background: #fef8f8;
}

/* CMSバッジ (leads.html) */
.cms-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #e9ecef;
    color: #555;
}
.cms-WordPress { background: #e8f0fe; color: #2271b1; }
.cms-Wix { background: #fff0e6; color: #e67e22; }
.cms-Jimdo { background: #e8f5e9; color: #2e7d32; }
.cms-Shopify { background: #f3e8fd; color: #7b2ea0; }
.cms-STUDIO { background: #e3f2fd; color: #1565c0; }
.cms-ver { font-size: 10px; color: #999; }

/* 空状態 */
.empty-state { text-align: center; padding: 40px; }
.empty-state p { font-size: 16px; color: #888; margin-bottom: 16px; }

/* リンク一覧ページ */
.page-desc { color: #666; margin-bottom: 24px; }

.links-section { margin-bottom: 32px; }
.links-section h2 {
    font-size: 17px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-primary);
    color: #1a1a2e;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.link-card {
    background: #fff;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s;
}
.link-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.12); }

.link-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.link-card-header h3 { font-size: 15px; }
.link-card-header h3 a {
    color: var(--color-primary);
    text-decoration: none;
}
.link-card-header h3 a:hover { text-decoration: underline; }

.link-card p {
    font-size: 13px;
    color: #555;
    flex: 1;
    line-height: 1.7;
}

.link-card-footer {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}
.link-card-footer a {
    font-size: 12px;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}
.link-card-footer a:hover { text-decoration: underline; }

.badge-api { background: #fde8e8; color: #c0392b; }
.badge-service { background: #d1ecf1; color: #0c5460; }
.badge-optional { background: #e9ecef; color: #6c757d; }
.badge-lib { background: #e8f0fe; color: #2271b1; }

/* 標準ライブラリテーブル */
.std-lib-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.std-lib-table th {
    background: #f8f9fb;
    padding: 10px 16px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #eee;
}
.std-lib-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #f2f2f2;
}
.std-lib-table tr:last-child td { border-bottom: none; }
.std-lib-table tr:hover td { background: #fafbff; }

/* ロードマップページ */
.roadmap-phase {
    background: #fff;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    overflow: hidden;
}

.phase-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    gap: 12px;
    flex-wrap: wrap;
}
.phase-header.phase-high { background: #fef8f8; border-left: 4px solid #e74c3c; }
.phase-header.phase-mid { background: #fef9f0; border-left: 4px solid #e67e22; }
.phase-header.phase-low { background: #f0faf5; border-left: 4px solid #27ae60; }

.phase-title { display: flex; align-items: center; gap: 12px; }
.phase-title h2 { font-size: 16px; margin: 0; }
.phase-number {
    background: #1a1a2e;
    color: #fff;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.phase-priority {
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
}
.priority-high { background: #fde8e8; color: #c0392b; }
.priority-mid { background: #fef3cd; color: #e67e22; }
.priority-low { background: #d4edda; color: #27ae60; }

.phase-body { padding: 16px 20px; }
.phase-desc { font-size: 13px; color: #555; margin-bottom: 16px; line-height: 1.7; }

.phase-tasks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.task-group {
    background: #f8f9fb;
    border-radius: 8px;
    padding: 14px;
}
.task-group h4 {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}
.task-group ul {
    list-style: none;
    padding: 0;
}
.task-group li {
    font-size: 12px;
    color: #555;
    padding: 4px 0 4px 18px;
    position: relative;
    line-height: 1.6;
}
.task-group li::before {
    content: "○";
    position: absolute;
    left: 0;
    color: #aaa;
    font-size: 11px;
}

/* スクリーンショット */
.screenshot-card { margin-bottom: 20px; }
.screenshot-grid {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
}
.screenshot-item {
    flex: 1;
    min-width: 200px;
}
.screenshot-item.screenshot-mobile {
    flex: 0 0 200px;
}
.screenshot-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}
.screenshot-img {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
    transition: box-shadow .2s;
}
.screenshot-img:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.screenshot-empty {
    text-align: center;
    padding: 30px;
    color: #888;
    font-size: 13px;
    width: 100%;
}

/* ========================================
   Phase 3: フォローアップ
   ======================================== */

/* タイムライン */
.followup-timeline {
    display: flex;
    flex-direction: column;
    margin-top: 16px;
}
.timeline-item {
    display: flex;
    gap: 12px;
    padding: 12px 0 12px 20px;
    border-left: 2px solid #ddd;
    margin-left: 12px;
    position: relative;
}
.timeline-item:last-child { border-left-color: transparent; }
.timeline-item.timeline-sent { border-left-color: #27ae60; }
.timeline-item.timeline-pending,
.timeline-item.timeline-ready { border-left-color: var(--color-primary); }
.timeline-item.timeline-generating { border-left-color: #f39c12; }
.timeline-item.timeline-error { border-left-color: #e74c3c; }

.timeline-marker {
    position: absolute;
    left: -11px;
    width: 22px;
    height: 22px;
    text-align: center;
    font-size: 14px;
    background: #fff;
    line-height: 22px;
}
.timeline-content { flex: 1; }
.timeline-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 13px;
}
.timeline-date { font-size: 12px; color: #888; }
.timeline-subject { font-size: 12px; color: #555; margin-top: 4px; }
.timeline-error { font-size: 12px; color: #e74c3c; margin-top: 4px; }
.timeline-actions { display: flex; gap: 8px; margin-top: 8px; }

/* フォローアップバッジ */
.badge-pending { background: #e9ecef; color: #6c757d; }
.badge-generating { background: #fff3cd; color: #856404; }
.badge-ready { background: #d1ecf1; color: #0c5460; }
.badge-sent { background: #d4edda; color: #155724; }
.badge-cancelled { background: #e9ecef; color: #6c757d; }
.badge-error { background: #f8d7da; color: #721c24; }
.badge-active { background: #d4edda; color: #155724; }
.badge-paused { background: #fff3cd; color: #856404; }
.badge-completed { background: #d1ecf1; color: #0c5460; }
.badge-stopped { background: #e9ecef; color: #6c757d; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.followup-actions-inline {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}
.followup-reply-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}
.hint {
    font-size: 12px;
    color: #888;
    margin-top: 8px;
}

/* フォローアップ管理ページ */
.stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    flex: 1;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    border-top: 3px solid #ddd;
}
.stat-card.stat-active { border-top-color: #27ae60; }
.stat-card.stat-paused { border-top-color: #f39c12; }
.stat-card.stat-completed { border-top-color: var(--color-primary); }
.stat-card.stat-stopped { border-top-color: #95a5a6; }

.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: #333;
}
.stat-label {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

/* プログレスバー（ミニ） */
.progress-bar-mini {
    display: inline-block;
    width: 60px;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    vertical-align: middle;
    margin-right: 6px;
}
.progress-fill {
    height: 100%;
    background: #27ae60;
    border-radius: 3px;
}
.progress-text {
    font-size: 12px;
    color: #666;
}

.empty-message {
    text-align: center;
    color: #888;
    padding: 40px;
}

/* アラート追加スタイル */
.alert-info { background: #d1ecf1; color: #0c5460; }
.alert-secondary { background: #e9ecef; color: #6c757d; }

/* ========================================
   Phase 4: 競合比較分析
   ======================================== */

.comp-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 13px;
}
.comp-table th {
    background: #f8f9fa;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
}
.comp-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
}
.comp-table tr.comp-gap {
    background: #fff8f0;
}
.comp-table tr.comp-gap td:first-child {
    font-weight: 600;
}

.comp-details {
    margin-top: 12px;
    font-size: 13px;
}
.comp-details summary {
    cursor: pointer;
    color: var(--color-primary);
    font-weight: 500;
}
.comp-list {
    list-style: none;
    padding: 8px 0;
}
.comp-list li {
    padding: 4px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.comp-list li a {
    color: #333;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70%;
}
.comp-list li a:hover { color: var(--color-primary); }
.comp-tags {
    font-size: 12px;
    color: #666;
}
.competitor-info {
    margin-top: 4px;
}
.competitor-actions {
    display: flex;
    gap: 8px;
}

/* ========================================
   Phase 5: スマートスコアリング
   ======================================== */

/* 成約期待度ランクバッジ */
.rank-badge {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    border-radius: 6px;
    font-weight: 800;
    font-size: 14px;
    color: #fff;
    margin-left: 8px;
    vertical-align: middle;
}
.rank-S { background: linear-gradient(135deg, #f39c12, #e67e22); }
.rank-A { background: linear-gradient(135deg, #27ae60, #2ecc71); }
.rank-B { background: linear-gradient(135deg, var(--color-primary), #5dade2); }
.rank-C { background: linear-gradient(135deg, #95a5a6, #bdc3c7); }

/* ========================================
   Phase 6: ダッシュボード強化
   ======================================== */

/* 6列KPIカード行 */
.stats-row-6 {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
@media (max-width: 1000px) {
    .stats-row-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
    .stats-row-6 { grid-template-columns: repeat(2, 1fr); }
}

/* KPIカードのボーダー色 */
.stat-card.stat-leads { border-top: 3px solid var(--color-primary); }
.stat-card.stat-sent-kpi { border-top: 3px solid #5dade2; }
.stat-card.stat-reply-rate { border-top: 3px solid #27ae60; }
.stat-card.stat-meeting { border-top: 3px solid #f39c12; }
.stat-card.stat-closed-kpi { border-top: 3px solid #2ecc71; }
.stat-card.stat-revenue { border-top: 3px solid #e74c3c; }

/* ダッシュボード2カラムグリッド */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
@media (max-width: 900px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* チャートコンテナ */
.chart-container {
    position: relative;
    width: 100%;
    min-height: 250px;
}
.chart-container.chart-funnel {
    min-height: 200px;
    max-height: 280px;
}
.chart-container.chart-wide {
    min-height: 300px;
}

/* チャートカード */
.dashboard-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    margin-bottom: 20px;
}
.dashboard-card h2 {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin: 0 0 16px 0;
}

/* レポート切替ボタン */
.report-toggle {
    display: inline-flex;
    gap: 4px;
    background: #f0f0f0;
    border-radius: 6px;
    padding: 2px;
}
.report-toggle button {
    border: none;
    background: transparent;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #666;
    transition: all 0.2s;
}
.report-toggle button.active {
    background: #fff;
    color: #333;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

/* データなしメッセージ */
.no-data-message {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 14px;
}

/* ========================================
   Phase 7: ポートフォリオ
   ======================================== */

/* ポートフォリオ管理ページ: グリッド */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

/* ポートフォリオカード */
.portfolio-card {
    background: #fff;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    transition: box-shadow .2s;
    border-left: 3px solid var(--color-primary);
}
.portfolio-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.portfolio-card.portfolio-inactive {
    opacity: .6;
    border-left-color: #ccc;
}

.portfolio-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}
.portfolio-card-header h3 { font-size: 15px; font-weight: 700; }

.portfolio-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.badge-industry {
    background: #e8f0fe;
    color: #2271b1;
}
.badge-service {
    background: #f0faf5;
    color: #27ae60;
}

.portfolio-client {
    font-size: 13px;
    color: #555;
    margin-bottom: 6px;
}
.portfolio-desc {
    font-size: 13px;
    color: #555;
    line-height: 1.7;
    margin-bottom: 8px;
}
.portfolio-result {
    font-size: 13px;
    color: #e67e22;
    font-weight: 600;
    margin-bottom: 6px;
}
.portfolio-url {
    font-size: 12px;
    margin-bottom: 10px;
}
.portfolio-url a {
    color: var(--color-primary);
    text-decoration: none;
}
.portfolio-url a:hover { text-decoration: underline; }

.portfolio-actions {
    display: flex;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

/* フォームアクション */
.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

/* リード詳細: マッチしたポートフォリオ */
.portfolio-match-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.portfolio-match-item {
    padding: 10px 14px;
    border-radius: 8px;
    background: #f8f9fa;
    border-left: 3px solid #aaa;
}
.portfolio-match-item.portfolio-match-exact {
    background: #f0f7ff;
    border-left-color: var(--color-primary);
}
.portfolio-match-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 13px;
}
.portfolio-match-detail {
    font-size: 12px;
    color: #555;
    margin-top: 2px;
}
.portfolio-match-detail a {
    color: var(--color-primary);
    text-decoration: none;
}
.portfolio-match-detail a:hover { text-decoration: underline; }

/* 案件モニター テーブル */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    background: #f8f9fb;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #eee;
    white-space: nowrap;
}
.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f2f2f2;
    vertical-align: middle;
}
.data-table tr:hover td { background: #fafbff; }
.data-table td:nth-child(1) { width: 50px; text-align: center; }
.data-table td:nth-child(3) { white-space: nowrap; }
.data-table td:nth-child(5) { white-space: nowrap; }
.data-table td:nth-child(6) { white-space: nowrap; }
.data-table td:nth-child(7) { white-space: nowrap; }

.badge-cw { background: #fde8e8; color: #F16722; font-weight: 700; }
.badge-lc { background: #e0f7fa; color: #0CBBF0; font-weight: 700; }
.badge-notified { background: #d1ecf1; color: #0c5460; }
.badge-approved { background: #fff3cd; color: #856404; }
.badge-generating { background: #fff3cd; color: #856404; }
.badge-review { background: #e8f0fe; color: #2271b1; }
.badge-applying { background: #fef3cd; color: #856404; }
.badge-applied { background: #d4edda; color: #155724; }
.badge-skipped { background: #e9ecef; color: #6c757d; }
.badge-expired { background: #f5f5f5; color: #999; }

.btn-proposal { background: #2271b1; color: #fff; }
.btn-proposal:hover:not(:disabled) { background: #1a5a8e; }

/* 提案文モーダル */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 640px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}
.modal-header h3 {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.modal-close:hover { color: #333; }
.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}
.modal-loading {
    text-align: center;
    color: #888;
    padding: 40px;
}
.proposal-text {
    font-size: 14px;
    line-height: 1.8;
    color: #333;
    white-space: pre-wrap;
}
.modal-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #eee;
    justify-content: flex-end;
}

/* ========================================
   マニュアルページ
   ======================================== */

/* 目次 */
.manual-toc {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 12px;
    padding: 28px 32px;
    margin-bottom: 32px;
    box-shadow: 0 4px 20px rgba(26,26,46,.15);
    color: #fff;
}
.manual-toc h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #fff;
    letter-spacing: .5px;
}
.toc-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 4px 32px;
    padding-left: 24px;
    margin: 0;
}
.toc-list li {
    font-size: 15px;
    line-height: 2.2;
}
.toc-list a {
    color: rgba(255,255,255,.85);
    text-decoration: none;
    transition: color .2s;
}
.toc-list a:hover { color: #fff; text-decoration: underline; }

/* セクション */
.manual-section {
    background: #fff;
    border-radius: 12px;
    margin-bottom: 28px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    overflow: hidden;
    scroll-margin-top: 72px;
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    background: linear-gradient(135deg, #f8f9fb, #eef1f7);
    border-bottom: 1px solid #e2e6ed;
}
.section-header h2 {
    font-size: 20px;
    font-weight: 800;
    color: #1a1a2e;
    margin: 0;
    letter-spacing: .3px;
}
.section-nav-link {
    font-size: 12px;
    color: var(--color-primary);
    background: rgba(74,144,217,.1);
    padding: 4px 12px;
    border-radius: 12px;
    white-space: nowrap;
    font-weight: 500;
}
.section-body {
    padding: 28px 32px;
}
.section-body > p {
    font-size: 15px;
    color: #555;
    margin-bottom: 24px;
    line-height: 1.9;
}

/* セクション内リスト */
.section-body ul {
    padding-left: 0;
    list-style: none;
}
.section-body ul > li {
    position: relative;
    padding: 6px 0 6px 22px;
    font-size: 14px;
    color: #555;
    line-height: 1.8;
}
.section-body ul > li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 14px;
    width: 8px;
    height: 8px;
    background: var(--color-primary);
    border-radius: 50%;
}
.section-body ul > li strong {
    color: #1a1a2e;
}

/* サブセクション */
.manual-subsection {
    margin-bottom: 28px;
}
.manual-subsection:last-child { margin-bottom: 0; }
.manual-subsection h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 14px;
    padding: 6px 14px;
    background: linear-gradient(90deg, rgba(74,144,217,.1), transparent);
    border-left: 3px solid var(--color-primary);
    border-radius: 0 6px 6px 0;
    display: block;
}

/* ステップリスト */
.manual-steps {
    padding-left: 0;
    list-style: none;
    counter-reset: manual-step;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.manual-steps > li {
    counter-increment: manual-step;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding: 20px 24px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e8ecf1;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
    transition: box-shadow .2s, transform .2s;
}
.manual-steps > li:hover {
    box-shadow: 0 4px 16px rgba(74,144,217,.1);
    transform: translateY(-1px);
}
.manual-steps > li::before {
    content: counter(manual-step);
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    line-height: 36px;
    text-align: center;
    background: linear-gradient(135deg, var(--color-primary), #5dade2);
    color: #fff;
    border-radius: 50%;
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(74,144,217,.3);
    margin-top: 2px;
}
.manual-step-content {
    flex: 1;
    min-width: 0;
}
.manual-steps > li strong {
    display: block;
    font-size: 16px;
    color: #1a1a2e;
    margin-bottom: 8px;
    line-height: 1.4;
}
.manual-steps > li p {
    font-size: 14px;
    color: #666;
    line-height: 1.9;
    margin: 4px 0;
}
.manual-steps > li ul {
    margin-top: 10px;
    padding-left: 0;
}
.manual-steps > li ul li {
    font-size: 14px;
    color: #555;
    line-height: 1.9;
    padding: 3px 0 3px 22px;
}
.manual-steps > li ul li::before {
    width: 6px;
    height: 6px;
    top: 13px;
    background: #95b8db;
}

/* テーブル */
.manual-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    margin-top: 10px;
    border: 1px solid #e8ecf1;
    border-radius: 8px;
    overflow: hidden;
}
.manual-table th {
    background: #1a1a2e;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #fff;
    font-size: 13px;
    letter-spacing: .3px;
}
.manual-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: top;
    line-height: 1.8;
    color: #444;
}
.manual-table tbody tr:last-child td { border-bottom: none; }
.manual-table tbody tr:nth-child(even) td { background: #f8f9fb; }
.manual-table tbody tr:hover td { background: #eef3fb; }
.manual-table td strong {
    color: #1a1a2e;
    font-weight: 600;
}

/* ノート */
.manual-note {
    background: linear-gradient(135deg, #f0f7ff, #e8f0fe);
    border-left: 4px solid var(--color-primary);
    padding: 14px 20px;
    border-radius: 0 10px 10px 0;
    font-size: 14px;
    color: #333;
    line-height: 1.8;
    margin-top: 16px;
}
.manual-note strong {
    color: #2271b1;
}

/* コスト情報 */
.cost-info {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.cost-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fff;
    padding: 14px 20px;
    border-radius: 10px;
    flex: 1;
    min-width: 240px;
    border: 1px solid #e8ecf1;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.cost-label {
    font-size: 14px;
    color: #555;
    font-weight: 600;
}
.cost-value {
    font-size: 15px;
    color: #e67e22;
    font-weight: 800;
}

/* ワークフローステップ */
.workflow-steps {
    display: flex;
    align-items: stretch;
    gap: 0;
    flex-wrap: wrap;
    justify-content: center;
    margin: 24px 0;
}
.workflow-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #fff;
    padding: 18px 18px;
    border-radius: 10px;
    flex: 0 1 190px;
    border: 1px solid #e8ecf1;
    border-top: 3px solid var(--color-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
    transition: box-shadow .2s, transform .2s;
}
.workflow-step:hover {
    box-shadow: 0 4px 16px rgba(74,144,217,.12);
    transform: translateY(-2px);
}
.workflow-step .step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: linear-gradient(135deg, var(--color-primary), #5dade2);
    color: #fff;
    border-radius: 50%;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(74,144,217,.3);
}
.workflow-step .step-content h4 {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 4px;
}
.workflow-step .step-content p {
    font-size: 13px;
    color: #777;
    line-height: 1.6;
}
.workflow-arrow {
    display: flex;
    align-items: center;
    font-size: 22px;
    color: var(--color-primary);
    padding: 10px 6px;
    font-weight: 700;
}
@media (max-width: 900px) {
    .workflow-steps { flex-direction: column; align-items: stretch; }
    .workflow-arrow { transform: rotate(90deg); align-self: center; padding: 4px; }
    .workflow-step { flex: 1 1 auto; }
    .section-body { padding: 20px; }
    .section-header { padding: 14px 20px; }
    .section-header h2 { font-size: 17px; }
}

/* ========================================
   案件管理: カンバンボード
   ======================================== */

.kanban-board {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 16px;
    min-height: 400px;
}

.kanban-column {
    flex: 0 0 200px;
    background: #f0f2f5;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 260px);
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    font-weight: 700;
    font-size: 13px;
    color: #555;
    border-bottom: 1px solid #e0e4ea;
}

.kanban-column-count {
    background: #ddd;
    color: #555;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 60px;
    transition: background .2s;
}

.kanban-drop-target {
    background: rgba(74, 144, 217, .1);
    border-radius: 8px;
}

.kanban-card {
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    cursor: grab;
    transition: box-shadow .2s, transform .1s;
    border-left: 3px solid var(--color-primary);
}
.kanban-card:hover {
    box-shadow: 0 3px 10px rgba(0,0,0,.12);
    transform: translateY(-1px);
}
.kanban-card-dragging {
    opacity: .5;
    transform: rotate(2deg);
}

.kanban-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
    line-height: 1.4;
}
.kanban-card-client {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
}
.kanban-card-amount {
    font-size: var(--font-sm);
    color: var(--color-warning);
    font-weight: 600;
    margin-top: 4px;
}
.kanban-card-date {
    font-size: var(--font-xs);
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* タスクアイテム（モーダル内） */
.task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 6px;
    background: #f8f9fa;
    margin-bottom: 6px;
    gap: 8px;
}
.task-item-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.task-item-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.task-status-select {
    padding: 2px 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 11px;
    background: #fff;
}
.task-name {
    font-size: 13px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.task-done {
    text-decoration: line-through;
    color: #999;
}
.task-priority {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
}
.task-priority-高 { background: #fde8e8; color: #c0392b; }
.task-priority-中 { background: #fef3cd; color: #e67e22; }
.task-priority-低 { background: #e8f5e9; color: #27ae60; }
.task-due {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
}
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px;
    opacity: .5;
    transition: opacity .2s;
}
.btn-icon:hover { opacity: 1; }

/* ========================================
   案件管理: ガントチャート
   ======================================== */

.gantt-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: calc(100vh - 280px);
    position: relative;
}

.gantt-wrapper {
    position: relative;
    min-width: 100%;
}

.gantt-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f8f9fb;
    border-bottom: 2px solid #eee;
}

.gantt-label-header {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 14px;
    font-weight: 700;
    font-size: 12px;
    color: #555;
    background: #f8f9fb;
    border-right: 1px solid #eee;
    z-index: 11;
}

.gantt-month-label {
    position: absolute;
    top: 2px;
    font-size: 11px;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
}

.gantt-date-label {
    position: absolute;
    top: 24px;
    font-size: 10px;
    color: #888;
    white-space: nowrap;
}

.gantt-today-line {
    position: absolute;
    top: 0;
    width: 2px;
    background: #e74c3c;
    z-index: 5;
    opacity: .6;
}

.gantt-weekend {
    position: absolute;
    top: 0;
    background: rgba(0,0,0,.02);
    z-index: 1;
}

.gantt-row {
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f2f2f2;
}
.gantt-row-even {
    background: #fafbfc;
}

.gantt-label {
    position: absolute;
    left: 0;
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 10px;
    background: inherit;
    border-right: 1px solid #eee;
    z-index: 3;
    overflow: hidden;
}
.gantt-label-text {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gantt-label-project {
    font-weight: 600;
    color: #333;
}
.gantt-label-task {
    color: #888;
}

.gantt-bar-container {
    position: absolute;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
}

.gantt-bar {
    position: absolute;
    height: 20px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 6px;
    z-index: 2;
    transition: opacity .2s;
}
.gantt-bar:hover {
    opacity: .85;
    cursor: pointer;
}
.gantt-bar-project {
    height: 22px;
    border-radius: 4px;
}
.gantt-bar-task {
    height: 14px;
    border-radius: 3px;
    opacity: .8;
}
.gantt-bar-label {
    font-size: 10px;
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gantt-legend {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #555;
}
.gantt-legend-bar {
    display: inline-block;
    width: 20px;
    height: 10px;
    border-radius: 3px;
}
.gantt-legend-bar-task {
    background: #8e44ad;
    height: 6px;
}

/* ========================================
   案件管理: 継続案件・フィルター
   ======================================== */

/* フィルターバー */
.project-filter-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

/* 継続案件カード */
.kanban-card-retainer {
    border-left-color: #8e44ad;
}

/* 継続バッジ */
.badge-retainer {
    display: inline-block;
    background: #f3e8fd;
    color: #8e44ad;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    margin-bottom: 4px;
}

/* 繰り返しバッジ */
.badge-recurring {
    font-size: 12px;
    padding: 0 2px;
    flex-shrink: 0;
}

/* タイムライン（/today） */
.timeline { display: flex; flex-direction: column; gap: 4px; }
.timeline-item {
    display: flex; gap: 16px; padding: 12px 16px;
    border-left: 4px solid #ddd; border-radius: 0 8px 8px 0;
    background: #fafafa;
}
.timeline-meeting { border-left-color: var(--color-primary); background: #f0f6ff; }
.timeline-work    { border-left-color: #27ae60; background: #f0fff4; }
.timeline-break   { border-left-color: #95a5a6; background: #f8f9fa; }
.timeline-admin   { border-left-color: #f39c12; background: #fffdf0; }
.timeline-time { font-weight: bold; min-width: 110px; color: #333; white-space: nowrap; }
.timeline-title { font-weight: 600; }
.timeline-note { font-size: 13px; color: #888; margin-top: 2px; }

/* ========================================
   レスポンシブ強化（全ページ共通）
   ======================================== */

/* タブレット（768px以下） */
@media (max-width: 768px) {
    .container { padding: 16px 12px; }
    .navbar { padding: 0 12px; }
    .nav-brand { font-size: 15px; margin-right: 8px; }
    .page-header h1 { font-size: 18px; }
    .page-header p { font-size: 13px; }

    .form-grid { grid-template-columns: 1fr; gap: 12px; }

    .stats-row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 12px; }
    .stat-number { font-size: 20px; }
    .stat-label { font-size: 11px; }

    .kanban-column { flex: 0 0 160px; }
    .kanban-board { min-height: 300px; gap: 8px; }
    .kanban-column-header { padding: 10px 10px; font-size: 12px; }
    .kanban-card { padding: 10px; }
    .kanban-card-title { font-size: 12px; }

    .modal-content { width: 95% !important; max-width: none !important; margin: 8px auto; }

    .detail-grid { grid-template-columns: 1fr; }
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* スマホ（480px以下） */
@media (max-width: 480px) {
    .container { padding: 12px 8px; }
    .page-header h1 { font-size: 16px; }

    .stats-row { grid-template-columns: 1fr 1fr; gap: 6px; }
    .stat-number { font-size: 18px; }

    .kanban-column { flex: 0 0 140px; }
    .kanban-card { padding: 8px; }
    .kanban-card-title { font-size: 11px; }
    .kanban-card-client { font-size: 10px; }
    .kanban-card-amount { font-size: 11px; }

    .stats-row-6 { grid-template-columns: 1fr 1fr; }

    .card { padding: 14px; margin-bottom: 12px; }

    .task-item { flex-wrap: wrap; }
    .task-item-right { width: 100%; justify-content: flex-end; margin-top: 4px; }
}

/* ========================================
   ユーティリティ
   ======================================== */

/* ローディングスピナー */
.loading-overlay {
    display: flex; align-items: center; justify-content: center;
    padding: 60px 20px; color: var(--color-text-muted);
    font-size: var(--font-sm);
}
.spinner {
    width: 32px; height: 32px; border: 3px solid var(--color-border);
    border-top-color: var(--color-primary); border-radius: 50%;
    animation: spin 0.7s linear infinite; margin-right: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ページヘッダーユーティリティ */
.page-header-flex {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 12px;
}
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* タブUI */
.tab-bar {
    display: flex; gap: 0; border-bottom: 2px solid var(--color-border);
    margin-bottom: 16px;
}
.tab-btn {
    padding: 10px 20px; border: none; background: none; cursor: pointer;
    font-size: var(--font-sm); font-weight: 600; color: var(--color-text-muted);
    border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s;
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* モバイルリストビュー（カンバン代替） */
.kanban-list-view { display: none; }

@media (max-width: 768px) {
    .kanban-board { display: none; }
    .kanban-list-view { display: block; }
    .kanban-list-item {
        background: var(--color-card); border-radius: var(--radius);
        padding: 14px; margin-bottom: 8px; box-shadow: var(--shadow);
        display: flex; align-items: center; gap: 12px; cursor: pointer;
        border-left: 3px solid var(--color-primary);
    }
    .kanban-list-item:active { background: #f8f9fa; }
    .kanban-list-info { flex: 1; min-width: 0; }
    .kanban-list-title {
        font-weight: 600; font-size: var(--font-base);
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .kanban-list-meta {
        font-size: var(--font-xs); color: var(--color-text-secondary); margin-top: 2px;
    }
    .kanban-list-status {
        font-size: 11px; padding: 3px 8px; border-radius: 12px;
        font-weight: 600; white-space: nowrap; flex-shrink: 0;
    }
    .kanban-list-status-見込み { background: #f5f5f5; color: #666; }
    .kanban-list-status-提案中 { background: #fff3e0; color: #e65100; }
    .kanban-list-status-商談中 { background: var(--color-primary-light); color: var(--color-primary); }
    .kanban-list-status-受注 { background: var(--color-success-light); color: var(--color-success); }
    .kanban-list-status-進行中 { background: #e3f2fd; color: #1565c0; }
    .kanban-list-status-完了 { background: var(--color-success-light); color: var(--color-success); }
    .kanban-list-status-失注 { background: var(--color-danger-light); color: var(--color-danger); }
}

/* 目標ミニプログレス（ダッシュボード用） */
.goal-mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.goal-mini-item {
    padding: 8px 0;
}
.goal-mini-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.goal-mini-label {
    font-size: 0.8rem;
    color: #666;
    font-weight: 600;
}
.goal-mini-val {
    font-size: 0.8rem;
    font-weight: 700;
}
.goal-mini-bar {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 3px;
}
.goal-mini-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}
.goal-mini-nums {
    font-size: 0.75rem;
    color: #999;
}

/* 着地予測 */
.forecast-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}
.forecast-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    flex: 1;
    min-width: 200px;
}
.forecast-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    min-width: 40px;
}
.forecast-actual {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
}
.forecast-arrow {
    color: #ccc;
    font-size: 1rem;
}
.forecast-predicted {
    font-size: 1.2rem;
    font-weight: 700;
    color: #4a90d9;
}
.forecast-unit {
    font-size: 0.7rem;
    font-weight: 400;
    color: #888;
    margin-left: 2px;
}
.forecast-avg {
    font-size: 0.78rem;
    color: #999;
    margin-left: auto;
}
.forecast-predicted {
    color: var(--color-blue);
}

/* ========================================
   ローディングスピナー
   ======================================== */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px;
    color: #888;
    font-size: 0.9rem;
}
.loading-spinner::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 3px solid #e9ecef;
    border-top-color: var(--color-blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 空状態カード */
.empty-card {
    text-align: center;
    padding: 48px 24px;
    color: #888;
}
.empty-card-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}
.empty-card-text {
    font-size: 0.95rem;
    margin-bottom: 16px;
}
.empty-card-cta {
    display: inline-block;
    padding: 8px 20px;
    background: var(--color-blue);
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s;
}
.empty-card-cta:hover { background: #3a7bc8; }

/* ========================================
   目標管理ページ
   ======================================== */
.goal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}
.goal-tab {
    padding: 8px 20px;
    border: 2px solid var(--color-blue);
    background: white;
    color: var(--color-blue);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.goal-tab.active {
    background: var(--color-blue);
    color: white;
}
.goal-tab:hover { opacity: 0.85; }

.goal-progress-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.goal-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.goal-progress-header h2 { margin: 0; font-size: 1.15rem; }
.goal-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.goal-metric {
    padding: 14px;
    border-radius: 8px;
    background: #f8f9fa;
}
.goal-metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.goal-metric-label { font-size: 0.88rem; color: #555; font-weight: 600; }
.goal-metric-pct { font-size: 0.88rem; font-weight: 700; }
.goal-metric-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}
.goal-metric-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}
.goal-metric-values { font-size: 0.82rem; color: #888; }

.pct-over, .pct-high { color: var(--color-green); }
.pct-mid { color: var(--color-orange); }
.pct-low { color: var(--color-red); }
.fill-over, .fill-high { background: var(--color-green); }
.fill-mid { background: var(--color-orange); }
.fill-low { background: var(--color-red); }

.goal-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.goal-form-item label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}
.goal-form-item input, .goal-form-item textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.goal-form-item input:focus, .goal-form-item textarea:focus {
    outline: none;
    border-color: var(--color-blue);
    box-shadow: 0 0 0 3px rgba(74,144,217,.15);
}
.goal-form-actions {
    margin-top: 16px;
    display: flex;
    gap: 8px;
}

/* ========================================
   パイプラインページ
   ======================================== */
.pipeline-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.source-checkboxes {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.source-checkboxes label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}
.source-checkboxes input[type="checkbox"] {
    accent-color: var(--color-blue);
    width: 16px;
    height: 16px;
}
.btn-lg { padding: 10px 28px; font-size: 1rem; }

.pipeline-progress-bar {
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
}
.pipeline-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-blue), var(--color-green));
    border-radius: 6px;
    transition: width 0.5s ease;
}
.pipeline-progress-text {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.88rem;
    color: #555;
}
.pipeline-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}
.pipeline-summary-item {
    text-align: center;
    padding: 14px 12px;
    background: #f8f9fa;
    border-radius: 8px;
}
.summary-number { font-size: 1.4rem; font-weight: 700; color: #333; }
.summary-label { font-size: 0.82rem; color: #888; margin-top: 2px; }
.rank-s .summary-number { color: var(--color-red); }
.rank-a .summary-number { color: var(--color-orange); }
.rank-b .summary-number { color: var(--color-blue); }

.result-filters { display: flex; gap: 8px; }
.result-filters select {
    padding: 7px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.88rem;
    background: white;
}

/* 共通データテーブル（pipeline / inbound） */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; }
.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
    font-size: 0.85rem;
}
.data-table tr:hover td { background: #fafbff; }

.rank-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.82rem;
    color: white;
}
.rank-S { background: var(--color-red); }
.rank-A { background: var(--color-orange); }
.rank-B { background: var(--color-blue); }
.rank-C { background: var(--color-gray); }
.mf-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
}
.mf-yes { background: #e8f5e9; color: #2e7d32; }

.history-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.history-table th, .history-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; }
.history-table th { background: #f8f9fa; font-weight: 600; color: #555; }

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 600;
}
.status-completed { background: #e8f5e9; color: #2e7d32; }
.status-running { background: #fff3e0; color: #e65100; }
.status-failed { background: #ffebee; color: #c62828; }
.status-pending { background: #f5f5f5; color: #666; }

/* インバウンド: ステータスセレクト */
.status-select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    background: white;
    transition: border-color 0.2s;
}
.status-select:focus { border-color: var(--color-blue); outline: none; }
