/* リセットとベース設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 基本カラースキーム（新UIの共通トークンは hukuro.css） */
    --primary-color: #0891B2;      /* ターコイズブルー - 清潔感 */
    --primary-hover: #0E7490;
    --secondary-color: #64748B;
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --accent-color: #06B6D4;       /* アクセントカラー */
    
    /* 背景色 */
    --bg-color: #F8FAFC;
    --bg-light: #FFFFFF;
    --card-bg: #FFFFFF;
    
    /* テキスト */
    --text-primary: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    
    /* ボーダー */
    --border-color: #E2E8F0;
    --border-light: #F1F5F9;
    
    /* サイズ */
    --sidebar-width: 260px;
    
    /* シャドウ */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.7;
    letter-spacing: 0.02em;
}

/* サイドバー - よりプロフェッショナルなデザイン */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #0891B2 0%, #0E7490 100%);
    color: white;
    padding: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-header i {
    font-size: 32px;
    color: #FFFFFF;
}

.sidebar-header h2 {
    font-size: 25px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #FFFFFF;
}

.sidebar-header img {
    position: absolute;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
}

.sidebar-nav {
    padding: 24px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 24px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-weight: 500;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.12);
    color: white;
    border-left-color: rgba(255, 255, 255, 0.5);
}

.nav-item.active {
    background-color: rgba(255, 255, 255, 0.18);
    border-left-color: white;
    color: white;
    font-weight: 600;
}

.nav-item i {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.user-info i {
    font-size: 36px;
}

.user-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.2s;
}

.user-link:hover {
    color: white;
}

.user-role {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-left: 4px;
}

/* メインコンテンツ */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background-color: var(--bg-color);
}

/* ヘッダーは削除されました */

/* コンテンツエリア */
.content-area {
    padding: 40px;
    max-width: 1600px;
    margin-top: 0;
}

/* アラート */
.alert {
    padding: 16px 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.alert-error {
    background-color: #FEE2E2;
    color: #991B1B;
    border-left: 4px solid var(--danger-color);
}

.alert-success {
    background-color: #D1FAE5;
    color: #065F46;
    border-left: 4px solid var(--success-color);
}

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: inherit;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
}



/* カード */
.dashboard-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.card-header {
    padding: 28px 32px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(to bottom, #FFFFFF 0%, #F8FAFC 100%);
}

.card-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s;
}

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

.card-content {
    padding: 32px;
}

/* テーブル */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    text-align: left;
    padding: 16px 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 2px solid var(--border-color);
    background-color: #FAFBFC;
}

.data-table tbody td {
    padding: 20px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.data-table tbody tr:hover {
    background-color: #F0F9FF;
    border-left-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(8, 145, 178, 0.08);
}

.clickable-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.clickable-row:hover {
    background-color: #F0F9FF;
}

.action-cell {
    /* アクション列はクリックイベントを伝播させない */
    position: relative;
}

.table-link {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s;
    display: inline-block;
}

.article-list-title {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.table-link:hover {
    color: var(--primary-hover);
    transform: translateX(2px);
}

.table-link i {
    margin-right: 6px;
    color: var(--text-muted);
}

/* バッジ */
.badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.badge-success {
    background: linear-gradient(135deg, #10B981 0%, #34D399 100%);
    color: white;
}

.badge-warning {
    background: linear-gradient(135deg, #F59E0B 0%, #FBBF24 100%);
    color: white;
}



/* page-headerは削除されました */

/* 検索バー - 共通スタイル */
.search-bar {
    position: relative;
    margin-bottom: 24px;
    max-width: 400px;
}

.search-bar i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    background: white;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 188, 156, 0.1);
}

.search-input:hover {
    border-color: var(--primary-color);
}

/* 医院グリッド */
.clinics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 28px;
}

.clinic-card {
    background: white;
    border-radius: 16px;
    padding: 28px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s;
    border: 1px solid var(--border-light);
}

.clinic-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.clinic-header {
    display: flex;
    gap: 18px;
    margin-bottom: 24px;
}

.clinic-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #0891B2 0%, #06B6D4 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 26px;
    flex-shrink: 0;
}

.clinic-info h3 {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.clinic-location {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.clinic-location i {
    margin-right: 6px;
}

.clinic-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 20px 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.clinic-stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.clinic-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.clinic-actions .btn {
    white-space: nowrap;
}

.clinic-actions .action-buttons {
    margin-left: auto;
}

/* ボタン */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    text-decoration: none;
    letter-spacing: 0.02em;
}

.btn-primary {
    background: linear-gradient(135deg, #0891B2 0%, #06B6D4 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(8, 145, 178, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0E7490 0%, #0891B2 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(8, 145, 178, 0.3);
}

.btn-secondary {
    background-color: white;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-info {
    background: linear-gradient(135deg, #3B82F6 0%, #60A5FA 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
}

.btn-info:hover {
    background: linear-gradient(135deg, #2563EB 0%, #3B82F6 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #10B981 0%, #34D399 100%);
    color: white;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #10B981 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(16, 185, 129, 0.3);
}

.btn-icon-only {
    padding: 10px;
    width: 40px;
    height: 40px;
    justify-content: center;
}

.btn-danger {
    color: var(--danger-color);
    border-color: var(--border-color);
}

.btn-danger:hover {
    background-color: #FEE2E2;
    border-color: var(--danger-color);
    transform: translateY(-2px);
}

.btn-danger-outline {
    background-color: transparent !important;
    color: var(--text-muted);
    border: none !important;
    padding: 8px 12px;
    transition: color 0.2s;
    cursor: pointer;
    box-shadow: none !important;
    border-radius: 0;
}

.btn-danger-outline:hover {
    background-color: transparent !important;
    color: var(--danger-color);
    transform: none !important;
    box-shadow: none !important;
}

.btn-danger-outline:active {
    color: #DC2626;
}

.btn-danger-outline-border {
    background-color: transparent;
    color: var(--danger-color);
    border: 2px solid var(--danger-color);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    cursor: pointer;
}

.btn-danger-outline-border:hover {
    background-color: var(--danger-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

/* アクションボタングループ */
.action-buttons {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    margin-bottom: 20px;
    font-weight: 600;
    transition: color 0.2s;
}

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

/* 詳細グリッド */
.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 28px;
    margin-bottom: 40px;
}

.detail-main {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.detail-card {
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.detail-card h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-primary);
}

.detail-info {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-light);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
}

.info-value {
    font-weight: 600;
    color: var(--text-primary);
}

.info-value a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.info-value a:hover {
    text-decoration: underline;
}

/* 記事詳細 */
.article-header {
    margin-bottom: 40px;
}

.article-header h1 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--text-primary);
    line-height: 1.3;
}

.article-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.meta-item i {
    color: var(--text-muted);
}

.article-content {
    line-height: 1.9;
    font-size: 16px;
    color: var(--text-primary);
}

.article-content p {
    margin-bottom: 20px;
}

.article-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 40px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-color);
}

.article-content h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 32px;
    margin-bottom: 16px;
    padding-left: 12px;
    border-left: 4px solid var(--accent-color);
}

.article-content h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 24px;
    margin-bottom: 12px;
    padding-left: 20px;
}

.action-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-item {
    width: 100%;
    padding: 12px 16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.action-item:hover {
    background-color: #F0F9FF;
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateX(4px);
}

.action-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.text-danger {
    color: var(--danger-color);
}

.text-danger:hover {
    background-color: #FEE2E2;
    border-color: var(--danger-color);
    color: var(--danger-color);
}

/* フォーム */
.form-container {
    max-width: 100%;
    width: 100%;
}

.article-form {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 2px solid var(--border-color);
    max-width: 1200px;
    margin: 0 auto;
}

@media (max-width: 1400px) {
    .article-form {
        max-width: 100%;
    }
}

.form-group {
    margin-bottom: 28px;
}

.form-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s;
    background: white;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

.form-textarea {
    resize: vertical;
    line-height: 1.7;
}

.input-group {
    display: flex;
    gap: 12px;
}

.input-group .form-input {
    flex: 1;
}

.form-hint {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-actions {
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 2px solid var(--border-color);
}

/* 空の状態 */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-state i {
    font-size: 72px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 16px;
}

/* プログレスステップ */
.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 48px;
    padding: 32px 40px;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 2px solid var(--border-color);
}

.step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    opacity: 0.4;
    transition: all 0.3s;
}

.step::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    right: -50%;
    height: 2px;
    background: var(--border-color);
    z-index: -1;
}

.step:last-child::before {
    display: none;
}

.step.active,
.step.completed {
    opacity: 1;
}

.step.completed .step-number {
    background: linear-gradient(135deg, #10B981 0%, #34D399 100%);
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
}

.step.completed::before {
    background: linear-gradient(90deg, #10B981 0%, #34D399 100%);
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--border-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 8px;
    transition: all 0.3s;
}

.step.active .step-number {
    background: linear-gradient(135deg, #0891B2 0%, #06B6D4 100%);
    box-shadow: 0 0 0 4px rgba(8, 145, 178, 0.15), 0 4px 6px rgba(8, 145, 178, 0.2);
    transform: scale(1.1);
}

.step-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 4px;
}

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

/* ステップコンテンツ */
.step-content {
    display: none;
}

.step-content.active {
    display: block;
}

.step-description {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 32px;
    line-height: 1.7;
}

/* 構成案グリッド */
.outlines-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
    align-items: stretch;
}

.outline-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 28px;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.outline-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 24px rgba(8, 145, 178, 0.15);
    transform: translateY(-6px);
}

.outline-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 16px;
}

.outline-badge {
    background: linear-gradient(135deg, #0891B2 0%, #06B6D4 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(8, 145, 178, 0.2);
}

.outline-title {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.outline-title strong {
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
}

.outline-sections {
    margin-bottom: 20px;
    flex-grow: 1;
    overflow-y: auto;
}

.outline-section {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.outline-section i {
    color: var(--primary-color);
    margin-top: 2px;
}

/* 構成エディタ */
.outline-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.outline-section-edit {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    transition: all 0.2s;
    cursor: move;
}

.outline-section-edit:hover {
    background: #f8fafc;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.1);
}

.section-number {
    width: 28px;
    height: 28px;
    background: var(--primary-color);
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.outline-section-edit .form-input {
    flex: 1;
    margin: 0;
}

.outline-section-edit .btn-icon {
    flex-shrink: 0;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* 生成統計 */
.generated-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    padding: 20px 32px;
    background: white;
    border-radius: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 2px solid var(--border-color);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-item i {
    font-size: 20px;
    color: var(--primary-color);
}

/* 固定文字数カウント */
.char-count-fixed {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 12px 20px;
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 2px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    z-index: 1000;
    transition: all 0.3s;
}

.char-count-fixed:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.char-count-fixed i {
    font-size: 18px;
    color: var(--primary-color);
}

/* モーダル */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 2px solid var(--border-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--background-light);
    color: var(--text-primary);
}

.modal-body {
    padding: 32px;
}

/* 通知のアニメーション（右上から下へ） */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* 旧アニメーション（互換性のため残す） */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

/* 新しいセクションの強調表示 */
.new-section-highlight {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%) !important;
    border: 2px solid #F59E0B !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2) !important;
}

.new-section-title {
    color: #D97706 !important;
    font-weight: 600 !important;
    background: #FFFBEB !important;
}

/* 再生成モーダルのモデル選択 */
.regenerate-model-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.regenerate-model-option:hover {
    border-color: var(--primary-color);
    background: #f8fffe;
}

.regenerate-model-option input[type="radio"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.regenerate-model-option:has(input:checked) {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 100%);
}

.regenerate-model-option span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.regenerate-model-option span i {
    margin-right: 6px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 24px 32px;
    border-top: 2px solid var(--border-color);
    background: var(--background-light);
}

/* ローディングオーバーレイ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.loading-spinner i {
    font-size: 48px;
    margin-bottom: 16px;
}

.loading-spinner p {
    font-size: 16px;
    font-weight: 600;
}

/* 設定画面 */
.settings-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 32px;
    max-width: 1400px;
}

.settings-sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.settings-menu {
    background: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.settings-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 14px;
}

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

.settings-menu-item.active {
    background: linear-gradient(135deg, #0891B2 0%, #06B6D4 100%);
    color: white;
}

.settings-menu-item i {
    font-size: 18px;
    width: 20px;
}

.settings-content {
    min-width: 0;
}

.settings-tab {
    display: none;
}

.settings-tab.active {
    display: block;
}

.settings-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.settings-header {
    padding: 32px;
    border-bottom: 2px solid var(--border-color);
    background: linear-gradient(to bottom, #FFFFFF 0%, #F8FAFC 100%);
}

.settings-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.settings-form {
    padding: 32px;
}

/* アラート */
.alert-info,
.alert-warning {
    display: flex;
    gap: 16px;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 28px;
    line-height: 1.6;
}

.alert-info {
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    border-left: 4px solid #3B82F6;
    color: #1E3A8A;
}

.alert-warning {
    background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
    border-left: 4px solid #F59E0B;
    color: #92400E;
}

.alert-info i,
.alert-warning i {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-info a {
    color: #1E3A8A;
    text-decoration: underline;
}

.alert-info ol {
    margin: 0;
}

/* APIキー一覧 */
.api-keys-list {
    padding: 32px;
}

.api-key-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
}

.api-key-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.api-key-info i {
    font-size: 32px;
    color: var(--primary-color);
}

.api-key-info h4 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.api-key-status {
    font-size: 13px;
    margin: 0;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-connected {
    background: #D1FAE5;
    color: #065F46;
}

.status-not-connected {
    background: #FEE2E2;
    color: #991B1B;
}

/* ===========================================
   記事ステータス badge/pill 色 (routes/progress.py STATUS_ORDER と同期)
   =========================================== */
.status-badge[class*="status-"],
.badge.status-badge {
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.status-login_pending    { background: #64748B; color: white; }
.status-kw_selecting     { background: #94A3B8; color: white; }
.status-rewrite_select   { background: #94A3B8; color: white; }
.status-rewrite_wcheck   { background: #F97316; color: white; }
.status-writer_requested { background: #60A5FA; color: white; }
.status-writer_writing   { background: #3B82F6; color: white; }
.status-writer_delivered { background: #2563EB; color: white; }
.status-review_requested { background: #FBBF24; color: white; }
.status-reviewing        { background: #F59E0B; color: white; }
.status-reviewed         { background: #D97706; color: white; }
.status-review_wcheck    { background: #F97316; color: white; }
.status-client_review    { background: #A78BFA; color: white; }
.status-client_ok        { background: #8B5CF6; color: white; }
.status-submit_requested { background: #22D3EE; color: white; }
.status-submit_working   { background: #06B6D4; color: white; }
.status-submitted        { background: #0891B2; color: white; }
.status-submit_wcheck    { background: #F97316; color: white; }
.status-submit_wcheck_ok { background: #0E7490; color: white; }
.status-scheduled        { background: #14B8A6; color: white; }
.status-published        { background: #10B981; color: white; }
/* 旧キー互換 */
.status-draft            { background: #94A3B8; color: white; }
.status-read             { background: #64748B; color: white; }
.status-pending_review   { background: #EF4444; color: white; }
.status-final_check      { background: #0891B2; color: white; }

/* status-pill (dashboard/calendar 用の丸ピル) */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: white;
}

.file-upload-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-color);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    color: var(--text-secondary);
}

.file-upload-info i {
    font-size: 24px;
    color: var(--primary-color);
}

/* トースト通知 */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-error {
    border-left: 4px solid var(--danger-color);
}

.toast i {
    font-size: 20px;
}

.toast-success i {
    color: var(--success-color);
}

.toast-error i {
    color: var(--danger-color);
}

/* レスポンシブ */
@media (max-width: 1024px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .content-area {
        padding: 32px;
    }
    
    .settings-container {
        grid-template-columns: 1fr;
    }
    
    .settings-sidebar {
        position: static;
    }
    
    .settings-menu {
        display: flex;
        overflow-x: auto;
    }
    
    .settings-menu-item {
        flex-shrink: 0;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .clinics-grid {
        grid-template-columns: 1fr;
    }
    
    .content-area {
        padding: 24px;
    }
    
    .article-header h1 {
        font-size: 28px;
    }
    
    .action-buttons {
        gap: 4px;
    }
}

/* ボタンスタイル調整 */
.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-sm i {
    margin-right: 4px;
}

.btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* プレーンテキスト表示用スタイル */
.section-content {
    background: white;
    border: none;
    padding: 0;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', Meiryo, sans-serif;
    font-size: 15px;
    line-height: 1.9;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* バッジスタイル */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    margin-left: 8px;
}

.badge-primary {
    background: linear-gradient(135deg, var(--primary-color), #16a085);
    color: white;
}

.badge-clickable {
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    padding: 8px 16px;
    font-size: 13px;
}

.badge-clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    opacity: 0.9;
}

/* 構成案のセクションに詳細度バッジを表示 */
.outline-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.outline-section .badge {
    margin-left: auto;
}

/* 医院検索ドロップダウン */
.clinic-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 4px;
}

.clinic-dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid var(--border-light);
}

.clinic-dropdown-item:last-child {
    border-bottom: none;
}

.clinic-dropdown-item:hover {
    background-color: var(--bg-color);
}

.clinic-dropdown-item.selected {
    background-color: var(--primary-color);
    color: white;
}

.clinic-dropdown-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
}

.form-group {
    position: relative;
}

/* ドラッグ可能なセクション */
.outline-section-edit {
    cursor: move;
    transition: all 0.2s;
}

.outline-section-edit.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.outline-section-edit.drag-over {
    border-top: 3px solid var(--primary-color);
}

/* レベル選択ドロップダウン */
.level-selector {
    position: relative;
    display: inline-block;
}

.level-badge {
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s;
}

.level-badge:hover {
    transform: scale(1.05);
}

/* ステップ3の構成編集用レベルバッジ（クリック式） */
.outline-level-badge {
    transition: all 0.2s;
    user-select: none;
}

.outline-level-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.outline-level-badge:active {
    transform: scale(0.95);
}

.level-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 100;
    min-width: 80px;
    margin-top: 4px;
}

.level-dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.85em;
    font-weight: 700;
}

.level-dropdown-item:hover {
    background-color: var(--bg-color);
}

.level-dropdown-item.h2 {
    color: #0066cc;
}

.level-dropdown-item.h3 {
    color: #6c757d;
}

.level-dropdown-item.h4 {
    color: #28a745;
}

/* ========== 検索可能ドロップダウン（共通スタイル） ========== */
.searchable-dropdown {
    position: relative;
    min-width: 240px;
}

.searchable-dropdown-input {
    width: 100%;
    padding: 12px 16px;
    padding-right: 36px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    background: white;
    transition: all 0.2s;
}

.searchable-dropdown-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

.searchable-dropdown-input::placeholder {
    color: var(--text-muted);
}

.searchable-dropdown-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: transform 0.2s;
}

.searchable-dropdown.open .searchable-dropdown-icon {
    transform: translateY(-50%) rotate(180deg);
}

.searchable-dropdown-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.searchable-dropdown.open .searchable-dropdown-list {
    display: block;
}

.searchable-dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}

.searchable-dropdown-item:last-child {
    border-bottom: none;
}

.searchable-dropdown-item:hover {
    background: var(--bg-color);
}

.searchable-dropdown-item.selected {
    background: rgba(8, 145, 178, 0.08);
    color: var(--primary-color);
    font-weight: 600;
}

.searchable-dropdown-item.no-results {
    color: var(--text-muted);
    text-align: center;
    cursor: default;
}

.searchable-dropdown-item.no-results:hover {
    background: white;
}
