:root {
  --bg: #14161a; --panel: #1d2026; --panel2: #232732;
  --text: #e6e8ee; --dim: #9aa1af; --line: #323847;
  --accent: #4f8ef7; --ok: #43c26d; --bad: #e05c5c;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: #14161a; color: #e6e8ee;
  font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
}
header {
  display: flex; align-items: baseline; gap: 6px;
  padding: 12px 22px; border-bottom: 1px solid #323847; background: #191c22;
}
#brand { color: #4f8ef7; font-weight: 700; font-size: 18px; text-decoration: none; letter-spacing: 1px; }
#crumb { color: #9aa1af; }
main { max-width: 1200px; margin: 18px auto; padding: 0 18px; }

.card {
  background: #1d2026; border: 1px solid #323847; border-radius: 8px;
  padding: 14px 18px; margin-bottom: 16px;
}
.card h2 { margin: 2px 0 10px; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.card h3 { margin: 12px 0 4px; font-size: 13px; color: #9aa1af; text-transform: uppercase; letter-spacing: .5px; }
.hint { color: #9aa1af; font-weight: 400; font-size: 12px; }
.ok { color: #43c26d; font-size: 12px; }
.bad { color: #e05c5c; font-size: 12px; }
.hidden { display: none; }
.row { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

input, select {
  background: #232732; color: #e6e8ee; border: 1px solid #323847;
  border-radius: 5px; padding: 6px 8px; font: inherit;
}
button {
  background: #232732; color: #e6e8ee; border: 1px solid #323847;
  border-radius: 5px; padding: 7px 14px; font: inherit; cursor: pointer;
}
button.primary { background: #2b4c86; border-color: #385fa5; }
button.primary:hover:not(:disabled) { background: #345c9f; }
button:disabled { opacity: .35; cursor: not-allowed; }
button.link { background: none; border: none; color: #4f8ef7; padding: 0; font-size: 12px; }

.prow {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 8px;
  padding: 8px 10px; border-bottom: 1px solid #323847; color: inherit; text-decoration: none;
}
.prow:hover { background: #232732; }
.pname { font-weight: 600; }
.pmeta { color: #9aa1af; }

.form-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.form-table td { padding: 3px 10px 3px 0; vertical-align: middle; overflow: hidden; }
.form-table .lbl { color: #cfd3db; white-space: nowrap; text-overflow: ellipsis; }
.form-table .unit { color: #9aa1af; }
.form-table .cmt { color: #6d7482; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.form-table input { width: 100%; }
code { background: #232732; padding: 1px 5px; border-radius: 4px; }

.phase-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 950px) { .phase-grid { grid-template-columns: repeat(2, 1fr); } }
.phase {
  border: 1px solid #323847; border-radius: 8px; padding: 10px 12px; background: #191c22;
}
.phase.done { border-color: #2f6a45; }
.phase.running { border-color: #4f8ef7; }
.phase h3 { margin: 0 0 6px; font-size: 13px; color: #e6e8ee; text-transform: none; letter-spacing: 0; }
.phase p { margin: 0 0 8px; color: #9aa1af; font-size: 12px; min-height: 44px; }

.spin {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid #4f8ef7; border-top-color: transparent;
  animation: spin 0.9s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

#fig-frame { width: 100%; height: 720px; border: 1px solid #323847; border-radius: 6px; background: #fff; }
#log {
  background: #101216; border: 1px solid #323847; border-radius: 6px;
  padding: 10px; max-height: 300px; overflow: auto; font: 12px/1.5 Consolas, monospace;
  white-space: pre-wrap; color: #b9c0cc;
}
input.missing { border-color: #e05c5c; }

.tabbar { display: flex; gap: 4px; margin: 4px 0 12px; border-bottom: 1px solid #323847; }
.tabbar .tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  border-radius: 0; color: #9aa1af; padding: 8px 16px; font-weight: 600;
}
.tabbar .tab:hover { color: #e6e8ee; }
.tabbar .tab.active { color: #4f8ef7; border-bottom-color: #4f8ef7; }
select.missing { border-color: #e05c5c; }
input:disabled { opacity: .5; }

.dl-btn {
  display: inline-block; background: #2b4c86; border: 1px solid #385fa5;
  color: #e6e8ee; border-radius: 5px; padding: 8px 16px; text-decoration: none;
}
.dl-btn:hover { background: #345c9f; }

.prow5 { grid-template-columns: 2fr 1fr 1fr 1fr 34px; align-items: center; }
.pdel {
  background: none; border: 1px solid #323847; color: #9aa1af;
  border-radius: 4px; padding: 2px 8px; font-size: 12px;
}
.pdel:hover { color: #e05c5c; border-color: #e05c5c; }

.welcome { text-align: center; padding: 60px 20px; }
.welcome h1 { font-size: 42px; letter-spacing: 4px; color: #4f8ef7; margin: 0 0 4px; }
.welcome-grid {
  display: grid; grid-template-columns: repeat(2, minmax(260px, 380px));
  gap: 20px; justify-content: center; margin: 36px 0 24px;
}
@media (max-width: 700px) { .welcome-grid { grid-template-columns: 1fr; } }
.welcome-card {
  display: block; background: #1d2026; border: 1px solid #323847; border-radius: 10px;
  padding: 26px 22px; color: inherit; text-decoration: none; text-align: left;
}
.welcome-card:hover { border-color: #4f8ef7; background: #20242c; }
.welcome-card h2 { margin: 0 0 8px; color: #4f8ef7; }
.welcome-card p { margin: 0; color: #9aa1af; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 950px) { .two-col { grid-template-columns: 1fr; } }
.form-table.mini th { text-align: left; color: #9aa1af; font-weight: 500; font-size: 12px; padding-right: 10px; }
.form-table.mini { table-layout: auto; }
.form-table.mini input { width: 90px; }

.prev-box {
  background: #14161a; border: 1px solid #323847; border-radius: 6px;
  margin: 4px 0 2px; overflow: hidden;
}
.prev-box svg { display: block; width: 100%; height: auto; }

#grid-pop {
  position: absolute; z-index: 50; min-width: 110px; max-height: 240px; overflow-y: auto;
  background: #232732; border: 1px solid #385fa5; border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0,0,0,.5); padding: 4px 0;
}
.grid-pop-title { padding: 3px 12px; font-size: 10px; color: #9aa1af; text-transform: uppercase; letter-spacing: .5px; }
.grid-pop-item { padding: 4px 12px; cursor: pointer; font-size: 13px; }
.grid-pop-item:hover { background: #2b4c86; }

input.echo { opacity: .45; pointer-events: none; }
