/* すまいるほーむ集客ツール - スタイルシート */

/* === リセット & 基本 === */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: "メイリオ", "游ゴシック", "ヒラギノ角ゴ ProN", sans-serif;
    font-size: 15px;
    color: #3E3E3E;
    background-color: #FAF9F6;
    line-height: 1.7;
}

a {
    color: #C19A6B;
    text-decoration: none;
}

a:hover {
    color: #9B7B52;
    text-decoration: underline;
}

/* === ヘッダー === */
.site-header {
    background-color: #fff;
    border-bottom: 3px solid #C19A6B;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    min-height: 56px;
    padding: 0 24px;
    gap: 24px;
    max-width: 100%;
}

.site-logo {
    font-family: "游明朝", "ヒラギノ明朝 ProN", serif;
    font-size: 1.1rem;
    font-weight: bold;
    color: #3E3E3E;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}
.site-logo:hover {
    color: #C19A6B;
    text-decoration: none;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.nav-links a {
    color: #3E3E3E;
    font-size: 0.93rem;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s;
}
.nav-links a:hover {
    color: #C19A6B;
    text-decoration: none;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    font-size: 0.85rem;
    color: #888;
    border-left: 1px solid #e0d5c5;
    padding-left: 16px;
    flex-shrink: 0;
}

/* === メインコンテンツ === */
.main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px;
    min-height: calc(100vh - 120px);
}

/* === フッター === */
.site-footer {
    background-color: #f0ebe3;
    border-top: 1px solid #ddd;
    margin-top: 48px;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 24px;
    font-size: 0.85rem;
    color: #888;
    text-align: center;
}

/* === ボタン === */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-family: inherit;
    text-align: center;
}

.btn:hover {
    text-decoration: none;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.btn-primary {
    background-color: #C19A6B;
    color: #fff;
}

.btn-primary:hover {
    background-color: #9B7B52;
    color: #fff;
}

.btn-secondary {
    background-color: #fff;
    color: #C19A6B;
    border: 1px solid #C19A6B;
}

.btn-secondary:hover {
    background-color: #f9f3ec;
    color: #9B7B52;
}

.btn-outline {
    background-color: transparent;
    color: #888;
    border: 1px solid #ccc;
}

.btn-outline:hover {
    background-color: #f5f5f5;
    color: #666;
}

.btn-large {
    padding: 12px 32px;
    font-size: 1.05rem;
}

.btn-nav-primary {
    background-color: #E8985E;
    color: #fff !important;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.12);
}

.btn-nav-primary:hover {
    background-color: #c97a44;
    text-decoration: none;
}

.btn-nav-planning {
    background-color: #C19A6B;
    color: #fff !important;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.12);
}

.btn-nav-planning:hover {
    background-color: #9B7B52;
    text-decoration: none;
}

.nav-user-info {
    font-size: 0.85rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 6px;
    border-left: 1px solid #e0d5c5;
    padding-left: 14px;
    margin-left: 4px;
}

.nav-logout-link {
    color: #C0392B;
    font-size: 0.82rem;
    text-decoration: none;
    padding: 2px 8px;
    border: 1px solid #e8c8c8;
    border-radius: 4px;
    transition: background 0.15s;
}

.nav-logout-link:hover {
    background: #fdf0f0;
    text-decoration: none;
}

.btn-planning {
    background-color: #C19A6B;
    color: #fff;
}

.btn-planning:hover {
    background-color: #9B7B52;
    color: #fff;
}

/* === フラッシュメッセージ === */
.flash-messages {
    margin-bottom: 20px;
}

.flash {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.flash-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash-info {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* === トップ画面 === */
.page-header {
    margin-bottom: 32px;
    border-bottom: 2px solid #e8ddd0;
    padding-bottom: 20px;
}

.page-header h1 {
    font-family: "游明朝", "ヒラギノ明朝 ProN", serif;
    font-size: 1.8rem;
    color: #3E3E3E;
    margin: 0 0 8px 0;
}

.page-description {
    color: #888;
    font-size: 0.95rem;
    margin: 0;
}

.section-actions {
    margin-bottom: 40px;
    text-align: center;
}

.section-events h2 {
    font-family: "游明朝", "ヒラギノ明朝 ProN", serif;
    font-size: 1.3rem;
    color: #3E3E3E;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0d5c5;
}

/* === イベントカード === */
.event-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.event-card {
    background-color: #fff;
    border: 1px solid #e0d5c5;
    border-radius: 8px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s;
}

.event-card:hover {
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.event-card-info {
    flex: 1;
}

.event-date {
    font-size: 0.85rem;
    color: #999;
    margin-bottom: 4px;
}

.event-name {
    font-size: 1.05rem;
    font-weight: bold;
    color: #3E3E3E;
    margin-bottom: 4px;
}

.event-venue {
    font-size: 0.88rem;
    color: #888;
    margin-bottom: 4px;
}

.event-results {
    font-size: 0.9rem;
    color: #C19A6B;
}

.event-results.no-results {
    color: #ccc;
}

.event-created-at {
    font-size: 0.78rem;
    color: #bbb;
    margin-top: 2px;
}

.event-card-actions {
    display: flex;
    gap: 8px;
    margin-left: 20px;
    flex-shrink: 0;
}

/* === 空の状態 === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #aaa;
    background-color: #fff;
    border: 1px dashed #ddd;
    border-radius: 8px;
}

.empty-state p {
    margin: 8px 0;
    font-size: 1rem;
}

/* === フォーム === */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
    font-size: 0.95rem;
    color: #3E3E3E;
}

.form-label .required {
    color: #C0392B;
    margin-left: 4px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    color: #3E3E3E;
    background-color: #fff;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #C19A6B;
    box-shadow: 0 0 0 3px rgba(193, 154, 107, 0.15);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* === セクション === */
.section-card {
    background-color: #fff;
    border: 1px solid #e0d5c5;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.section-card h2 {
    font-family: "游明朝", "ヒラギノ明朝 ProN", serif;
    font-size: 1.15rem;
    margin: 0 0 16px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0e8da;
    color: #3E3E3E;
}

/* === ローディング === */
.loading {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #e0d5c5;
    border-top-color: #C19A6B;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === タブ === */
.tab-nav {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e0d5c5;
    margin-bottom: 24px;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    color: #888;
    transition: color 0.2s;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: #C19A6B;
}

.tab-btn.active {
    color: #C19A6B;
    border-bottom-color: #C19A6B;
    font-weight: bold;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* === コピーブロック === */
.copy-block {
    background-color: #faf6ef;
    border: 1px solid #e8ddd0;
    border-left: 4px solid #C19A6B;
    border-radius: 0 6px 6px 0;
    padding: 16px 20px;
    margin-bottom: 16px;
    white-space: pre-wrap;
    font-size: 1rem;
    line-height: 1.8;
}

/* === チェックボックスグループ === */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #C19A6B;
}

/* === 星評価 === */
.star-rating {
    display: flex;
    gap: 4px;
}

.star-rating input[type="radio"] {
    display: none;
}

.star-rating label {
    font-size: 1.6rem;
    color: #ddd;
    cursor: pointer;
    transition: color 0.1s;
}

.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label {
    color: #E8985E;
}

/* === ユーティリティ === */
.text-center { text-align: center; }
.text-muted { color: #888; font-size: 0.9rem; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex-row { display: flex; gap: 12px; align-items: center; }
.flex-1 { flex: 1; }

/* === 設定ページ === */
.nav-settings-link {
    color: #888;
    font-size: 0.85rem;
    text-decoration: none;
    padding: 2px 8px;
    border: 1px solid #e0d5c5;
    border-radius: 4px;
    transition: background 0.15s;
}
.nav-settings-link:hover {
    background: #f9f3ec;
    color: #C19A6B;
    text-decoration: none;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.settings-card {
    background-color: #fff;
    border: 1px solid #e0d5c5;
    border-radius: 10px;
    padding: 20px 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    text-decoration: none;
    color: #3E3E3E;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.settings-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #C19A6B;
    text-decoration: none;
}

.settings-card-icon {
    font-size: 2rem;
    flex-shrink: 0;
    line-height: 1;
}

.settings-card-body h2 {
    font-family: "游明朝", "ヒラギノ明朝 ProN", serif;
    font-size: 1rem;
    margin: 0 0 6px 0;
    color: #3E3E3E;
    border: none;
    padding: 0;
}

.settings-card-body p {
    font-size: 0.85rem;
    color: #888;
    margin: 0;
}

/* ★Step 4X4v4-4-correct.3: 設定画面グルーピング */
.settings-group {
    margin: 24px 0 32px;
}
.settings-group__title {
    font-family: "游明朝", "ヒラギノ明朝 ProN", serif;
    font-size: 1.2rem;
    color: #3E3E3E;
    margin: 0 0 6px;
    padding: 0 0 6px;
    border-bottom: 2px solid #E5DAC9;
    display: flex;
    align-items: center;
    gap: 8px;
}
.settings-group__icon { font-size: 1.4rem; }
.settings-group__desc {
    color: #888;
    font-size: 0.88rem;
    margin: 0 0 14px;
}
.settings-card { position: relative; flex-direction: column; }
.settings-card-body { width: 100%; }
.settings-card--campaign {
    background: linear-gradient(to bottom, #fffaf3, #fff);
    border-color: #C19A6B;
}
.settings-card-steps {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.settings-step-badge {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 10px;
    color: #fff;
    background: #B8860B;
    font-weight: 600;
    line-height: 1.4;
}
.settings-step-badge--1 { background: #4a78b8; }
.settings-step-badge--2 { background: #5b9bd5; }
.settings-step-badge--3 { background: #B8860B; }
.settings-step-badge--4 { background: #9b59b6; }
.settings-step-badge--5 { background: #c44569; }

/* settings-card に icon + body 並びを縦・横レイアウト両対応 */
@media (min-width: 480px) {
    .settings-card { flex-direction: row; }
}

.settings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
}

.settings-table th,
.settings-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #f0e8da;
    vertical-align: top;
}

.settings-table th {
    background-color: #faf6ef;
    font-weight: bold;
    color: #3E3E3E;
    font-size: 0.88rem;
}

.settings-table tr:last-child td {
    border-bottom: none;
}

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}
.role-admin  { background: #fdf3e7; color: #C19A6B; border: 1px solid #e8d5b8; }
.role-editor { background: #e8f4fd; color: #2980b9; border: 1px solid #c0d8ec; }
.role-viewer { background: #f5f5f5; color: #888;    border: 1px solid #ddd; }

.btn-small {
    padding: 4px 10px;
    font-size: 0.82rem;
    border-radius: 4px;
}

.btn-danger {
    background-color: #e74c3c;
    color: #fff;
    border: none;
}

.btn-danger:hover {
    background-color: #c0392b;
    color: #fff;
}

.action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.inline-form {
    margin-top: 8px;
}

.inline-form-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.form-control-sm {
    padding: 5px 10px;
    font-size: 0.88rem;
    width: auto;
    flex: 1;
    min-width: 120px;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
    align-items: start;
}
@media (max-width: 640px) {
    .form-row-2 { grid-template-columns: 1fr; }
}

.form-row-4 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 16px;
    margin-bottom: 16px;
    align-items: start;
}

.sub-channel-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 4px;
}

.sub-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #faf6ef;
    border: 1px solid #e8d5b8;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.82rem;
    color: #3E3E3E;
}

.sub-delete-btn {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1;
}

.sub-delete-btn:hover {
    color: #e74c3c;
}

.internal-id {
    color: #bbb;
    font-size: 0.82em;
    font-family: monospace;
}

.mt-4 { margin-top: 4px; }

/* ── ROI 分析リンク(ナビ) ── */
.nav-analytics-link {
    color: #3E3E3E;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}
.nav-analytics-link:hover { background: #f5ede0; }

/* === ページフッター (page_footer macro) === */
.page-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    margin-top: 32px;
    border-top: 1px solid #e0d8c8;
    background: #faf6ed;
    flex-wrap: wrap;
    gap: 12px;
}
.page-footer .btn {
    min-height: 44px;
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    cursor: pointer;
    border: none;
}
.footer-left,
.footer-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-back {
    background: #fff;
    color: #6b5b3e;
    border: 1px solid #c8b89a !important;
}
.btn-back:hover {
    background: #f0e8d8;
    text-decoration: none;
    color: #6b5b3e;
}

.btn-save {
    background: #b89968;
    color: #fff;
}
.btn-save:hover {
    background: #a08858;
    color: #fff;
}

.btn-next {
    background: #d99068;
    color: #fff;
}
.btn-next:hover {
    background: #c08058;
    color: #fff;
    text-decoration: none;
}

@media (max-width: 600px) {
    .page-footer { flex-direction: column; }
    .footer-right { width: 100%; justify-content: flex-end; }
}

/* === トップページ CTA === */
.top-cta {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.btn-cta-primary {
    background-color: #C19A6B;
    color: #fff;
    padding: 14px 36px;
    font-size: 1.05rem;
    border-radius: 8px;
    box-shadow: 0 3px 8px rgba(193,154,107,0.3);
}
.btn-cta-primary:hover {
    background-color: #9B7B52;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 5px 14px rgba(193,154,107,0.4);
}

.btn-cta-secondary {
    background-color: #fff;
    color: #C19A6B;
    border: 2px solid #C19A6B;
    padding: 14px 36px;
    font-size: 1.05rem;
    border-radius: 8px;
}
.btn-cta-secondary:hover {
    background-color: #f9f3ec;
    color: #9B7B52;
    border-color: #9B7B52;
    text-decoration: none;
}

/* === TODO-73: ホーム画面 3 ボタン化 === */
.top-cta-3col {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    max-width: 900px;
    margin: 0 auto 16px;
}
.top-cta-3col .btn {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.btn-cta-tertiary {
    background-color: #fff;
    color: #888;
    border: 2px solid #ddd;
    padding: 14px 36px;
    font-size: 1.05rem;
    border-radius: 8px;
}
.btn-cta-disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: auto;  /* tooltip を表示するため */
}
.btn-cta-disabled:hover {
    background-color: #fff;
    color: #888;
    border-color: #ddd;
    text-decoration: none;
}

/* 旧フロー: TODO-74 完了時に削除予定 */
.legacy-link-area {
    margin-top: 8px;
    margin-bottom: 32px;
    text-align: center;
    opacity: 0.6;
}
.legacy-link {
    font-size: 13px;
    color: #888;
    text-decoration: none;
}
.legacy-link:hover {
    color: #555;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .top-cta-3col {
        grid-template-columns: 1fr;
        max-width: 480px;
    }
}

/* === Undo/Redo ツールバー（廃止 → ヘッダーに移動）=== */
.undo-toolbar { display: none; }

/* === ヘッダー内 Undo/Redo ボタン === */
/* === ヘッダー クイックアクセスツールバー === */
.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 16px;
}

/* 保存ボタン(緑系で目立たせる) */
.header-actions .btn-save {
    background-color: #4a8b4a;
    color: #fff;
    border: 1px solid #3a6f3a;
    border-radius: 5px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.10);
    white-space: nowrap;
    font-family: inherit;
}
.header-actions .btn-save:hover {
    background-color: #3a6f3a;
}
.header-actions .btn-save:active {
    background-color: #2e5a2e;
    transform: translateY(1px);
}

/* Undo/Redo ボタン */
.header-actions .btn-undo,
.header-actions .btn-redo {
    background-color: #ffffff;
    border: 2px solid #888;
    color: #555;
    border-radius: 5px;
    padding: 7px 13px;
    font-size: 19px;
    font-weight: 600;
    cursor: pointer;
    min-width: 44px;
    line-height: 1;
    transition: all 0.15s;
    font-family: inherit;
}
/* 操作可能状態: ブランドカラー濃いめ */
.header-actions .btn-undo:not(:disabled),
.header-actions .btn-redo:not(:disabled) {
    border-color: #8a5a26;
    color: #8a5a26;
    background-color: #fff;
}
.header-actions .btn-undo:not(:disabled):hover,
.header-actions .btn-redo:not(:disabled):hover {
    background-color: #b07533;
    border-color: #6a4218;
    color: #fff;
}
/* 無効状態: 輪郭は残す */
.header-actions .btn-undo:disabled,
.header-actions .btn-redo:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    border-color: #aaa;
    color: #888;
    background-color: #f5f5f5;
}

/* Undo/Redo: 入力フォームのない画面では非表示 */
body:not([data-has-undo-form="true"]) .header-actions .btn-undo,
body:not([data-has-undo-form="true"]) .header-actions .btn-redo {
    display: none;
}

/* === Undo フラッシュアニメーション === */
.undo-flash {
    animation: undoFlash 0.8s ease-out;
}
@keyframes undoFlash {
    0%   { background: #ffe4b5; }
    100% { background: transparent; }
}


/* ============================================================
   年間広告宣伝費管理 (annual_budget)
   ============================================================ */

/* ── テーブルラッパー（横スクロール） ── */
.ab-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ── テーブル本体 ── */
.annual-budget-table {
    border-collapse: collapse;
    min-width: 1200px;
    width: 100%;
    font-size: 0.82rem;
}

.annual-budget-table th,
.annual-budget-table td {
    border: 1px solid #e0d5c5;
    padding: 4px 6px;
    vertical-align: middle;
    white-space: nowrap;
}

.annual-budget-table thead th {
    background: #f5f0e8;
    font-weight: 600;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1;
}

/* ── 列幅 ── */
.ab-item-col  { min-width: 120px; max-width: 160px; white-space: normal; }
.ab-month-col { min-width: 100px; text-align: center; }
.ab-total-col { min-width: 110px; text-align: right; background: #f0ebe0; }

/* ── セル ── */
.ab-cell { text-align: center; padding: 4px 4px; }

/* ── 数値 input ── */
.ab-input {
    width: 78px;
    padding: 2px 4px;
    font-size: 0.78rem;
    border: 1px solid #d0c8b8;
    border-radius: 4px;
    text-align: right;
    background: #fff;
}
.ab-input:focus {
    outline: none;
    border-color: #b8962e;
    background: #fffdf5;
}
.ab-input:disabled {
    background: #f5f5f5;
    color: #aaa;
}

/* ── 行末合計セル ── */
.ab-total-cell {
    background: #f0ebe0;
    text-align: right;
    padding: 4px 8px;
}
.ab-total-plan {
    color: #2c5282;
    font-size: 0.8rem;
    font-weight: 600;
}
.ab-total-actual {
    color: #276749;
    font-size: 0.78rem;
}

/* ── フッター行（月合計行） ── */
.ab-footer-row td {
    background: #ece6d8;
    font-weight: 600;
}
.ab-month-total-cell {
    text-align: right;
}

/* ── 全体合計セル（右下） ── */
.ab-grand-total-cell {
    background: #d4edda;
    text-align: right;
    padding: 4px 8px;
    border: 2px solid #28a745;
}
.ab-grand-total-cell .ab-total-plan {
    font-size: 0.9rem;
}

/* ── 項目ラベル列 ── */
.ab-item-label { text-align: left; padding: 6px 8px; }
.ab-item-name  { font-weight: 600; font-size: 0.84rem; }
.ab-item-note  { font-size: 0.72rem; color: #999; margin-top: 2px; }

/* ── KPI カード ── */
.ab-kpi-card { margin-bottom: 16px; }

.ab-kpi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}
@media (max-width: 640px) {
    .ab-kpi-grid { grid-template-columns: 1fr; }
}

.ab-kpi-item {
    background: #faf6ed;
    border: 1px solid #e0d5c5;
    border-radius: 8px;
    padding: 12px 16px;
}
.ab-kpi-label {
    font-size: 0.78rem;
    color: #888;
    margin-bottom: 4px;
}
.ab-kpi-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #3e3e3e;
}
.ab-kpi-sub {
    font-size: 0.82rem;
    color: #666;
    margin-top: 2px;
}

/* ── プログレスバー ── */
.ab-progress-bar {
    height: 8px;
    background: #e0d5c5;
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden;
}
.ab-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}
.ab-progress-plan   { background: #3182ce; }
.ab-progress-actual { background: #38a169; }
.ab-progress-warn   { background: #d69e2e; }
.ab-progress-over   { background: #e53e3e; }

/* ── 予算警告バナー ── */
.budget-banner {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 0.9rem;
}
.budget-banner-danger {
    background: #fff5f5;
    border: 1px solid #fc8181;
    color: #c53030;
}
.budget-banner-warn {
    background: #fffff0;
    border: 1px solid #f6e05e;
    color: #744210;
}

/* ── ツールバー（年度セレクタ + 初期化） ── */
.ab-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.ab-year-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ab-meta-info {
    font-size: 0.78rem;
    color: #999;
    margin-left: auto;
}

/* ── トースト通知 ── */
.ab-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 24px;
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    pointer-events: none;
}
.ab-toast-ok    { background: #38a169; color: #fff; }
.ab-toast-error { background: #e53e3e; color: #fff; }


/* ============================================================
   年間広告宣伝費ページ — 可読性強化・余白最小化
   (.annual-budget-page スコープ、他画面に影響しない)
   ============================================================ */

/* ── コンテナ幅の制約を解除 ── */
.annual-budget-page {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box;
}

/* main-content の max-width を annual_budget ページだけ無効化 */
body:has(.annual-budget-page) .main-content {
    max-width: 100% !important;
    padding: 8px 12px !important;
}

/* ── ページ見出し ── */
.annual-budget-page h1 {
    font-size: 24px !important;
}
.annual-budget-page .page-description {
    font-size: 14px;
}

/* ── テーブルラッパー（横スクロール） ── */
.ab-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 16px 0;
}

/* ── テーブル本体 ── */
.annual-budget-page .annual-budget-table {
    font-size: 15px !important;
    border-collapse: collapse;
    min-width: 1300px;
}

/* ── 月名ヘッダー ── */
.annual-budget-page .annual-budget-table thead th {
    font-size: 15px !important;
    padding: 8px 4px !important;
}

/* ── データセル ── */
.annual-budget-page .annual-budget-table td {
    padding: 4px 6px !important;
}

/* ── 項目名列(縦軸) ── */
.annual-budget-page .annual-budget-table tbody td:first-child {
    font-size: 16px !important;
    font-weight: 600;
    padding: 8px 12px !important;
    min-width: 160px;
}

/* ── 備考テキスト ── */
.annual-budget-page .ab-item-note {
    font-size: 12px !important;
    color: #888;
    display: block;
    margin-top: 2px;
}

/* ── 数値入力欄 ── */
.annual-budget-page .annual-budget-table input[type="number"] {
    width: 100px !important;
    font-size: 15px !important;
    padding: 4px 6px !important;
    text-align: right;
}

/* ── 計/実ラベル ── */
.annual-budget-page .ab-cell-label {
    font-size: 12px !important;
    color: #666;
    width: 16px;
}

/* ── 合計行・合計列 ── */
.annual-budget-page .ab-total-row td,
.annual-budget-page .ab-footer-row td {
    background-color: #f0ebe0;
    font-weight: 600;
    font-size: 15px !important;
}
.annual-budget-page .ab-total-plan,
.annual-budget-page .ab-total-actual {
    font-size: 14px !important;
}

/* ── KPI サマリー ── */
.annual-budget-page .ab-kpi-card {
    font-size: 15px;
}
.annual-budget-page .ab-kpi-value {
    font-size: 24px !important;
}
.annual-budget-page .ab-kpi-label {
    font-size: 13px !important;
}
.annual-budget-page .ab-kpi-sub {
    font-size: 14px !important;
}


/* ============================================================
   ステータスタブ UI (home.html)
   ============================================================ */

.event-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 0;
    border-bottom: 2px solid #e0d4b8;
    align-items: flex-end;
    flex-wrap: wrap;
}

.event-tab {
    padding: 10px 18px;
    background: #f5ead4;
    border: 1.5px solid #e0d4b8;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    transition: all 0.15s;
    font-family: inherit;
}
.event-tab:hover {
    background: #ead8a8;
}
.event-tab.active {
    background: #fff;
    color: #b07533;
    font-weight: 600;
    border-color: #b07533;
    margin-bottom: -2px;
    padding-bottom: 12px;
}
.event-tab .tab-count {
    background: rgba(176, 117, 51, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    margin-left: 6px;
}
.event-tab.active .tab-count {
    background: rgba(176, 117, 51, 0.25);
}

.archived-link {
    margin-left: auto;
    font-size: 13px;
    color: #888;
    text-decoration: underline;
    cursor: pointer;
    padding: 8px 4px;
    align-self: center;
}
.archived-link:hover {
    color: #555;
}

/* ============================================================
   ステータスバッジ
   ============================================================ */

.event-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    margin-left: 8px;
    vertical-align: middle;
}
.event-status-draft     { background-color: #888; }
.event-status-active    { background-color: #4a78b8; }
.event-status-completed { background-color: #4a8b4a; }
.event-status-archived  { background-color: #aaa; }


/* ============================================================
   イベント操作ボタン群 (event_detail.html)
   ============================================================ */

.event-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e0d4b8;
}
.event-actions button,
.event-actions .btn-edit,
.event-actions .btn-promote,
.event-actions .btn-duplicate,
.event-actions .btn-archive,
.event-actions .btn-delete,
.event-actions .btn-restore,
.event-actions .btn-purge {
    padding: 8px 18px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: background-color 0.15s, transform 0.1s;
}
.event-actions button:active { transform: translateY(1px); }

/* 編集(スレートブルー) */
.btn-edit {
    background-color: #6a8caf;
    color: #fff;
    border: 1px solid #4a6a8a !important;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.btn-edit:hover { background-color: #4a6a8a; color: #fff; text-decoration: none; }

/* 採用(青) */
.btn-promote {
    background-color: #4a78b8;
    color: #fff;
    border: 1px solid #3a5d8f !important;
}
.btn-promote:hover { background-color: #3a5d8f; }

/* 複製(ブランド茶) */
.btn-duplicate {
    background-color: #b07533;
    color: #fff;
    border: 1px solid #8a5a26 !important;
}
.btn-duplicate:hover { background-color: #8a5a26; }

/* アーカイブ(グレー) */
.btn-archive {
    background-color: #888;
    color: #fff;
    border: 1px solid #666 !important;
}
.btn-archive:hover { background-color: #666; }

/* 削除(赤) */
.btn-delete {
    background-color: #c44444;
    color: #fff;
    border: 1px solid #993333 !important;
}
.btn-delete:hover { background-color: #993333; }

/* 復元(青) */
.btn-restore {
    background-color: #4a78b8;
    color: #fff;
    border: 1px solid #3a5d8f !important;
    padding: 6px 14px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.btn-restore:hover { background-color: #3a5d8f; }

/* 結果サマリーコピー(ベージュ系) */
.btn-summary-copy {
    background-color: #f0ebe0;
    color: #6b5b3e;
    border: 1px solid #c8b89a !important;
}
.btn-summary-copy:hover { background-color: #e0d8c8; }

/* 完全削除(濃い赤) */
.btn-purge {
    background-color: #880000;
    color: #fff;
    border: 1px solid #660000 !important;
    padding: 6px 14px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.btn-purge:hover { background-color: #660000; }

/* ────────────────────────────────────────── */
/*  Phase 4.X.6: OCR フィールド警告マーキング  */
/* ────────────────────────────────────────── */
.ocr-warning-field {
    background: #fff3cd !important;
    border-color: #ffc107 !important;
    border-width: 2px !important;
}
.ocr-warning-icon {
    color: #f57c00;
    margin-right: 4px;
    font-weight: bold;
}
.ocr-warning-label {
    color: #d32f2f;
    font-size: 0.85em;
    margin-top: 2px;
    display: block;
}

/* OCR visitor 一覧テーブル */
.visitor-list-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}
.visitor-list-table th,
.visitor-list-table td {
    border: 1px solid #e0d5c5;
    padding: 6px 10px;
    text-align: left;
    font-size: 0.92rem;
}
.visitor-list-table thead {
    background: #faf5ee;
}
.visitor-list-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}
.visitor-list-table tbody tr:hover {
    background: #fffaf0;
}
.visitor-list-table .name-empty {
    color: #d32f2f;
    font-style: italic;
}
.confidence-high   { color: #2c7;   }
.confidence-medium { color: #d68a00; }
.confidence-low    { color: #d32f2f; }
.row-status-confirmed { color: #2c7; font-weight: 600; }
.row-status-pending   { color: #888; }

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
/* Phase A Step A-4: マスタ管理画面用              */
/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */
.dynamic-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px;
    background: #fafaf7;
    border: 1px solid #e0d8ce;
    border-radius: 4px;
}
.dynamic-list-handle {
    width: 32px;
    text-align: center;
    color: #999;
    font-weight: 600;
    flex-shrink: 0;
}

/* Phase A Step A-4r: ブランドコア閲覧モード（readonly） */
form[data-readonly="true"] input,
form[data-readonly="true"] textarea,
form[data-readonly="true"] select {
    background-color: #f5f3ee !important;
    cursor: not-allowed;
    color: #555;
}
form[data-readonly="true"] button[type="button"] {
    display: none !important;
}

/* ★Step 4X4v4-4-correct.3d: マスター並べ替え */
.sortable-rows .drag-handle,
.sortable-rows .drag-handle-cell {
    cursor: grab;
    color: #888;
    text-align: center;
    font-size: 1.1rem;
    user-select: none;
    width: 32px;
    padding: 0 6px;
}
.sortable-rows .drag-handle:hover,
.sortable-rows .drag-handle-cell:hover {
    color: #B8860B;
    background: #FFFBEF;
}
.sortable-ghost {
    opacity: 0.4;
    background: #FFF8E0 !important;
}
.sortable-chosen {
    background: #FFFBEF !important;
}
.sortable-status {
    font-size: 0.82rem;
    margin-top: 6px;
    min-height: 1.2em;
}

/* ★Step 4X4v4-4-correct.4 [B/4]: 進捗バー + 続きから CTA */
.step-progress {
    display: flex; align-items: center; gap: 6px;
    margin: 12px 0 16px; flex-wrap: wrap;
}
.step-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 16px;
    background: #f4f4f4; color: #888; font-size: 0.88rem;
    border: 1px solid transparent;
    transition: all 0.15s;
}
.step-pill__num {
    font-weight: 600;
    min-width: 1.2em;
    text-align: center;
}
.step-pill__sep { color: #ccc; font-weight: bold; padding: 0 2px; }
.step-pill--started {
    background: #fff3e0; color: #c66f00; border-color: #f5d2a0;
}
.step-pill--done {
    background: #d4edda; color: #1e7e34; border-color: #b2d8b8;
}
.step-pill--current {
    background: #c8956d; color: #fff; border-color: #c8956d;
    box-shadow: 0 2px 6px rgba(200,149,109,0.4);
}
.workflow-actions {
    display: flex; align-items: center; gap: 16px;
    flex-wrap: wrap; margin-top: 6px;
}
.btn-lg { padding: 10px 22px; font-size: 1.02rem; }
.workflow-jumps {
    display: inline-flex; gap: 4px; flex-wrap: wrap;
}
.workflow-jumps .btn-link {
    color: #888; text-decoration: none; font-size: 0.85rem;
    padding: 4px 10px; border-radius: 4px;
    border: 1px solid #ddd; background: #fafafa;
}
.workflow-jumps .btn-link:hover {
    color: #c8956d; background: #fff8f0; border-color: #c8956d;
}

/* ★Step 4X4v4-4-correct.4 [C/4]: キャンペーン一覧カード + 続きからボタン */
.campaign-card-wrap {
    display: flex; flex-direction: column;
    background: #fff;
    border: 1px solid #e0d5c5;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    overflow: hidden;
}
.campaign-card-wrap > .campaign-card-main {
    border: none; box-shadow: none; border-radius: 0;
    flex: 1;
}
.campaign-card-wrap > .campaign-card-main:hover {
    box-shadow: none; border-color: transparent;
}
.campaign-card-wrap:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #C19A6B;
}
.campaign-card-footer {
    padding: 8px 14px 12px;
    border-top: 1px solid #f0e8d8;
    background: #fafaf3;
    display: flex; justify-content: flex-end;
}
.btn-resume {
    background: #c8956d; border-color: #c8956d; color: #fff;
}
.btn-resume:hover {
    background: #b07e58; border-color: #b07e58; color: #fff;
}
.campaign-card-progress {
    display: inline-flex; gap: 3px; margin: 6px 0 6px;
    align-items: center;
}
.step-mini-pill {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px;
    padding: 0 6px; border-radius: 11px;
    background: #eee; color: #aaa; font-size: 0.75rem;
    font-weight: 600;
}
.step-mini-pill--started {
    background: #fff3e0; color: #c66f00;
}
.step-mini-pill--done {
    background: #d4edda; color: #1e7e34;
}

/* ★Step 4X4v4-4-correct.4 [D/4]: TOP「進行中のキャンペーン」セクション */
.in-progress-campaigns {
    background: #fff8f0;
    border-left: 4px solid #c8956d;
    padding: 16px 20px;
    margin: 18px 0 24px;
    border-radius: 6px;
}
.in-progress-campaigns h2 {
    margin: 0 0 4px;
    font-size: 1.05rem;
    color: #b07e58;
    border: none;
    padding: 0;
}
.in-progress-campaigns .hint {
    margin: 0 0 10px;
    font-size: 0.85rem;
    color: #888;
}
.in-progress-list {
    display: flex; flex-direction: column; gap: 8px;
}
.in-progress-card {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #f0e0c8;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    transition: all 0.15s;
}
.in-progress-card:hover {
    background: #fef5ea;
    border-color: #c8956d;
    transform: translateX(2px);
    text-decoration: none;
}
.in-progress-card__icon { font-size: 1.4rem; flex-shrink: 0; }
.in-progress-card__name { font-weight: 600; flex: 1; min-width: 0; }
.in-progress-card__step {
    font-size: 0.85rem; color: #888;
    background: #f4f4f4; padding: 2px 10px; border-radius: 12px;
}
.in-progress-card__cta {
    color: #c8956d; font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
}
