/* PBN Manager - Main Stylesheet */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --white: #ffffff;
    --bg: #f8fafc;
    --sidebar-bg: #0f172a;
    --blue: #3b82f6;
    --green: #10b981;
    --orange: #f59e0b;
    --red: #ef4444;
    --cyan: #06b6d4;
    --purple: #8b5cf6;
    --pink: #ec4899;
    --text: #1e293b;
    --text-md: #475569;
    --text-lt: #94a3b8;
    --border: #e2e8f0;
}
body { font-family: 'Inter', 'Noto Sans TC', 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); font-size: 12px; }

/* Sidebar */
.sidebar { position: fixed; left: 0; top: 0; width: 200px; height: 100vh; background: var(--sidebar-bg); display: flex; flex-direction: column; z-index: 100; }
.sidebar-header { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.logo { display: flex; align-items: center; gap: 8px; }
.logo-icon { width: 28px; height: 28px; background: linear-gradient(135deg, var(--blue), var(--purple)); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.logo-text { font-size: 14px; font-weight: 700; color: #fff; }
.nav-menu { flex: 1; padding: 10px 6px; overflow-y: auto; }
.nav-label { font-size: 9px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 1px; padding: 8px 8px 4px; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 5px; color: #cbd5e1; text-decoration: none; font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.1s; margin-bottom: 1px; }
.nav-item:hover { background: #1e293b; color: #fff; }
.nav-item.active { background: var(--blue); color: #fff; }
.nav-item .icon { font-size: 12px; width: 16px; text-align: center; }
.nav-badge { margin-left: auto; background: rgba(255,255,255,0.15); color: #fff; font-size: 9px; padding: 1px 5px; border-radius: 6px; }

/* Main content */
.main { margin-left: 200px; min-height: 100vh; }
.topbar { background: var(--white); border-bottom: 1px solid var(--border); padding: 10px 16px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 50; }
.page-title { font-size: 14px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.page-title .icon { font-size: 16px; }
.topbar-r { display: flex; align-items: center; gap: 10px; }

.btn { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 4px; font-size: 11px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all 0.1s; font-family: inherit; }
.btn-p { background: var(--blue); color: white; border-color: var(--blue); }
.btn-p:hover { background: #2563eb; }
.btn-s { background: var(--white); color: var(--text); border-color: var(--border); }
.btn-s:hover { border-color: var(--blue); }
.btn-g { background: var(--green); color: white; }
.btn-g:hover { background: #059669; }
.btn-o { background: var(--orange); color: white; }
.btn-o:hover { background: #d97706; }
.btn-r { background: var(--red); color: white; }
.btn-r:hover { background: #dc2626; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 3px 8px; font-size: 10px; }
.btn-lg { padding: 8px 16px; font-size: 13px; }

.content { padding: 12px 16px; }

/* Module blocks */
.module { background: var(--white); border: 1px solid var(--border); border-radius: 6px; margin-bottom: 16px; display: none; }
.module.active { display: block; }
.module-h { padding: 10px 14px; border-bottom: 1px solid var(--border); background: linear-gradient(90deg, #f8fafc, #fff); display: flex; justify-content: space-between; align-items: center; }
.module-t { font-size: 13px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.module-t .num { background: var(--blue); color: white; font-size: 10px; padding: 2px 6px; border-radius: 4px; }

/* Form elements */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; padding: 14px; }
.form-group { margin-bottom: 0; }
.form-label { display: block; font-size: 11px; font-weight: 600; color: var(--text-md); margin-bottom: 4px; }
.form-label .req { color: var(--red); }
.form-input { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; transition: border-color 0.1s; font-family: inherit; }
.form-input:focus { outline: none; border-color: var(--blue); }
.form-input::placeholder { color: var(--text-lt); }
.form-select { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; background: var(--white); font-family: inherit; }
.form-textarea { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; min-height: 80px; resize: vertical; font-family: inherit; }
.form-hint { font-size: 10px; color: var(--text-lt); margin-top: 2px; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

/* Cards */
.card { background: var(--white); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.card-h { padding: 8px 12px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: #fafbfc; }
.card-t { font-size: 12px; font-weight: 700; color: var(--text); }
.card-body { padding: 12px; }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; padding: 6px 10px; font-size: 10px; font-weight: 600; color: var(--text-lt); text-transform: uppercase; background: #f8fafc; border-bottom: 1px solid var(--border); }
.tbl td { padding: 8px 10px; font-size: 11px; color: var(--text); border-bottom: 1px solid #f1f5f9; }
.tbl tr:hover td { background: #f8fafc; }

.tag { display: inline-block; padding: 2px 6px; border-radius: 3px; font-size: 10px; font-weight: 500; }
.tag-blue { background: #dbeafe; color: #2563eb; }
.tag-green { background: #d1fae5; color: #059669; }
.tag-orange { background: #fef3c7; color: #d97706; }
.tag-red { background: #fee2e2; color: #dc2626; }
.tag-purple { background: #ede9fe; color: #7c3aed; }
.tag-gray { background: #f1f5f9; color: #64748b; }
.tag-pink { background: #fce7f3; color: #db2777; }

.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.dot-g { background: var(--green); }
.dot-o { background: var(--orange); }
.dot-r { background: var(--red); }

.mono { font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace; }
.ctr { text-align: center; }
.rgt { text-align: right; }
.bld { font-weight: 700; }

.act { width: 22px; height: 22px; border-radius: 3px; border: 1px solid var(--border); background: var(--white); cursor: pointer; font-size: 10px; display: inline-flex; align-items: center; justify-content: center; margin-right: 2px; }
.act:hover { border-color: var(--blue); background: #eff6ff; }

/* Tabs */
.tabs { display: flex; gap: 2px; padding: 0 14px; background: #f8fafc; border-bottom: 1px solid var(--border); }
.tab { padding: 8px 14px; font-size: 11px; font-weight: 500; color: var(--text-md); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.1s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* Divider & section */
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.section-t { font-size: 11px; font-weight: 700; color: var(--text); margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

/* Toggle switch */
.switch { position: relative; width: 36px; height: 20px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #cbd5e1; border-radius: 20px; transition: 0.2s; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 2px; bottom: 2px; background: white; border-radius: 50%; transition: 0.2s; }
input:checked + .slider { background: var(--blue); }
input:checked + .slider:before { transform: translateX(16px); }

/* Pagination */
.pagination { padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); background: #fafbfc; }
.pg-info { font-size: 10px; color: var(--text-lt); }
.pgs { display: flex; gap: 2px; }
.pg { min-width: 24px; height: 24px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--border); background: var(--white); cursor: pointer; font-size: 10px; color: var(--text-md); display: inline-flex; align-items: center; justify-content: center; font-family: inherit; }
.pg:hover { border-color: var(--blue); color: var(--blue); }
.pg.on { background: var(--blue); color: white; border-color: var(--blue); }

/* Layout helpers */
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* Field description table */
.field-tbl { width: 100%; }
.field-tbl th { background: #f1f5f9; padding: 6px 10px; font-size: 10px; text-align: left; }
.field-tbl td { padding: 6px 10px; font-size: 11px; border-bottom: 1px solid #f1f5f9; }
.field-name { font-weight: 600; color: var(--blue); font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace; }
.field-type { font-size: 10px; color: var(--text-lt); font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace; }

/* Progress bars */
.progress { height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; }
.progress-fill.blue { background: linear-gradient(90deg, var(--blue), #60a5fa); }
.progress-fill.green { background: linear-gradient(90deg, var(--green), #34d399); }
.progress-fill.orange { background: linear-gradient(90deg, var(--orange), #fbbf24); }

/* Stat cards */
.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { background: var(--white); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.stat-icon { width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.stat-icon.blue { background: #dbeafe; }
.stat-icon.green { background: #d1fae5; }
.stat-icon.orange { background: #fef3c7; }
.stat-icon.purple { background: #ede9fe; }
.stat-icon.cyan { background: #cffafe; }
.stat-icon.teal { background: #ccfbf1; }
.stat-icon.pink { background: #fce7f3; }
.stat-v { font-size: 16px; font-weight: 700; color: var(--text); font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace; }
.stat-l { font-size: 10px; color: var(--text-lt); }

/* Code block */
.code-block { background: #1e293b; color: #e2e8f0; padding: 10px; border-radius: 4px; font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace; font-size: 11px; overflow-x: auto; }

/* Alert */
.alert { padding: 10px 12px; border-radius: 4px; font-size: 11px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.alert-info { background: #dbeafe; color: #1e40af; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-warning { background: #fef3c7; color: #92400e; }

/* Search/filter bar */
.filter-bar { display: flex; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); align-items: center; flex-wrap: wrap; }
.filter-bar .form-input,
.filter-bar .form-select { width: auto; min-width: 140px; padding: 5px 8px; }

/* ===== Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000; display: none; align-items: center; justify-content: center; }
.modal-overlay.show { display: flex; }
.modal-box { background: var(--white); border-radius: 8px; width: 600px; max-width: 95vw; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal-header { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 14px; font-weight: 700; color: var(--text); }
.modal-close { width: 28px; height: 28px; border: none; background: none; font-size: 18px; cursor: pointer; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: var(--text-lt); }
.modal-close:hover { background: #f1f5f9; color: var(--text); }
.modal-body { padding: 16px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ===== Toast notifications ===== */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 6px; font-size: 12px; font-weight: 500; color: white; pointer-events: auto; animation: toastIn 0.3s ease; min-width: 240px; max-width: 400px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); display: flex; align-items: center; gap: 8px; }
.toast.hide { animation: toastOut 0.3s ease forwards; }
.toast-success { background: #059669; }
.toast-error { background: #dc2626; }
.toast-warning { background: #d97706; }
.toast-info { background: #2563eb; }
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100%); } }

/* ===== Loading overlay ===== */
.loading-overlay { position: absolute; inset: 0; background: rgba(255,255,255,0.7); display: flex; align-items: center; justify-content: center; z-index: 10; }
.loading-spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Inline loading for module containers */
.module { position: relative; }

/* Confirm dialog */
.confirm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1100; display: flex; align-items: center; justify-content: center; }
.confirm-box { background: var(--white); border-radius: 8px; padding: 24px; width: 380px; max-width: 90vw; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.confirm-msg { font-size: 13px; color: var(--text); margin-bottom: 20px; line-height: 1.6; }
.confirm-btns { display: flex; gap: 8px; justify-content: center; }

/* Tab pane visibility */
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Truncate text */
.truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Empty state */
.empty-state { padding: 40px 20px; text-align: center; color: var(--text-lt); font-size: 13px; }

/* URL link */
.url-link {
    color: #3b82f6;
    text-decoration: none;
    cursor: pointer;
}
.url-link:hover {
    text-decoration: underline;
}

/* Auth - user display */
.user-name { font-size: 11px; font-weight: 600; color: var(--text-md); }
.btn-logout { font-size: 10px; padding: 3px 8px; color: var(--red); border-color: var(--red); }
.btn-logout:hover { background: var(--red); color: #fff; }

/* Article title cell */
.article-title-cell {
    max-width: 400px;
}
.article-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.article-site {
    font-size: 0.8rem;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    margin-top: 2px;
}

/* Article editor modal */
.modal-box.modal-xl {
    width: 90%;
    max-width: 1200px;
    height: 85vh;
    max-height: 900px;
}
.modal-box.modal-xl .modal-body {
    overflow-y: auto;
    max-height: calc(85vh - 120px);
    padding: 20px;
}
.edit-form-group {
    margin-bottom: 16px;
}
.edit-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-md);
    margin-bottom: 6px;
}
.edit-form-group input,
.edit-form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s;
}
.edit-form-group input:focus,
.edit-form-group textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.edit-meta-bar {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--text-md);
    margin-bottom: 16px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 6px;
}
.edit-meta-bar span {
    font-weight: 600;
    color: var(--text);
}
.edit-image-preview {
    margin-top: 8px;
    text-align: center;
}
.edit-image-preview img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 6px;
    border: 1px solid var(--border);
}
.edit-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

/* Generate Wizard */
.generate-wizard { padding: 16px; }
.wizard-steps { display: flex; justify-content: space-between; margin-bottom: 20px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.wizard-step { display: flex; flex-direction: column; align-items: center; gap: 6px; opacity: 0.4; transition: all 0.2s; flex: 1; }
.wizard-step.active, .wizard-step.completed { opacity: 1; }
.step-num { width: 30px; height: 30px; border-radius: 50%; background: #e2e8f0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; color: #64748b; transition: all 0.2s; }
.wizard-step.active .step-num { background: var(--blue); color: #fff; }
.wizard-step.completed .step-num { background: var(--green); color: #fff; }
.step-label { font-size: 11px; color: var(--text-lt); }
.wizard-step.active .step-label { color: var(--blue); font-weight: 600; }
.wizard-step.completed .step-label { color: var(--green); }

.wizard-panel { display: none; background: #fff; border-radius: 10px; padding: 24px; border: 1px solid var(--border); }
.wizard-panel.active { display: block; }
.step-header h3 { font-size: 15px; font-weight: 700; color: var(--text); margin: 0 0 6px; }
.step-desc { font-size: 12px; color: var(--text-md); margin: 0 0 20px; line-height: 1.6; }
.step-content { margin-bottom: 20px; }
.step-actions { display: flex; gap: 10px; justify-content: space-between; align-items: center; padding-top: 16px; border-top: 1px solid var(--border); }

.wiz-form-group { margin-bottom: 16px; }
.wiz-form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-hint { display: block; font-size: 11px; color: var(--text-lt); margin-top: 4px; }
.form-select-lg, .form-input-lg { padding: 10px 12px !important; font-size: 13px !important; }

/* Site info card */
.site-info-card { margin-top: 12px; border-radius: 8px; border: 1px solid var(--border); overflow: hidden; }
.site-info-header { background: var(--bg); padding: 8px 12px; font-size: 11px; font-weight: 600; color: var(--text-md); }
.site-info-body { padding: 10px 12px; font-size: 12px; line-height: 1.8; }
.site-info-body p { margin: 0; }

/* Prompt toolbar & tips */
.prompt-toolbar { display: flex; gap: 8px; margin-bottom: 10px; }
.prompt-tips { background: #fefce8; border: 1px solid #fde68a; border-radius: 8px; padding: 12px 14px; margin-top: 12px; font-size: 11px; }
.prompt-tips strong { font-size: 12px; color: #92400e; }
.prompt-tips ul { margin: 6px 0 0 16px; padding: 0; }
.prompt-tips li { margin: 4px 0; color: #78350f; }

/* AI Provider cards */
.ai-provider-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.ai-card { border: 2px solid var(--border); border-radius: 8px; padding: 14px; cursor: pointer; transition: all 0.15s; }
.ai-card:hover { border-color: var(--blue); background: #f0f9ff; }
.ai-card.selected { border-color: var(--blue); background: #eff6ff; box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.ai-card .ai-card-name { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.ai-card .ai-card-model { font-size: 11px; color: var(--text-lt); }
.ai-card .ai-card-cost { font-size: 11px; color: var(--green); margin-top: 6px; }

/* Summary card */
.summary-card { background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.summary-card h4 { margin: 0 0 12px; font-size: 13px; color: #0369a1; }
.summary-table { width: 100%; font-size: 12px; }
.summary-table td { padding: 6px 0; border-bottom: 1px solid #e0f2fe; }
.summary-table td:first-child { color: var(--text-md); width: 100px; }
.summary-table td:last-child { font-weight: 500; }

/* Generate options */
.generate-options { display: flex; flex-direction: column; gap: 10px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 12px; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--blue); }

/* Task title cell (content generation task list) */
.task-title-cell {
    max-width: 300px;
}
.task-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.task-keyword {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 2px;
}

/* ===== Site Cell (三行顯示：code / name / url) ===== */
.site-cell { line-height: 1.4; }
.site-code { font-weight: 600; }
.site-name { font-size: 12px; color: #374151; margin-top: 2px; }
.site-url { display: block; font-size: 11px; color: #9ca3af; text-decoration: none; word-break: break-all; margin-top: 1px; }
.site-url:hover { text-decoration: underline; color: #6b7280; }

/* ===== Publish Schedule (m8) ===== */
.ps-progress-cards {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.ps-progress-card {
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px 20px;
    text-align: center;
    min-width: 90px;
    border: 1px solid var(--border);
}
.ps-card-green { background: #dcfce7; border-color: #bbf7d0; }
.ps-card-orange { background: #fef3c7; border-color: #fde68a; }
.ps-card-blue { background: #dbeafe; border-color: #bfdbfe; }
.ps-card-red { background: #fee2e2; border-color: #fecaca; }
.ps-card-purple { background: #e0e7ff; border-color: #c7d2fe; }
.ps-card-value {
    font-size: 1.6rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
}
.ps-card-label {
    font-size: 10px;
    color: var(--text-md);
    margin-top: 2px;
}
.ps-overview-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}
.ps-stat-box {
    background: #f1f5f9;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    flex: 1;
    border: 1px solid var(--border);
}
.ps-stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
}
.ps-stat-text {
    font-size: 10px;
    color: var(--text-md);
    margin-top: 2px;
}

/* ===== Run Now 馬上執行 ===== */
.rn-progress-bar-wrap {
    width: 100%;
    height: 20px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}
.rn-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--purple));
    border-radius: 10px;
    transition: width 0.3s ease;
}
.rn-exec-log {
    max-height: 260px;
    overflow-y: auto;
    background: #1e293b;
    border-radius: 6px;
    padding: 10px;
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
    font-size: 11px;
}
.rn-log-entry {
    padding: 4px 0;
    border-bottom: 1px solid #334155;
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.rn-log-entry:last-child { border-bottom: none; }
.rn-log-time { color: #64748b; font-size: 10px; flex-shrink: 0; }
.rn-log-msg { color: #e2e8f0; }
.rn-log-success .rn-log-msg { color: #4ade80; }
.rn-log-error .rn-log-msg { color: #f87171; }
.rn-log-warning .rn-log-msg { color: #fbbf24; }

.rn-results-stats {
    display: flex;
    gap: 16px;
    justify-content: center;
}
.rn-stat-card {
    text-align: center;
    padding: 16px 32px;
    border-radius: 8px;
}
.rn-stat-success { background: #dcfce7; }
.rn-stat-fail { background: #fee2e2; }
.rn-stat-num {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
}
.rn-stat-label {
    font-size: 11px;
    color: var(--text-md);
    margin-top: 2px;
}

/* ===== Calendar 日曆 ===== */
.ps-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.ps-cal-hdr {
    background: #f1f5f9;
    padding: 8px 4px;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-md);
}
.ps-cal-cell {
    background: #fff;
    min-height: 72px;
    padding: 4px 6px;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}
.ps-cal-cell:hover { background: #f8fafc; }
.ps-cal-other { opacity: 0.35; }
.ps-cal-today { background: #eff6ff !important; }
.ps-cal-today .ps-cal-day { color: #2563eb; font-weight: 700; }
.ps-cal-selected { background: #e0f2fe !important; box-shadow: inset 0 0 0 2px #3b82f6; }
.ps-cal-has { cursor: pointer; }
.ps-cal-day { font-size: 12px; font-weight: 500; color: var(--text-md); margin-bottom: 2px; }
.ps-cal-badge {
    position: absolute;
    top: 4px; right: 6px;
    background: #6366f1;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    min-width: 16px;
    text-align: center;
}
.ps-cal-dots { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 2px; }
.ps-cal-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* ===== Keyword Module: Period Selector ===== */
.kw-period-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.kw-year-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 4px;
    flex-shrink: 0;
}
.kw-year-nav button {
    width: 22px;
    height: 22px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-md);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}
.kw-year-nav button:hover { background: var(--bg); color: var(--blue); }
.kw-year-label { font-weight: 700; font-size: 12px; min-width: 50px; text-align: center; }
.kw-month-tabs {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    background: var(--white);
    flex-shrink: 0;
}
.kw-month-tab {
    padding: 4px 7px;
    font-size: 11px;
    cursor: pointer;
    border-right: 1px solid var(--border);
    text-align: center;
    min-width: 28px;
    user-select: none;
    transition: all 0.1s;
    font-family: inherit;
}
.kw-month-tab:last-child { border-right: none; }
.kw-month-tab:hover { background: #f8fafc; }
.kw-month-tab.active { background: var(--blue); color: white; }
.kw-month-tab.all { min-width: 36px; font-weight: 600; }
.kw-period-info {
    margin-left: auto;
    display: flex;
    gap: 14px;
    font-size: 11px;
    color: var(--text-lt);
    flex-shrink: 0;
}
.kw-period-info .kw-stat { display: flex; align-items: center; gap: 3px; }
.kw-period-info .kw-stat-num { font-weight: 700; color: var(--text); font-family: 'JetBrains Mono', monospace; }
.kw-period-info .kw-stat-num.hl { color: var(--blue); }

/* ===== Keyword Module: Expandable Rows ===== */
.kw-row-clickable { cursor: pointer; }
.kw-row-clickable:hover td { background: #f8fafc; }
.kw-row-clickable.expanded td { background: #f1f5f9; }
.kw-expand-icon {
    display: inline-flex;
    width: 16px;
    height: 16px;
    align-items: center;
    justify-content: center;
    color: var(--text-lt);
    font-size: 9px;
    transition: transform 0.2s;
    margin-right: 4px;
    flex-shrink: 0;
}
.kw-row-clickable.expanded .kw-expand-icon { transform: rotate(90deg); }
.kw-variant-count { color: var(--blue); font-weight: 600; }
.kw-variant-count.empty { color: var(--text-lt); font-weight: 400; }

/* ===== Keyword Module: Variants Sub-Row ===== */
.kw-variants-row { display: none; }
.kw-variants-row.show { display: table-row; }
.kw-variants-row > td { padding: 0 !important; border-bottom: 1px solid var(--border); background: #f8fafc; }
.kw-variants-wrap { padding: 10px 14px 10px 40px; }
.kw-variants-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.kw-variants-title { font-size: 11px; font-weight: 600; color: var(--text-md); }
.kw-variants-tbl { width: 100%; border-collapse: collapse; font-size: 11px; background: var(--white); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.kw-variants-tbl th { padding: 5px 8px; text-align: left; background: #f5f5f5; font-weight: 600; color: var(--text-lt); font-size: 10px; border-bottom: 1px solid var(--border); }
.kw-variants-tbl td { padding: 5px 8px; border-bottom: 1px solid #f0f0f0; }
.kw-variants-tbl tbody tr:last-child td { border-bottom: none; }
.kw-variants-tbl tbody tr:hover td { background: #fafbfc; }

.kw-vtype { font-size: 10px; padding: 1px 5px; border-radius: 3px; white-space: nowrap; display: inline-block; }
.kw-vtype-synonym { background: #dbeafe; color: #1e40af; }
.kw-vtype-longtail { background: #dcfce7; color: #166534; }
.kw-vtype-colloquial { background: #fef3c7; color: #92400e; }
.kw-vtype-contextual { background: #f3e8ff; color: #7c3aed; }

/* ===== Keyword Module: Stats Modal ===== */
.kw-stats-tbl { width: 100%; border-collapse: collapse; font-size: 12px; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.kw-stats-tbl th { padding: 8px 7px; text-align: center; background: #f5f5f5; font-weight: 600; color: var(--text-md); border-bottom: 1px solid var(--border); font-size: 11px; white-space: nowrap; }
.kw-stats-tbl th:first-child { text-align: left; min-width: 110px; }
.kw-stats-tbl td { padding: 8px 7px; border-bottom: 1px solid #f0f0f0; text-align: center; white-space: nowrap; }
.kw-stats-tbl td:first-child { text-align: left; font-weight: 500; }
.kw-stats-tbl tbody tr:hover { background: #fafafa; }
.kw-stats-tbl .kw-current-month { background: #dcfce7; font-weight: 600; color: #059669; }
.kw-stats-tbl .kw-total-row { background: #f8fafc; font-weight: 700; }
.kw-stats-tbl .kw-total-row td { border-top: 2px solid var(--border); border-bottom: none; }
.kw-stats-tbl .kw-last-used { font-size: 10px; color: var(--text-lt); }

/* ============================================================
   Phase 3 - Wizard Step 2 樣式
   Append 到 static/css/style.css 末端
   ============================================================ */

/* 區塊容器 */
.wiz-section {
    background: #fafbfc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
}
.wiz-section-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 12px;
    color: #1e293b;
}

/* 模式切換 tabs */
.wiz-mode-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}
.mode-tab {
    padding: 7px 14px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    color: #64748b;
    font-size: 13px;
    transition: all 0.15s;
}
.mode-tab:hover { color: #1e293b; }
.mode-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
    font-weight: 500;
}
.kw-mode-panel,
.topic-mode-panel {
    display: none;
}
.kw-mode-panel.active,
.topic-mode-panel.active {
    display: block;
}

/* 資訊 banner */
.info-banner {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 12px;
    color: #1e40af;
    line-height: 1.5;
}

/* 預覽區 */
.preview-area {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 12px 14px;
    margin-top: 12px;
}
.preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.preview-header strong {
    flex: 1;
    font-size: 13px;
    color: #0c4a6e;
}
.preview-section {
    padding: 8px 0;
    border-bottom: 1px dashed #bfdbfe;
}
.preview-section:last-child { border-bottom: none; }
.preview-label {
    font-size: 11px;
    color: #475569;
    margin-bottom: 4px;
    font-weight: 500;
}
.preview-row { padding: 4px 0; font-size: 12px; }
.anchor-tag {
    display: inline-block;
    padding: 2px 10px;
    background: white;
    border: 1px solid #93c5fd;
    border-radius: 4px;
    color: #1e40af;
    font-weight: 500;
    font-size: 13px;
}
.anchor-tag-sm {
    display: inline-block;
    padding: 1px 7px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    color: #334155;
    font-size: 12px;
}
.preview-url {
    color: #3b82f6;
    font-size: 11px;
    word-break: break-all;
    margin-top: 3px;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
}
.preview-warning {
    background: #fef3c7;
    color: #78350f;
    padding: 7px 11px;
    border-radius: 4px;
    font-size: 11px;
    margin-top: 10px;
}
.muted { color: #94a3b8; font-weight: normal; margin-left: 4px; }

/* LSI 區 */
.lsi-area {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 6px;
    padding: 10px 14px;
    margin-top: 12px;
}
.lsi-header {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
}
.lsi-header strong {
    flex: 1;
    font-size: 13px;
    color: #166534;
}
.lsi-count {
    background: #bbf7d0;
    color: #14532d;
    padding: 2px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}
#w2-lsi-list {
    font-size: 12px;
    color: #166534;
    line-height: 1.6;
}

/* 警告 */
.warning-box {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    padding: 10px 14px;
    color: #78350f;
    font-size: 12px;
    margin-top: 10px;
    line-height: 1.5;
}

/* 加入主庫 */
.add-to-lib-section {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 6px;
    padding: 12px 14px;
    margin-top: 12px;
}
.add-to-lib-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin: 0;
}
.add-to-lib-toggle input { cursor: pointer; }
.add-to-lib-toggle span {
    color: #166534;
    font-size: 13px;
}
.add-to-lib-fields {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #86efac;
}
.row-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
    margin-bottom: 10px;
}

/* 變形輸入卡片 */
.variants-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 8px;
}
.variant-card {
    background: white;
    border: 1px solid #d1fae5;
    border-radius: 4px;
    padding: 8px 10px;
}
.variant-label {
    font-size: 12px;
    margin-bottom: 5px;
    color: #1e293b;
    font-weight: 500;
}
.variant-label small {
    color: #94a3b8;
    font-weight: normal;
    margin-left: 4px;
    font-size: 10px;
}

/* 主題範本 */
.topic-templates-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}
.topic-templates-grid .wiz-form-group { margin-bottom: 0; }
.topic-templates-grid label {
    font-size: 11px;
    color: #475569;
    margin-bottom: 3px;
    display: block;
}
.mini-select {
    padding: 5px 8px;
    font-size: 12px;
}

/* 主題組合顯示 */
.topic-combination-display {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 10px 12px;
    margin: 8px 0;
    font-size: 13px;
    color: #475569;
    line-height: 1.6;
    min-height: 40px;
}
.topic-combo-text {
    color: #1e293b;
    line-height: 1.6;
}
.topic-combo-tags {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.combo-tag {
    background: #e0e7ff;
    color: #4338ca;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
}

/* 細項調整 */
.wiz-form-group { margin-bottom: 14px; }
.wiz-form-group:last-child { margin-bottom: 0; }
.wiz-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 5px;
}
.req { color: #ef4444; }
.form-hint {
    display: block;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}
