/* MADCF Dashboard Styles */
:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --info: #2563eb;
    --nav-bg: #1e1b4b;
    --nav-text: #e0e7ff;
    --status-created: #9ca3af;
    --status-assigned: #3b82f6;
    --status-submitted: #eab308;
    --status-voting: #8b5cf6;
    --status-human_review: #f97316;
    --status-completed: #22c55e;
    --status-rejected: #ef4444;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Nav */
nav { background: var(--nav-bg); padding: 0 2rem; display: flex; align-items: center; gap: 0; height: 56px; }
nav .brand { color: #fff; font-weight: 700; font-size: 1.1rem; margin-right: 2rem; letter-spacing: -0.5px; }
nav a { color: var(--nav-text); padding: 0 1rem; height: 56px; display: flex; align-items: center; font-size: 0.9rem; border-bottom: 3px solid transparent; transition: all 0.15s; }
nav a:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,0.07); }
nav a.active { color: #fff; border-bottom-color: var(--primary); background: rgba(255,255,255,0.1); }

/* Main */
main { max-width: 1100px; margin: 0 auto; padding: 2rem; }
h1 { font-size: 1.5rem; margin-bottom: 1.5rem; font-weight: 600; }
h2 { font-size: 1.2rem; margin-bottom: 1rem; font-weight: 600; }

/* Flash */
.flash { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.9rem; animation: flash-in 0.3s; }
.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.flash-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem; }
.card .label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.25rem; }
.card .value { font-size: 2rem; font-weight: 700; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 8px; overflow: hidden; border: 1px solid var(--border); }
th { background: #f9fafb; text-align: left; padding: 0.75rem 1rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border); }
td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9fafb; }

/* Status badges */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-created { background: #f3f4f6; color: #4b5563; }
.badge-assigned { background: #dbeafe; color: #1d4ed8; }
.badge-submitted { background: #fef9c3; color: #a16207; }
.badge-voting { background: #ede9fe; color: #6d28d9; }
.badge-human_review { background: #ffedd5; color: #c2410c; }
.badge-completed { background: #dcfce7; color: #15803d; }
.badge-rejected { background: #fee2e2; color: #b91c1c; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.3rem; color: var(--text); }
input[type="text"], input[type="number"], textarea, select {
    width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 6px;
    font-size: 0.9rem; font-family: inherit; background: var(--surface); transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
textarea { min-height: 80px; resize: vertical; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.55rem 1.1rem; border: none; border-radius: 6px; font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: all 0.15s; font-family: inherit; text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: #f9fafb; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* Actions bar */
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 1rem 0; }

/* Panel */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1.5rem; margin-bottom: 1.5rem; }

/* State machine */
.sm-container { display: flex; align-items: center; gap: 0; flex-wrap: wrap; margin: 1.5rem 0; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.sm-node { padding: 0.5rem 1rem; border: 2px solid var(--border); border-radius: 6px; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; background: #f9fafb; color: var(--text-muted); white-space: nowrap; }
.sm-arrow { color: var(--text-muted); font-size: 1.2rem; padding: 0 0.4rem; }
.sm-node.sm-active { border-color: var(--primary); background: #eef2ff; color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.15); }
.sm-node.sm-done { border-color: var(--success); background: #f0fdf4; color: var(--success); }
.sm-branch { display: flex; align-items: center; gap: 0; margin-top: 0.5rem; width: 100%; padding-left: 2rem; }
.sm-branch-label { font-size: 0.7rem; color: var(--text-muted); margin-right: 0.4rem; }

/* Artifacts */
.artifact { background: #1e1b4b; color: #e0e7ff; padding: 1rem; border-radius: 6px; font-family: 'SF Mono', 'Consolas', monospace; font-size: 0.85rem; white-space: pre-wrap; word-break: break-all; overflow-x: auto; margin: 0.5rem 0; }

/* Misc */
.mono { font-family: 'SF Mono', 'Consolas', monospace; font-size: 0.85rem; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.empty { text-align: center; color: var(--text-muted); padding: 2rem; }
.inline-form { display: inline; }

/* Guide page */
.guide-layout { display: grid; grid-template-columns: 220px 1fr; gap: 2rem; align-items: start; }
@media (max-width: 800px) { .guide-layout { grid-template-columns: 1fr; } .guide-toc { display: none; } }

.guide-toc { position: sticky; top: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.25rem; }
.toc-title { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 0.75rem; }
.guide-toc ul { list-style: none; }
.guide-toc > ul > li { margin-bottom: 0.4rem; }
.guide-toc ul ul { margin-left: 1rem; margin-top: 0.2rem; }
.guide-toc a { font-size: 0.85rem; color: var(--text-muted); transition: color 0.15s; }
.guide-toc a:hover { color: var(--primary); text-decoration: none; }

.guide-content { min-width: 0; }
.guide-content section { margin-bottom: 2.5rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); }
.guide-content section:last-child { border-bottom: none; }
.guide-content h1 { font-size: 1.4rem; margin-bottom: 1rem; }
.guide-content h2 { font-size: 1.15rem; margin-top: 1.5rem; margin-bottom: 0.75rem; color: var(--text); }
.guide-content h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.guide-content p { margin-bottom: 0.75rem; }
.guide-content ol, .guide-content ul { margin: 0.5rem 0 0.75rem 1.5rem; }
.guide-content li { margin-bottom: 0.3rem; }

.zh { color: var(--text-muted); font-size: 0.9em; }

.callout { background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 6px; padding: 0.75rem 1rem; margin: 0.75rem 0; font-size: 0.9rem; }
.callout-success { background: #ecfdf5; border-color: #a7f3d0; }
.callout-danger { background: #fef2f2; border-color: #fecaca; }
.callout-info { background: #eff6ff; border-color: #bfdbfe; }

.steps { margin-top: 1rem; }
.step { display: flex; gap: 1rem; margin-bottom: 1.5rem; }
.step-num { flex-shrink: 0; width: 32px; height: 32px; background: var(--primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; margin-top: 0.15rem; }
.step-body { flex: 1; min-width: 0; }

.code-block { background: #1e1b4b; color: #e0e7ff; padding: 1rem; border-radius: 6px; font-family: 'SF Mono', 'Consolas', monospace; font-size: 0.82rem; white-space: pre-wrap; word-break: break-all; overflow-x: auto; margin: 0.75rem 0; line-height: 1.5; }
.code-comment { color: #818cf8; }

/* State machine diagram */
.state-machine-diagram { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1.25rem; margin: 1rem 0; }
.sm-flow { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem; }
.sm-s { display: inline-block; padding: 0.35rem 0.7rem; border: 2px solid var(--border); border-radius: 6px; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; background: #f9fafb; color: var(--text-muted); white-space: nowrap; }
.sm-a { color: var(--text-muted); font-size: 1.1rem; }
.sm-highlight { border-color: var(--warning); background: #fffbeb; color: var(--warning); }
.sm-done { border-color: var(--success); background: #f0fdf4; color: var(--success); }
.sm-reject { border-color: var(--danger); background: #fef2f2; color: var(--danger); }
.sm-branches { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.3rem; padding-left: 1rem; font-size: 0.85rem; color: var(--text-muted); }
.sm-branch-line { display: flex; align-items: center; gap: 0.4rem; }

/* Architecture diagram */
.arch-diagram { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin: 1rem 0; }
.arch-core { background: var(--nav-bg); color: #fff; padding: 1rem 1.5rem; text-align: center; }
.arch-title { font-weight: 700; font-size: 1rem; }
.arch-subtitle { font-size: 0.85rem; color: var(--nav-text); margin-top: 0.25rem; }
.arch-providers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.arch-provider { padding: 1rem; border: 1px solid var(--border); text-align: center; }
.arch-p-name { font-weight: 600; font-size: 0.9rem; }
.arch-p-impl { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }
.arch-roles { display: grid; grid-template-columns: 1fr 1fr; }
.arch-role { padding: 1rem 1.5rem; border-top: 2px solid var(--primary); text-align: center; }

/* FAQ */
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 1rem 1.25rem; margin-bottom: 0.75rem; }
.faq-q { font-weight: 600; margin-bottom: 0.5rem; font-size: 0.95rem; }
.faq-a { font-size: 0.9rem; color: var(--text); line-height: 1.6; }
