:root {
  --bg: #0e1117;
  --panel: #161b22;
  --card: #1c2230;
  --border: #3d4654;
  --text: #f3f6fa;
  --muted: #b8c0cc;
  --accent: #5aadff;
  --green: #3fb950;
  --amber: #e3b341;
  --red: #ff7b72;
  --mw: #c49bff;
  --icog: #5aadff;
  --eyris: #56d364;
  --bioage: #ffa657;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.5;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #161b22, #0e1117);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo { height: 64px; width: auto; display: block; object-fit: contain; }
.topbar h1 { margin: 0; font-size: 21px; font-weight: 700; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.topright { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.modeSwitch {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--panel);
}
.modeLabel { font-size: 12px; color: var(--muted); padding: 0 6px 0 8px; text-transform: uppercase; letter-spacing: .04em; }
.modeBtn {
  border: 0; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px;
  cursor: pointer;
}
.modeBtn:hover { color: var(--text); }
.modeBtn.active { background: var(--accent); color: #fff; }
.modeHint { font-size: 12px; color: var(--muted); max-width: 280px; line-height: 1.4; }
.modeHint.warn { color: var(--amber); }
.link { color: var(--accent); text-decoration: none; font-size: 14px; }
.status { font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.status.ok .dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status.down .dot { background: var(--red); }

.wrap { max-width: 960px; margin: 0 auto; padding: 26px 22px 60px; }

.block {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 22px; margin-bottom: 20px;
}
.block-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.block-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.block-head h2 small { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 8px; }
.step {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
  color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700;
}

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
label { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.req { color: var(--red); }
input, select {
  width: 100%; margin-top: 8px; padding: 11px 13px;
  background: #0d1117; border: 1px solid var(--border); border-radius: 8px;
  color: #f0f6fc; font-size: 15px; font-family: inherit;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(90, 173, 255, 0.2); }
select option { background: #161b22; color: var(--text); }

.folderbar { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.folderbtn {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  background: #18202e; border: 1px solid var(--accent); color: var(--accent);
  padding: 9px 16px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.folderbtn:hover { background: #1d2738; }
.folderbtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.folderhint { color: var(--muted); font-size: 14px; }
.folderhint.ok { color: var(--green); }
.folderhint.warn { color: var(--amber); }

.shots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.shot-label { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 8px; min-height: 34px; }
.drop {
  position: relative; display: grid; place-items: center; height: 130px;
  border: 1.5px dashed var(--border); border-radius: 10px; cursor: pointer;
  background: #0d1117; overflow: hidden; text-align: center;
}
.drop:hover { border-color: var(--accent); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop span { color: var(--muted); font-size: 14px; padding: 0 8px; }
.drop.filled { border-style: solid; border-color: var(--green); }
.drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.drop .tag {
  position: absolute; bottom: 6px; right: 6px; background: rgba(0,0,0,.7);
  color: #fff; font-size: 10px; padding: 2px 6px; border-radius: 5px; z-index: 2;
}

.pkg-modes { display: inline-flex; gap: 4px; margin-bottom: 14px; padding: 4px;
  background: #11161f; border: 1.5px solid var(--border); border-radius: 10px; }
.pkg-mode { cursor: pointer; border: none; background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 600; padding: 8px 20px; border-radius: 7px; transition: background .15s, color .15s; }
.pkg-mode:hover { color: var(--text); }
.pkg-mode.active { background: var(--accent); color: #0d1117; }

.packages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.packages[hidden] { display: none; }
.pkg { cursor: pointer; display: block; }
.pkg input { display: none; }
.pkg-body {
  border: 1.5px solid var(--border); border-radius: 12px; padding: 16px; height: 100%;
  transition: border-color .15s, background .15s;
}
.pkg:hover .pkg-body { border-color: var(--muted); }
.pkg input:checked + .pkg-body { border-color: var(--accent); background: #18202e; }
.pkg-body h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.pkg-body p { margin: 0 0 12px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.badges { display: flex; gap: 6px; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; color: #0d1117; }
.badge.mw { background: var(--mw); }
.badge.icog { background: var(--icog); }
.badge.eyris { background: var(--eyris); }
.badge.bioage { background: var(--bioage); }

.actions { display: flex; gap: 12px; margin-top: 6px; }
.run {
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  padding: 13px 26px; border-radius: 10px; font-size: 15px; font-weight: 700;
}
.run:hover { filter: brightness(1.08); }
.run:disabled { opacity: .6; cursor: not-allowed; }
.reset {
  background: transparent; border: 1px solid var(--border); color: var(--text);
  padding: 13px 20px; border-radius: 10px; font-size: 14px; cursor: pointer;
}

.results { margin-top: 30px; }
.results-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.results-head h2 { margin: 0; font-size: 17px; }
.copy { background: transparent; border: 1px solid var(--border); color: var(--text);
  padding: 7px 14px; border-radius: 8px; font-size: 13px; cursor: pointer; }

.vcard {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 16px; overflow: hidden;
}
.vcard-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.vcard-head h3 { margin: 0; font-size: 16px; flex: 1; font-weight: 600; }
.pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 20px; }
.pill.run { background: #1f2a3d; color: var(--accent); }
.pill.ok { background: #1b3a26; color: var(--green); }
.pill.err { background: #3a1d1d; color: var(--red); }
.steps { padding: 12px 18px; display: flex; flex-direction: column; gap: 7px; }
.sline { font-size: 14px; display: flex; gap: 9px; align-items: baseline; }
.sline .ic { width: 16px; text-align: center; }
.sline.ok .ic { color: var(--green); }
.sline.err .ic { color: var(--red); }
.sline.run .ic { color: var(--amber); }
.sline .lbl { color: var(--text); font-weight: 500; }
.sline .det { color: var(--muted); font-family: var(--mono); font-size: 13px; }
.report-links { padding: 0 18px 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.report-links a {
  font-size: 14px; color: #fff; background: var(--accent);
  padding: 7px 13px; border-radius: 8px; text-decoration: none;
}
.report-links a.dlbtn,
.report-links button.dlbtn { background: var(--green); font-weight: 600; border: none; cursor: pointer; }
.report-links a.dlbtn:hover,
.report-links button.dlbtn:hover { filter: brightness(1.08); }
.report-links button.dlbtn:disabled,
.combo-dlbtn:disabled { opacity: 0.88; cursor: wait; }

.combo-dl { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); text-align: center; }
.combo-dlbtn { width: 100%; max-width: 520px; }
details.raw { border-top: 1px solid var(--border); }
details.raw summary { cursor: pointer; padding: 10px 18px; color: var(--muted); font-size: 14px; }
pre.json {
  margin: 0; padding: 14px 18px; background: #0d1117; overflow: auto;
  font-family: var(--mono); font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
  color: var(--text);
}
.json .k { color: #7ee787; } .json .s { color: #a5d6ff; }
.json .n { color: #f0883e; } .json .b { color: #d2a8ff; } .json .null { color: var(--muted); }

.banner { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 13.5px; }
.banner.err { background: #3a1d1d; color: #ffb4ae; border: 1px solid #5a2a2a; }

.linkbtn {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 14px; padding: 0; font-family: inherit;
}
.linkbtn:hover { color: var(--text); }
.logout-form { margin: 0; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 20px; }
.login-wrap { width: 100%; max-width: 520px; }
.login-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
  padding: 48px 44px 44px; text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.login-logo { height: 84px; width: auto; margin-bottom: 24px; }
.login-card h1 { margin: 0 0 10px; font-size: 28px; font-weight: 700; color: var(--text); }
.login-sub { margin: 0 0 32px; color: #c9d1d9; font-size: 16px; }
.login-form { text-align: left; }
.login-form label {
  display: block; margin-bottom: 20px;
  font-size: 15px; font-weight: 600; color: var(--text);
}
.login-form input {
  margin-top: 10px; padding: 14px 16px; font-size: 16px;
  background: #0d1117; border: 1px solid #3d444d; color: #f0f6fc;
}
.login-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 156, 255, 0.25); }
.login-btn {
  width: 100%; margin-top: 12px; justify-content: center;
  padding: 16px 26px; font-size: 17px; border-radius: 12px;
}
.login-err {
  background: #3a1d1d; color: #ffb4ae; border: 1px solid #5a2a2a;
  border-radius: 10px; padding: 14px 16px; font-size: 15px; margin-bottom: 20px;
  text-align: left;
}

@media (max-width: 760px) {
  .grid, .shots, .packages { grid-template-columns: 1fr 1fr; }
}
