/* A1 web app. Calm, humanist, Apple-like: system font, soft greys, white cards, one blue accent. */
:root {
  --bg: #f5f5f7; --card: #ffffff; --ink: #1d1d1f; --ink2: #6e6e73; --ink3: #a1a1a6;
  --line: #e5e5ea; --blue: #0071e3; --blue-soft: #e8f1fd; --green: #34c759; --amber: #ff9f0a;
  --red: #ff3b30; --navy: #0d366b; --radius: 16px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --c-source: #5e5ce6; --c-clean: #64d2ff; --c-ai: #bf5af2; --c-rule: #ff9f0a; --c-crawl: #30b0c7;
  --c-extract: #32ade6; --c-money: #34c759; --c-human: #ff375f; --c-report: #0a84ff; --c-db: #8e8e93; --c-flow: #a2845e;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px;
  -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 28px; padding: 0 28px;
  height: 52px; background: rgba(245,245,247,.82); backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 650; color: var(--ink); letter-spacing: -.01em; font-size: 17px; }
.brand span { color: var(--ink2); font-weight: 450; }
nav { display: flex; gap: 22px; }
nav a { color: var(--ink2); font-size: 14px; }
nav a.on { color: var(--ink); font-weight: 560; }
main { max-width: 1120px; margin: 0 auto; padding: 36px 28px 80px; }
main.wide { max-width: none; padding: 0; }
h1 { font-size: 34px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 6px; }
h2 { font-size: 21px; font-weight: 650; letter-spacing: -.01em; margin: 0 0 14px; }
.sub { color: var(--ink2); font-size: 17px; margin: 0 0 30px; line-height: 1.4; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; }
.card + .card { margin-top: 18px; }
.muted { color: var(--ink2); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 12px; }
.spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 560; padding: 3px 10px;
  border-radius: 99px; background: #f2f2f7; color: var(--ink2); white-space: nowrap; }
.pill.waiting { background: #fff4e5; color: #b25e00; } .pill.done { background: #e9f9ee; color: #1f7a3a; }
.pill.failed { background: #ffecea; color: #c1271c; } .pill.running { background: var(--blue-soft); color: var(--blue); }
.pill.you { background: #f2f2f7; color: var(--ink); } .pill.system { background: #f3e8fd; color: #8a2bc9; }
.btn { appearance: none; border: 0; border-radius: 99px; padding: 9px 18px; font: inherit; font-weight: 560;
  background: var(--blue); color: #fff; cursor: pointer; transition: transform .08s, opacity .2s; }
.btn:active { transform: scale(.97); } .btn:disabled { opacity: .4; cursor: default; }
.btn.ghost { background: #e8e8ed; color: var(--ink); }
.btn.quiet { background: transparent; color: var(--blue); padding: 9px 8px; }
.btn.big { padding: 13px 26px; font-size: 16px; }
input[type=text], input[type=password], textarea, select { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; width: 100%; outline: none; transition: border .15s, box-shadow .15s; }
input[type=text]:focus, input[type=password]:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
textarea { min-height: 220px; resize: vertical; line-height: 1.45; }
label.field { display: block; font-size: 13px; color: var(--ink2); margin: 14px 0 6px; }
.seg { display: inline-flex; background: #e8e8ed; border-radius: 10px; padding: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; font: inherit; font-size: 13px; padding: 6px 14px; border-radius: 8px;
  color: var(--ink); cursor: pointer; }
.seg button.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 560; }
/* iOS-like switch */
.switch { position: relative; width: 44px; height: 26px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #e5e5ea; border-radius: 99px; transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 22px; height: 22px; left: 2px; top: 2px; background: #fff;
  border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch.sm { width: 36px; height: 22px; } .switch.sm span::after { width: 18px; height: 18px; }
.switch.sm input:checked + span::after { transform: translateX(14px); }
/* lists */
.list { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.item { display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--line);
  align-items: start; }
.item:first-child { border-top: 0; }
.item.off .title { color: var(--ink3); }
.item .title { font-weight: 560; font-size: 16px; }
.item .why { color: var(--ink2); font-size: 13px; margin-top: 4px; line-height: 1.4; }
.item .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.item .num { text-align: right; min-width: 120px; }
.item .num b { font-size: 17px; font-weight: 600; display: block; }
.item input.note { margin-top: 10px; font-size: 13px; padding: 7px 10px; border-radius: 9px; }
.stickybar { position: sticky; bottom: 18px; margin-top: 22px; display: flex; align-items: center; gap: 14px;
  background: rgba(255,255,255,.86); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-radius: 99px; box-shadow: var(--shadow); padding: 10px 12px 10px 24px; }
.runrow { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--line); color: var(--ink); }
.runrow:first-child { border-top: 0; } .runrow:hover { background: #fafafa; }
.steps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #e5e5ea; }
.dot.done { background: var(--green); } .dot.waiting { background: var(--amber); } .dot.failed { background: var(--red); }
.files a { display: inline-block; margin: 0 14px 8px 0; }
pre.log { background: #fbfbfd; border: 1px solid var(--line); border-radius: 12px; padding: 14px; font-size: 12px;
  max-height: 320px; overflow: auto; white-space: pre-wrap; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 30px); opacity: 0; background: rgba(29,29,31,.92);
  color: #fff; padding: 11px 20px; border-radius: 99px; font-size: 14px; transition: all .25s; z-index: 50; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty { padding: 26px; text-align: center; color: var(--ink2); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 10px; }
.choice { border: 2px solid var(--line); border-radius: var(--radius); padding: 22px; cursor: pointer; background: #fff; }
.choice:hover { border-color: var(--blue); }
.choice h3 { margin: 0 0 6px; font-size: 18px; }

/* ---------- Node canvas (Blender-like) ---------- */
.canvas-wrap { position: relative; height: calc(100vh - 52px); overflow: hidden; background-color: #f0f0f3;
  background-image: radial-gradient(#d4d4da 1px, transparent 1px); background-size: 22px 22px; cursor: grab; }
.canvas-wrap.panning { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
svg.wires { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
svg.wires path { fill: none; stroke-width: 2.4; pointer-events: stroke; cursor: pointer; opacity: .85; }
svg.wires path:hover, svg.wires path.sel { stroke-width: 4; opacity: 1; }
.node { position: absolute; width: 212px; background: #fff; border-radius: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 6px 18px rgba(0,0,0,.08);
  user-select: none; border: 2px solid transparent; }
.node.sel { border-color: var(--blue); }
.node.off { opacity: .45; }
.node .head { display: flex; align-items: center; gap: 8px; padding: 9px 10px 8px 12px; border-radius: 12px 12px 0 0; cursor: move;
  border-bottom: 1px solid var(--line); }
.node .head .cat { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.node .head .name { font-weight: 600; font-size: 13px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node .type { font-size: 11px; color: var(--ink2); padding: 6px 12px 2px; }
.node .ports { display: flex; justify-content: space-between; padding: 4px 0 10px; }
.node .port { position: relative; font-size: 11px; color: var(--ink2); padding: 3px 12px; display: flex; align-items: center; gap: 6px; }
.node .in .port { padding-left: 14px; } .node .out .port { justify-content: flex-end; padding-right: 14px; }
.sock { position: absolute; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.18);
  top: 50%; transform: translateY(-50%); cursor: crosshair; }
.in .sock { left: -7px; } .out .sock { right: -7px; }
.node .state { height: 3px; border-radius: 0 0 12px 12px; }
.node .state.done { background: var(--green); } .node .state.waiting { background: var(--amber); } .node .state.failed { background: var(--red); }
.toolbar { position: absolute; top: 16px; left: 16px; right: 16px; display: flex; gap: 10px; align-items: center; z-index: 5; pointer-events: none; }
.toolbar > * { pointer-events: auto; }
.glass { background: rgba(255,255,255,.86); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 14px;
  box-shadow: var(--shadow); padding: 8px 12px; }
.inspector { position: absolute; top: 72px; right: 16px; bottom: 16px; width: 320px; overflow: auto; z-index: 6; padding: 18px; }
.inspector h3 { margin: 0 0 4px; font-size: 17px; }
.inspector .help { color: var(--ink2); font-size: 13px; line-height: 1.45; margin-bottom: 10px; }
.inspector textarea { min-height: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.palette { position: absolute; top: 72px; left: 16px; width: 280px; max-height: calc(100% - 90px); overflow: auto; z-index: 6; padding: 14px; }
.palette .pi { padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.palette .pi:hover { background: var(--blue-soft); }
.palette .pi b { font-size: 13px; display: block; } .palette .pi span { font-size: 11px; color: var(--ink2); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11px; color: var(--ink2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
@media (max-width: 700px) { main { padding: 24px 16px 80px; } .item { grid-template-columns: 46px 1fr; } .item .num { grid-column: 2; text-align: left; } .split { grid-template-columns: 1fr; } }

/* The pick popup on the node canvas */
.node.waiting { border-color: var(--amber); box-shadow: 0 0 0 6px rgba(255,159,10,.18), 0 6px 18px rgba(0,0,0,.08); }
.pickbadge { position: absolute; top: -14px; right: 10px; background: var(--amber); color: #fff; border: 0; border-radius: 99px;
  font: 600 12px var(--font); padding: 5px 12px; cursor: pointer; box-shadow: 0 2px 8px rgba(255,159,10,.4); }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.28); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  z-index: 40; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal { position: relative; background: var(--bg); border-radius: 22px; box-shadow: 0 24px 80px rgba(0,0,0,.25);
  width: min(920px, 100%); max-height: calc(100vh - 48px); overflow: auto; padding: 34px 34px 22px; }
.modal-x { position: absolute; top: 16px; right: 16px; }
.modal h1 { font-size: 28px; padding-right: 80px; }
.modal-body > .row:first-child { padding-right: 70px; }

.cost { color: var(--ink, #1d1d1f); font-weight: 520; }

.bar .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 14px; }
.who a { color: var(--ink2); }
.linkbtn { background: none; border: 0; color: var(--blue); cursor: pointer; padding: 0; font: inherit; }
.signin { max-width: 380px; margin: 60px auto; }
.signin input { width: 100%; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.danger { color: var(--red); }
code { background: var(--blue-soft); padding: 2px 6px; border-radius: 6px; }

.dot.running { background: var(--blue); animation: pulse 1.2s ease-in-out infinite; }
.node .state.running { background: var(--blue); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
pre.log { max-height: 460px; overflow: auto; }
pre.log.steplog { max-height: 220px; font-size: 11px; white-space: pre-wrap; }

details.targets summary { cursor: pointer; color: var(--blue); }
details.targets .tlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 16px;
  margin-top: 10px; padding: 12px; background: #fbfbfd; border: 1px solid var(--line); border-radius: 12px; }
details.targets label { display: flex; gap: 8px; align-items: center; }

.item .links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 6px 0 2px; font-size: 13px; }
.item .links a { color: var(--blue); white-space: nowrap; }
.item .links a.found { font-weight: 600; }

.notices { position: sticky; top: 60px; z-index: 15; max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.notice { display: flex; gap: 12px; align-items: center; margin-top: 10px; padding: 12px 16px; border-radius: 14px;
  background: var(--card); box-shadow: var(--shadow); border-left: 5px solid var(--blue); font-size: 14px; }
.notice.done { border-left-color: var(--green); } .notice.failed { border-left-color: var(--red); }
.notice.waiting { border-left-color: var(--amber); }
.notice a { margin-left: 4px; }

/* Trendwatch: on a phone the PDF is not embedded; the Download button stays. */
@media (max-width: 700px) { .tw-embed { display: none; } }
.tw-row.on { background: var(--blue-soft); }
