:root {
    --bg: #0b1120;
    --bg-soft: #131c31;
    --bg-card: #172136;
    --border: #24304d;
    --text: #e6ebf5;
    --text-dim: #94a3b8;
    --accent: #4ade80;
    --accent-2: #38bdf8;
    --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, sans-serif;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px; }
a { color: inherit; text-decoration: none; }

/* Header */
.site-header {
    border-bottom: 1px solid var(--border);
    background: rgba(11,17,32,0.85);
    backdrop-filter: blur(10px);
    position: sticky; top: 0; z-index: 50;
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-weight: 800; font-size: 1.3rem; letter-spacing: -0.02em; }
.brand-dot { color: var(--accent); }
.nav-links { display: flex; gap: 28px; }
.nav-links a { color: var(--text-dim); font-weight: 500; font-size: 0.95rem; transition: color 0.2s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }

.site-main { flex: 1; }
.site-footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--text-dim); font-size: 0.85rem; text-align: center; }

/* Section heading */
.section-head { padding: 64px 0 32px; }
.section-head h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.03em; }
.section-head p { color: var(--text-dim); margin-top: 8px; font-size: 1.05rem; }

/* Filter chips */
.filters { display: flex; flex-wrap: wrap; gap: 10px; padding-bottom: 32px; }
.chip {
    padding: 7px 16px; border: 1px solid var(--border); border-radius: 999px;
    color: var(--text-dim); font-size: 0.85rem; font-weight: 500; transition: all 0.2s;
}
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.active { background: var(--accent); color: #04120a; border-color: var(--accent); }

/* Project grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 22px; padding-bottom: 80px; }
.card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; transition: transform 0.2s, border-color 0.2s; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent-2); }
.card-cover { height: 168px; background: linear-gradient(135deg, #1a2740, #0f1a2e); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.card-cover .placeholder { color: var(--border); font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }
.card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.card-cat { color: var(--accent); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.card-title { font-size: 1.15rem; font-weight: 700; margin: 8px 0; letter-spacing: -0.01em; }
.card-tagline { color: var(--text-dim); font-size: 0.9rem; flex: 1; }
.card-tech { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.tech-tag { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; color: var(--text-dim); background: var(--bg-soft); border: 1px solid var(--border); padding: 3px 8px; border-radius: 6px; }
.featured-badge { display: inline-block; background: rgba(74,222,128,0.12); color: var(--accent); font-size: 0.68rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; margin-left: 8px; vertical-align: middle; }

/* Detail page */
.detail { padding: 56px 0 80px; max-width: 800px; }
.detail .back { color: var(--text-dim); font-size: 0.9rem; }
.detail .back:hover { color: var(--accent); }
.detail h1 { font-size: 2.4rem; font-weight: 800; letter-spacing: -0.03em; margin: 20px 0 10px; }
.detail .cat { color: var(--accent); font-weight: 600; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.08em; }
.detail .lead { color: var(--text-dim); font-size: 1.15rem; margin: 16px 0 24px; }
.detail-cover { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); margin: 24px 0; }
.detail .links { display: flex; gap: 12px; margin: 24px 0; }
.btn { padding: 10px 20px; border-radius: 10px; font-weight: 600; font-size: 0.9rem; transition: all 0.2s; }
.btn-primary { background: var(--accent); color: #04120a; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent-2); }
.detail .tech-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.detail-content { margin-top: 32px; font-size: 1.02rem; color: #cdd6e6; }
.detail-content p { margin-bottom: 16px; }
.detail-content h2 { font-size: 1.4rem; margin: 32px 0 12px; color: var(--text); }

/* Hero (landing) */
.hero { padding: 90px 0 60px; }
.hero .eyebrow { color: var(--accent); font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; }
.hero h1 { font-size: 3.2rem; font-weight: 800; letter-spacing: -0.04em; margin: 16px 0; line-height: 1.1; }
.hero .sub { color: var(--text-dim); font-size: 1.25rem; max-width: 640px; }
.hero .cta-row { display: flex; gap: 14px; margin-top: 32px; }
.stats { display: flex; gap: 40px; padding: 40px 0 80px; border-top: 1px solid var(--border); margin-top: 40px; }
.stat .num { font-size: 2rem; font-weight: 800; color: var(--accent); }
.stat .label { color: var(--text-dim); font-size: 0.9rem; }

@media (max-width: 640px) {
    .hero h1 { font-size: 2.2rem; }
    .nav-links { gap: 16px; }
    .stats { flex-wrap: wrap; gap: 24px; }
}

/* Education page */
.edu-item { border-left: 2px solid var(--border); padding: 0 0 32px 24px; position: relative; }
.edu-item::before { content: ''; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.edu-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.edu-head h2 { font-size: 1.2rem; font-weight: 700; }
.edu-meta { color: var(--text-dim); font-size: 0.85rem; font-family: 'JetBrains Mono', monospace; }
.edu-org { color: var(--accent-2); font-weight: 500; margin: 4px 0 10px; }
.edu-desc { color: var(--text-dim); font-size: 0.95rem; }
.cert-grid { display: flex; flex-direction: column; gap: 10px; }
.cert { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; font-weight: 500; font-size: 0.95rem; }
.cert span { color: var(--text-dim); font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; }

/* Project detail — visual */
.detail-hero { background: linear-gradient(180deg, var(--bg-soft), var(--bg)); border-bottom: 1px solid var(--border); padding: 40px 0 48px; }
.detail-hero .back { color: var(--text-dim); font-size: 0.9rem; display: inline-block; margin-bottom: 24px; }
.detail-hero .back:hover { color: var(--accent); }
.detail-hero .cat { color: var(--accent); font-weight: 600; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.1em; }
.detail-hero h1 { font-size: 2.6rem; font-weight: 800; letter-spacing: -0.03em; margin: 12px 0; line-height: 1.1; }
.detail-hero .lead { color: var(--text-dim); font-size: 1.2rem; max-width: 720px; }
.meta-row { display: flex; gap: 40px; margin: 28px 0 0; }
.meta { display: flex; flex-direction: column; gap: 2px; }
.meta-label { color: var(--text-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; }
.meta-val { font-weight: 600; font-size: 0.95rem; }
.detail-hero .links { display: flex; gap: 12px; margin-top: 28px; }

.detail { max-width: 820px; padding: 40px 0 90px; }
.detail-cover { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 8px; }
.detail .tech-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 8px; }

.block { padding: 28px 0; border-top: 1px solid var(--border); }
.block:first-of-type { border-top: none; }
.block-title { font-size: 1.3rem; font-weight: 700; margin-bottom: 16px; letter-spacing: -0.01em; }
.block-text { color: #cdd6e6; font-size: 1.03rem; margin-bottom: 14px; }

.feature-list, .result-list { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.feature-list li, .result-list li { display: flex; gap: 14px; align-items: flex-start; color: #cdd6e6; font-size: 1.01rem; }
.feature-list .tick { color: var(--accent-2); font-weight: 700; flex-shrink: 0; margin-top: 2px; }
.result-list li { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; }
.result-list .check { color: var(--accent); font-weight: 700; flex-shrink: 0; }

/* About page */
.about-bio { max-width: 760px; padding-bottom: 20px; }
.about-bio p { color: #cdd6e6; font-size: 1.08rem; margin-bottom: 16px; }
.about-bio .cta-row { margin-top: 24px; }

.exp-section { max-width: 820px; padding-top: 40px; }
.exp-item { border-left: 2px solid var(--border); padding: 0 0 32px 24px; position: relative; }
.exp-item::before { content: ''; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.exp-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.exp-head h2 { font-size: 1.15rem; font-weight: 700; }
.exp-meta { color: var(--text-dim); font-size: 0.85rem; font-family: 'JetBrains Mono', monospace; }
.exp-org { color: var(--accent-2); font-weight: 500; margin: 4px 0 10px; }
.exp-desc { color: var(--text-dim); font-size: 0.97rem; }

.skills-section { max-width: 900px; padding: 40px 0 90px; }
.skill-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.skill-group { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.skill-group h3 { color: var(--accent); font-size: 0.95rem; margin-bottom: 10px; }
.skill-group p { color: var(--text-dim); font-size: 0.92rem; }

/* Profile photo */
.profile-photo { width: 128px; height: 128px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); margin-bottom: 20px; }

/* Auth pages */
.auth-card { max-width: 400px; margin: 80px auto; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: 16px; padding: 40px; }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.auth-sub { color: var(--text-dim); font-size: 0.95rem; margin-bottom: 24px; }
.auth-card label { display: block; color: var(--text-dim); font-size: 0.85rem;
    margin: 16px 0 6px; }
.auth-card input { width: 100%; padding: 11px 14px; background: var(--bg);
    border: 1px solid var(--border); border-radius: 10px; color: var(--text);
    font-size: 0.95rem; }
.auth-card input:focus { outline: none; border-color: var(--accent); }
.auth-btn { width: 100%; margin-top: 24px; border: none; cursor: pointer;
    font-size: 0.95rem; }
.auth-alt { text-align: center; color: var(--text-dim); font-size: 0.9rem;
    margin-top: 20px; }
.auth-alt a { color: var(--accent); }
.auth-error { background: rgba(248,113,113,0.1); border: 1px solid #f87171;
    color: #fca5a5; padding: 10px 14px; border-radius: 8px; font-size: 0.85rem;
    margin-bottom: 8px; }

/* Agentic console */
.console { max-width: 820px; margin: 0 auto; padding: 40px 24px 140px; }
.console-head h1 { font-size: 1.8rem; }
.console-head p { color: var(--text-dim); margin: 8px 0 24px; }
.conversation { display: flex; flex-direction: column; gap: 14px; }

.msg-user { display: flex; justify-content: flex-end; }
.msg-user .bubble { background: var(--accent); color: #04120a; padding: 12px 16px;
  border-radius: 14px 14px 4px 14px; max-width: 80%; font-weight: 500; }

.run-status { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em;
  padding: 4px 0; }
.status-completed { color: var(--accent); }
.status-failed, .status-rejected { color: #f87171; }
.status-awaiting_approval { color: #fbbf24; }

.stage-card { background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px; }
.stage-awaiting_approval { border-color: #fbbf24; }
.stage-approved { border-color: var(--accent); }
.stage-failed { border-color: #f87171; }
.stage-head { display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; }
.stage-name { font-weight: 700; text-transform: capitalize; font-size: 1.05rem; }
.stage-badge { font-size: 0.7rem; font-weight: 600; padding: 3px 10px;
  border-radius: 999px; text-transform: uppercase; letter-spacing: 0.05em; }
.badge-running, .badge-ready { background: rgba(56,189,248,0.15); color: var(--accent-2); }
.badge-awaiting_approval { background: rgba(251,191,36,0.15); color: #fbbf24; }
.badge-approved { background: rgba(74,222,128,0.15); color: var(--accent); }
.badge-failed, .badge-rejected { background: rgba(248,113,113,0.15); color: #f87171; }
.badge-pending { background: var(--bg-soft); color: var(--text-dim); }

.stage-loading { color: var(--accent-2); font-size: 0.9rem; }
.dots { animation: blink 1.4s infinite; }
@keyframes blink { 0%,100%{opacity:.3} 50%{opacity:1} }

.stage-result { margin-top: 10px; }
.rk { color: var(--accent); font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; margin: 12px 0 4px; }
.rv { color: #cdd6e6; font-size: 0.95rem; }
.rv-empty { color: var(--text-dim); }
.rv-list { margin: 4px 0 0 18px; color: #cdd6e6; font-size: 0.92rem; }
.rv-list li { margin-bottom: 3px; }
.stage-error { color: #fca5a5; font-size: 0.85rem; margin-top: 8px;
  font-family: 'JetBrains Mono', monospace; }

.gate { display: flex; gap: 10px; margin-top: 16px; }
.gate .btn { cursor: pointer; border: none; }
.gate .btn-ghost { border: 1px solid var(--border); }

.composer { position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(11,17,32,0.95); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border); padding: 16px 24px; }
.composer { display: flex; gap: 12px; max-width: 820px; margin: 0 auto;
  align-items: flex-end; }
.composer textarea { flex: 1; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 16px; color: var(--text); font-size: 0.95rem;
  resize: none; font-family: inherit; }
.composer textarea:focus { outline: none; border-color: var(--accent); }
.composer .btn { cursor: pointer; border: none; white-space: nowrap; }

/* Revision feedback box */
.feedback-box { margin-top: 12px; }
.feedback-box textarea { width: 100%; background: var(--bg); border: 1px solid #fbbf24;
  border-radius: 10px; padding: 10px 14px; color: var(--text); font-size: 0.9rem;
  font-family: inherit; resize: vertical; }
.feedback-box textarea:focus { outline: none; }
.feedback-box .btn { margin-top: 8px; cursor: pointer; border: none; }

/* Bot chat bubbles + confirm actions */
.msg-bot { display: flex; justify-content: flex-start; }
.bubble-bot { background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); padding: 12px 16px; border-radius: 14px 14px 14px 4px;
  max-width: 85%; font-size: 0.95rem; line-height: 1.5; }
.thinking-msg .bubble-bot { color: var(--accent-2); }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { cursor: pointer; border: none; }
.confirm-actions .btn-ghost { border: 1px solid var(--border); }
.confirmed { color: var(--accent); font-weight: 500; }
.cancelled { color: var(--text-dim); }

/* History sidebar layout */
.console-layout { display: flex; max-width: 1100px; margin: 0 auto; gap: 0; }
.history { width: 240px; flex-shrink: 0; border-right: 1px solid var(--border);
  padding: 24px 16px 140px; min-height: 80vh; }
.new-run-btn { width: 100%; cursor: pointer; border: none; margin-bottom: 20px; }
.history-label { color: var(--text-dim); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.08em; margin-bottom: 10px; }
.history-list { display: flex; flex-direction: column; gap: 4px; }
.history-empty { color: var(--text-dim); font-size: 0.85rem; padding: 8px; }
.history-item { display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: 8px; cursor: pointer; transition: background 0.15s; }
.history-item:hover { background: var(--bg-card); }
.history-item.active { background: var(--bg-card); border: 1px solid var(--border); }
.hi-text { flex: 1; min-width: 0; }
.hi-title { font-size: 0.85rem; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.hi-status { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em;
  margin-top: 2px; }
.hi-delete { background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 1.1rem; padding: 0 4px; opacity: 0; transition: opacity 0.15s; }
.history-item:hover .hi-delete { opacity: 1; }
.hi-delete:hover { color: #f87171; }
.console { flex: 1; min-width: 0; }

@media (max-width: 760px) {
  .console-layout { flex-direction: column; }
  .history { width: 100%; border-right: none; border-bottom: 1px solid var(--border);
    min-height: auto; padding-bottom: 20px; }
}

/* Code file rendering */
.code-file { margin: 12px 0; border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; }
.code-path { background: var(--bg-soft); padding: 8px 14px; font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem; color: var(--accent-2); border-bottom: 1px solid var(--border); }
.code-block { margin: 0; padding: 14px; overflow-x: auto; background: #0a0f1c;
  font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; line-height: 1.5;
  color: #cdd6e6; max-height: 420px; overflow-y: auto; }
.code-block code { white-space: pre; }
