:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --bg3: #1c2333;
  --border: #2d333b;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #3fb950;
  --accent2: #58a6ff;
  --warn: #d29922;
  --danger: #f85149;
  --purple: #bc8cff;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); height: 100vh; overflow: hidden;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600; background: var(--bg3); border: 1px solid var(--border);
}
.badge.draft { color: var(--muted); }
.badge.active { color: var(--accent2); border-color: var(--accent2); animation: pulse 2s infinite; }
.badge.paused { color: var(--warn); border-color: var(--warn); }
.badge.done { color: var(--accent); border-color: var(--accent); }
.badge.deployed { color: var(--accent); border-color: var(--accent); background: rgba(63,185,80,.12); }
.badge.error { color: var(--danger); border-color: var(--danger); }
.badge.budget { color: var(--purple); border-color: var(--purple); }
@keyframes pulse { 50% { opacity: .55; } }

.btn {
  background: var(--bg3); color: var(--text); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500;
  transition: all .15s;
}
.btn:hover { border-color: var(--accent2); }
.btn.primary { background: #238636; border-color: #2ea043; color: #fff; }
.btn.primary:hover { background: #2ea043; }
.btn.accent { background: #1f6feb33; border-color: #1f6feb; color: var(--accent2); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12px; }

/* login */
.login-wrap { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 16px;
  padding: 40px; width: 340px; text-align: center;
}
.logo { font-size: 22px; font-weight: 700; }
.logo.small { font-size: 16px; }
.subtitle { color: var(--muted); margin: 6px 0 24px; font-size: 13px; }
.login-card input {
  width: 100%; padding: 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 15px; margin-bottom: 14px;
}
.login-card .btn { width: 100%; padding: 12px; }
.error-msg { color: var(--danger); margin-top: 12px; font-size: 13px; }

/* layout */
.app { display: flex; height: 100vh; }
.sidebar {
  width: 260px; background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px;
}
.sidebar-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.project-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.project-item {
  padding: 10px 12px; border-radius: 8px; cursor: pointer; border: 1px solid transparent;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.project-item:hover { background: var(--bg3); }
.project-item.active { background: var(--bg3); border-color: var(--accent2); }
.project-item .pname { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-item .pcount { font-size: 11px; color: var(--muted); }
.sidebar-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid var(--border); }

.main { flex: 1; overflow-y: auto; padding: 24px 28px; }
.empty-state { text-align: center; margin-top: 15vh; }
.empty-state .big-icon { font-size: 56px; }
.empty-state h2 { margin: 16px 0 8px; }
.empty-state p { color: var(--muted); margin-bottom: 20px; max-width: 420px; margin-left: auto; margin-right: auto; }

/* project head */
.project-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.project-head h1 { font-size: 22px; }
.head-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.deploy-link { color: var(--accent); font-size: 13px; text-decoration: none; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab {
  background: transparent; border: none; color: var(--muted); padding: 10px 16px;
  cursor: pointer; font-size: 14px; border-bottom: 2px solid transparent; font-weight: 500;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent2); }

/* board */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.board-col {
  min-width: 250px; flex: 1; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px; max-height: calc(100vh - 300px); display: flex; flex-direction: column;
}
.board-col h4 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  padding: 4px 6px 10px; display: flex; justify-content: space-between;
}
.board-cards { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; }
.fcard {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; padding: 10px;
  cursor: pointer; transition: border-color .15s;
}
.fcard:hover { border-color: var(--accent2); }
.fcard .ftitle { font-size: 13px; font-weight: 600; margin-bottom: 6px; line-height: 1.35; }
.fcard .fmeta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.fcard .forder { color: var(--muted); font-size: 11px; }
.fcard .fattempt { font-size: 11px; color: var(--warn); }
.fcard .fstatus-dots { display: flex; gap: 3px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.dot.pass { background: var(--accent); }
.dot.fail { background: var(--danger); }
.dot.skip { background: #484f58; }
.fcard .ferr { color: var(--danger); font-size: 11px; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcard .factions { display: flex; gap: 4px; margin-top: 8px; }
.fcard .factions button { font-size: 11px; padding: 3px 8px; }

/* feature modal / detail */
.feature-detail { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; }
.feature-detail .modal-card { max-width: 640px; width: 90%; }
.modal-card pre.spec { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-size: 13px; max-height: 200px; overflow-y: auto; }

/* list */
.feature-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.feature-table th, .feature-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.feature-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.feature-table select, .feature-table input { background: var(--bg2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; font-size: 13px; }

/* indicators */
.indicator-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.indicator-head h3 { width: 100%; }
.code-editor {
  width: 100%; min-height: 340px; background: var(--bg); color: #a5d6ff;
  border: 1px solid var(--border); border-radius: 10px; padding: 14px;
  font-family: "SFMono-Regular", Consolas, monospace; font-size: 12.5px; line-height: 1.5;
  resize: vertical;
}

/* logs */
.log-console {
  background: #05070a; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px;
  height: calc(100vh - 320px); overflow-y: auto; line-height: 1.6;
}
.log-console .row { white-space: pre-wrap; word-break: break-word; }
.log-console .ts { color: #484f58; margin-right: 8px; }
.log-console .info { color: #c9d1d9; }
.log-console .success { color: var(--accent); }
.log-console .warn { color: var(--warn); }
.log-console .error { color: var(--danger); }
.logs-head { display: flex; justify-content: space-between; margin-bottom: 8px; }

/* settings */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.settings-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.settings-grid input {
  background: var(--bg2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; font-size: 14px;
}

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 40; }
.modal-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 14px;
  padding: 26px; width: 560px; max-width: 94%; max-height: 92vh; overflow-y: auto;
}
.modal-card h3 { margin-bottom: 16px; }
.modal-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.modal-card input, .modal-card textarea {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px; font-size: 14px; font-family: inherit;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
