/* governance-mcp Dashboard Stylesheet */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-sidebar: #1a1f35;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --border: #334155;
  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ── App Layout ── */
.app { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar { width: 240px; background: var(--bg-sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.sidebar-header { padding: 20px; border-bottom: 1px solid var(--border); }
.sidebar-header h2 { font-size: 16px; color: var(--primary); }
.version { font-size: 11px; color: var(--text-muted); }
.nav-menu { list-style: none; padding: 10px 0; }
.nav-menu li a { display: block; padding: 10px 20px; color: var(--text-muted); font-size: 14px; transition: all 0.2s; }
.nav-menu li a:hover, .nav-menu li a.active { background: rgba(99,102,241,0.1); color: var(--text); border-left: 3px solid var(--primary); }

/* ── Sidebar Footer / Logout ── */
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding: 12px 20px; }
.logout-link { display: block; color: var(--danger); font-size: 13px; transition: opacity 0.2s; }
.logout-link:hover { opacity: 0.8; color: var(--danger); }

/* ── Main Content ── */
.main-content { flex: 1; padding: 24px; overflow-y: auto; }
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header h1 { font-size: 24px; }
.badge { background: var(--primary); padding: 4px 12px; border-radius: 12px; font-size: 12px; }
.back-link { color: var(--text-muted); font-size: 14px; }
.back-link:hover { color: var(--primary); }

/* ── Project Grid ── */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.project-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; transition: all 0.2s; }
.project-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-header h3 { font-size: 16px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 8px; }
.tag-warning { background: rgba(234,179,8,0.2); color: var(--warning); }
.card-score { display: flex; justify-content: center; margin-bottom: 16px; }
.score-ring { width: 72px; height: 72px; }
.ring-chart { width: 72px; height: 72px; }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 3; }
.ring-fill { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linecap: round; }
.ring-text { fill: var(--text); font-size: 8px; text-anchor: middle; font-weight: bold; }
.card-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.metric { display: flex; justify-content: space-between; font-size: 12px; }
.metric .label { color: var(--text-muted); }
.metric .value { color: var(--text); font-weight: 500; }
.card-footer { border-top: 1px solid var(--border); padding-top: 12px; }
.instr-badge { font-size: 12px; color: var(--text-muted); }

/* ── Recommendations ── */
.recommendations { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 24px; }
.recommendations h3 { font-size: 14px; margin-bottom: 12px; }
.rec-list { display: flex; flex-direction: column; gap: 8px; }
.rec-item { font-size: 13px; color: var(--text-muted); padding: 8px 12px; background: rgba(99,102,241,0.05); border-radius: 8px; border-left: 3px solid var(--primary); }

/* ── Detail Cards ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.detail-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.detail-card h3 { font-size: 14px; margin-bottom: 16px; }

/* ── Radar Chart ── */
.radar-chart { display: flex; flex-direction: column; gap: 12px; }
.radar-item { display: flex; align-items: center; gap: 12px; }
.radar-label { width: 40px; font-size: 12px; color: var(--text-muted); }
.radar-bar { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.radar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #818cf8); border-radius: 4px; transition: width 0.5s; }
.radar-val { width: 36px; font-size: 12px; text-align: right; }
.radar-total { text-align: center; padding-top: 8px; border-top: 1px solid var(--border); font-size: 14px; }

/* ── Preformatted Content ── */
pre { background: rgba(0,0,0,0.3); padding: 16px; border-radius: 8px; font-size: 12px; line-height: 1.6; overflow-x: auto; white-space: pre-wrap; }
.instr-content, .patrol-content { max-height: 400px; overflow-y: auto; }

/* ── Login ── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-container { width: 360px; }
.login-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 32px; text-align: center; }
.login-card h1 { color: var(--primary); margin-bottom: 4px; }
.login-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; text-align: left; }
.form-group input { width: 100%; padding: 10px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px; }
.form-group input:focus { outline: none; border-color: var(--primary); }
.btn { padding: 10px 20px; border: none; border-radius: 8px; font-size: 14px; cursor: pointer; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-block { width: 100%; }
.error-msg { color: var(--danger); font-size: 13px; }

/* ── Cortex ── */
.search-form { display: flex; gap: 8px; margin-left: auto; }
.search-input { width: 260px; padding: 8px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px; }
.search-input:focus { outline: none; border-color: var(--primary); }
.cortex-browse { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.cortex-section h3 { font-size: 14px; margin-bottom: 12px; color: var(--primary); }
.doc-list { list-style: none; }
.doc-list li { padding: 6px 0; font-size: 13px; }
.doc-meta { font-size: 11px; color: var(--text-muted); margin-left: 8px; }
.search-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 8px; }
.search-title { font-size: 14px; font-weight: 500; }
.search-meta { font-size: 11px; color: var(--text-muted); margin: 4px 0; }
.search-snippet { font-size: 12px; color: var(--text-muted); }
.doc-reader { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.doc-content pre { max-height: 600px; }

/* ── Factory / Experience ── */
.signals-section { margin-bottom: 24px; }
.signal-item { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; font-size: 13px; }
.signal-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.exp-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 8px; }
.exp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; gap: 8px; }
.exp-tag { font-size: 10px; color: var(--primary); background: rgba(99,102,241,0.15); padding: 1px 6px; border-radius: 4px; white-space: nowrap; }
.exp-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.exp-metric { font-size: 12px; color: var(--success); margin-bottom: 4px; }
.exp-detail { font-size: 12px; max-height: 120px; overflow-y: auto; }

/* ── Settings ── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.info-table { width: 100%; font-size: 13px; }
.info-table td { padding: 8px 0; border-bottom: 1px solid var(--border); }
.info-table td:first-child { color: var(--text-muted); width: 120px; }
.info-table code { font-size: 12px; background: rgba(0,0,0,0.3); padding: 2px 6px; border-radius: 4px; }
.warning-card { border-color: var(--warning); }
.warning-card p { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state p { color: var(--text-muted); font-size: 14px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
}
