:root {
  --bg: #f1f3f5;
  --surface: #ffffff;
  --text: #0f172a;
  --text-2: #1e293b;
  --text-3: #475569;
  --border: #94a3b8;
  --border-light: #cbd5e1;
  --blue: #1d4ed8;
  --blue-light: #dbeafe;
  --red: #991b1b;
  --red-bg: #fecaca;
  --red-mid: #dc2626;
  --amber: #92400e;
  --amber-bg: #fde68a;
  --amber-mid: #d97706;
  --green: #064e3b;
  --green-bg: #a7f3d0;
  --green-mid: #059669;
  --purple: #5b21b6;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
  --radius: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); height: 100vh; overflow: hidden; }
.layout { display: grid; grid-template-rows: auto 1fr; grid-template-columns: 1fr 420px; height: 100vh; }
.header { grid-column: 1 / -1; background: var(--surface); border-bottom: 2px solid var(--border-light); padding: 12px 28px; display: flex; align-items: center; gap: 14px; }
.header .brand { display: flex; align-items: center; gap: 10px; }
.header .brand .icon { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, #4f46e5, #7c3aed); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 13px; }
.header .brand h1 { font-size: 17px; font-weight: 800; color: var(--text); }
.header .filters { display: flex; gap: 8px; margin-left: 24px; }
.header .filters select { padding: 7px 12px; border: 2px solid var(--border-light); border-radius: 6px; font-size: 12px; font-weight: 700; background: var(--surface); color: var(--text); cursor: pointer; }
.header .filters select:focus { border-color: var(--blue); }
.header .meta { margin-left: auto; }
.header .live { font-size: 12px; font-weight: 700; color: #047857; display: flex; align-items: center; gap: 5px; }
.header .live::before { content:''; width:8px; height:8px; border-radius:50%; background:#059669; }
.selected-count { margin-left: 16px; padding: 5px 12px; border-radius: 14px; background: var(--blue-light); color: var(--blue); font-size: 12px; font-weight: 800; }
.portfolio { overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 8px; }
.portfolio .empty { text-align: center; color: var(--text-3); font-weight: 600; padding: 40px; }
.build-row { background: var(--surface); border: 2px solid var(--border-light); border-radius: var(--radius); overflow: hidden; transition: border-color 0.15s; flex-shrink: 0; }
.build-row.checked { border-color: var(--blue); background: #f8faff; }
.build-row:hover { border-color: var(--border); }
.build-summary { display: grid; grid-template-columns: 40px 1fr 150px 150px 90px 40px; align-items: center; padding: 14px 16px; gap: 12px; cursor: pointer; }
.build-summary .cb { width: 20px; height: 20px; border-radius: 4px; border: 2px solid var(--border); cursor: pointer; accent-color: var(--blue); }
.build-summary .cb:checked { border-color: var(--blue); }
.build-id-col .fbn { font-size: 15px; font-weight: 800; color: var(--text); }
.build-id-col .meta-line { font-size: 12px; color: var(--text-3); font-weight: 600; margin-top: 2px; }
.build-id-col .current-stage { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; padding: 3px 8px; border-radius: 4px; font-size: 10px; font-weight: 800; text-transform: uppercase; background: var(--blue-light); color: var(--blue); }
.bp-pill { display: inline-flex; align-items: center; gap: 5px; margin-top: 5px; padding: 3px 9px; border-radius: 4px; font-size: 10px; font-weight: 800; text-transform: uppercase; border: 1.5px solid; }
.bp-on_pace { background: #e0e7ff; color: #3730a3; border-color: #818cf8; }
.bp-behind { background: #e2e8f0; color: #334155; border-color: #94a3b8; }
.ms-cell-compact { text-align: center; padding: 8px 10px; border-radius: 6px; border: 2px solid; }
.ms-cell-compact.slip { border-color: var(--red-mid); background: var(--red-bg); }
.ms-cell-compact.watch { border-color: var(--amber-mid); background: var(--amber-bg); }
.ms-cell-compact.ok { border-color: var(--green-mid); background: var(--green-bg); }
.ms-cell-compact .ms-name { font-size: 10px; font-weight: 900; color: var(--text); text-transform: uppercase; letter-spacing: 0.5px; }
.ms-cell-compact .ms-dates { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 4px; }
.ms-cell-compact .ms-dates .sys { font-size: 12px; color: var(--text-3); text-decoration: line-through; font-weight: 600; }
.ms-cell-compact .ms-dates .arrow { font-size: 11px; color: var(--text-2); font-weight: 800; }
.ms-cell-compact .ms-dates .fcst { font-size: 15px; font-weight: 900; color: var(--text); }
.ms-cell-compact .var-text { font-size: 12px; font-weight: 900; margin-top: 3px; color: var(--text); }
.trend-col { text-align: center; }
.trend-col .icon { font-size: 18px; }
.trend-col .label { font-size: 9px; font-weight: 700; color: var(--text-3); }
.expand-btn { width: 28px; height: 28px; border-radius: 6px; border: 2px solid var(--border-light); background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-3); cursor: pointer; transition: all 0.15s; }
.expand-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.expand-btn.open { background: var(--blue); color: #fff; border-color: var(--blue); }
.build-detail { display: none; padding: 0 16px 16px 16px; border-top: 1px solid var(--border-light); }
.build-detail.open { display: block; }
.timeline-visual { margin: 12px 0; }
.timeline-header { display: grid; grid-template-columns: 130px 1fr; margin-bottom: 6px; }
.timeline-header .th-label { font-size: 10px; font-weight: 800; color: var(--text-3); text-transform: uppercase; }
.timeline-row { display: grid; grid-template-columns: 130px 1fr; align-items: center; padding: 8px 0; border-bottom: 1px solid #e2e8f0; }
.timeline-row:last-child { border-bottom: none; }
.tl-milestone { display: flex; align-items: center; gap: 8px; }
.tl-milestone .tl-icon { width: 24px; height: 24px; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 10px; }
.tl-icon.done { background: var(--green-bg); color: var(--green); }
.tl-icon.active { background: var(--blue-light); color: var(--blue); }
.tl-icon.risk { background: var(--red-bg); color: var(--red); }
.tl-icon.watch { background: var(--amber-bg); color: var(--amber); }
.tl-milestone .tl-name { font-size: 12px; font-weight: 700; color: var(--text); }
.tl-bar-area { display: flex; align-items: center; gap: 8px; }
.tl-bars { flex: 1; position: relative; height: 28px; }
.tl-bar { position: absolute; height: 12px; border-radius: 3px; }
.tl-bar.system { background: #93c5fd; border: 1px solid #3b82f6; top: 2px; }
.tl-bar.forecast { background: #fca5a5; border: 1px solid #ef4444; top: 16px; }
.tl-bar.forecast.ok { background: #6ee7b7; border-color: #10b981; }
.tl-bar.forecast.watch { background: #fde68a; border-color: #f59e0b; }
.tl-dates { display: flex; gap: 12px; width: 200px; flex-shrink: 0; }
.tl-dates .sys-d { font-size: 12px; font-weight: 600; color: var(--text-3); }
.tl-dates .fcst-d { font-size: 13px; font-weight: 900; }
.tl-dates .fcst-d.slip { color: var(--red); }
.tl-dates .fcst-d.watch { color: var(--amber); }
.tl-dates .fcst-d.ok { color: var(--green); }
.tl-dates .var-d { font-size: 11px; font-weight: 800; width: 45px; text-align: right; }
.tl-dates .var-d.slip { color: var(--red); }
.tl-dates .var-d.watch { color: var(--amber); }
.tl-dates .var-d.ok { color: var(--green); }
.tl-reason { font-size: 11px; color: var(--text-2); font-weight: 500; padding: 2px 0 0 32px; font-style: italic; }
.chat-agent { display: flex; flex-direction: column; border-left: 2px solid var(--border-light); background: #0f172a; overflow: hidden; }
.chat-agent-header { padding: 14px 20px; background: #020617; border-bottom: 1px solid #1e293b; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; color: #ffffff; flex-shrink: 0; }
.chat-agent-header .model { margin-left: auto; font-size: 11px; color: #94a3b8; font-weight: 600; }
.chat-scope { padding: 10px 20px; background: #1e293b; border-bottom: 1px solid #334155; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-shrink: 0; font-size: 12px; color: #e2e8f0; font-weight: 600; }
.scope-tag { padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 800; background: #1e3a5f; color: #93c5fd; border: 1px solid #3b82f6; }
.scope-tag .x { margin-left: 5px; cursor: pointer; opacity: 0.7; }
.scope-tag .x:hover { opacity: 1; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 90%; padding: 12px 16px; border-radius: 14px; font-size: 13.5px; line-height: 1.7; }
.msg.user { align-self: flex-end; background: #2563eb; color: #ffffff; border-bottom-right-radius: 3px; font-weight: 600; }
.msg.bot { align-self: flex-start; background: #1e293b; border: 1px solid #334155; border-bottom-left-radius: 3px; color: #e2e8f0; }
.msg.bot .tag { font-size: 10px; font-weight: 700; color: #94a3b8; margin-bottom: 5px; }
.msg.bot strong { color: #ffffff; }
.msg.bot .red-val { color: #f87171; font-weight: 800; }
.msg.bot .green-val { color: #6ee7b7; font-weight: 800; }
.mit-box { margin-top: 10px; padding: 10px 12px; background: #064e3b; border: 1px solid #059669; border-radius: 8px; }
.mit-box .t { font-size: 11px; font-weight: 800; color: #6ee7b7; margin-bottom: 4px; }
.mit-box ul { padding-left: 14px; font-size: 12px; line-height: 1.7; color: #d1fae5; margin: 0; }
.mit-box strong { color: #fff; }
.chat-hints { padding: 8px 20px; display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px solid #1e293b; flex-shrink: 0; }
.hint { padding: 5px 10px; border-radius: 14px; border: 1px solid #475569; font-size: 11px; color: #e2e8f0; font-weight: 600; cursor: pointer; }
.hint:hover { border-color: #60a5fa; color: #93c5fd; background: #1e3a5f; }
.chat-input-bar { padding: 14px 20px; border-top: 1px solid #334155; display: flex; gap: 8px; flex-shrink: 0; }
.chat-input-bar input { flex: 1; padding: 12px 16px; border: 2px solid #334155; border-radius: 10px; font-size: 14px; color: #f1f5f9; background: #1e293b; outline: none; }
.chat-input-bar input:focus { border-color: #3b82f6; background: #0f172a; }
.chat-input-bar input::placeholder { color: #64748b; }
.chat-input-bar button { width: 44px; height: 44px; border-radius: 10px; background: #2563eb; color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 16px; }
