:root {
  --bg: #161b25;
  --grid: rgba(255, 255, 255, 0.045);
  --grid-strong: rgba(255, 255, 255, 0.07);
  --panel: #1f2533;
  --panel-2: #262d3d;
  --line: #3a4356;
  --border: #4a5469;
  --text: #e6edf7;
  --muted: #8b96ab;
  --dim: #626d83;
  --green: #4ade80;
  --green-glow: rgba(74, 222, 128, 0.55);
  --blue: #60a5fa;
  --amber: #fbbf24;
  --red: #f87171;
  --radius: 14px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
button { font: inherit; color: inherit; }
a { color: inherit; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: 52px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; background: rgba(22, 27, 37, 0.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 15px; font-weight: 600; margin: 0; letter-spacing: 0.01em; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: url("/favicon.svg") center / cover;
}
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; letter-spacing: 0.06em; }
.badge-demo { background: rgba(251, 191, 36, 0.15); color: var(--amber); border: 1px solid rgba(251, 191, 36, 0.4); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.conn { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.conn[data-state="live"] .dot { background: var(--green); box-shadow: 0 0 8px var(--green-glow); }
.conn[data-state="down"] .dot { background: var(--red); }
.ghost { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 5px 12px; cursor: pointer; font-size: 13px; }
.ghost:hover { border-color: var(--border); }

/* ---------- canvas ---------- */
.stage {
  position: fixed; inset: 52px 0 0 0; overflow: hidden; cursor: grab;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-strong) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-strong) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
}
.stage.panning { cursor: grabbing; }
.viewport { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }

.edge { fill: none; stroke: #59637a; stroke-width: 2; }
.edge.dashed { stroke-dasharray: 6 6; }
.edge-label { fill: var(--dim); font-size: 11px; text-anchor: middle; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; }
.port { fill: #c8d0de; stroke: var(--bg); stroke-width: 2; }
.port.live { fill: var(--green); filter: drop-shadow(0 0 4px var(--green-glow)); }

.pulse-seg { fill: none; stroke-linecap: round; stroke-width: 6; }
.tone-ok .pulse-seg, .pulse-seg.tone-ok { stroke: var(--green); filter: drop-shadow(0 0 6px var(--green-glow)); }
.pulse-seg.tone-info { stroke: var(--green); filter: drop-shadow(0 0 6px var(--green-glow)); }
.pulse-seg.tone-warn { stroke: var(--amber); filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.55)); }
.pulse-seg.tone-bad { stroke: var(--red); filter: drop-shadow(0 0 6px rgba(248, 113, 113, 0.55)); }
.pulse-seg.tone-muted { stroke: #9aa6bb; }
.chip rect { fill: #0f141d; stroke: var(--green); stroke-width: 1.2; }
.chip.tone-warn rect { stroke: var(--amber); }
.chip.tone-bad rect { stroke: var(--red); }
.chip.tone-muted rect { stroke: #9aa6bb; }
.chip text { fill: var(--text); font-size: 12px; font-weight: 600; dominant-baseline: central; text-anchor: middle; }

/* ---------- nodes ---------- */
.node { position: absolute; user-select: none; }
.card {
  width: 300px; background: var(--panel); border: 1.5px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.node.flash .card, .node.flash .diamond { border-color: var(--green); box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.18), 0 0 28px rgba(74, 222, 128, 0.35); }
.node.offline .card { border-color: rgba(248, 113, 113, 0.5); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: move; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.avatar {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none;
  font-weight: 700; font-size: 15px; color: #0f141d;
}
.avatar.coder { background: linear-gradient(135deg, #60a5fa, #a78bfa); }
.avatar.photo { object-fit: cover; background: var(--panel-2); border: 1px solid rgba(255, 255, 255, 0.1); }
.avatar.tester { background: linear-gradient(135deg, #fbbf24, #f472b6); }
.card-title { flex: 1; min-width: 0; }
.card-title strong { display: block; font-size: 15px; }
.card-title span { font-size: 12px; color: var(--muted); }
.status-pill { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill.working { color: var(--green); background: rgba(74, 222, 128, 0.1); }
.status-pill.working::before { animation: blink 1.2s infinite; }
.status-pill.busy { color: var(--blue); background: rgba(96, 165, 250, 0.1); }
.status-pill.bad { color: var(--red); background: rgba(248, 113, 113, 0.1); }
@keyframes blink { 50% { opacity: 0.3; } }

.card-body { padding: 10px 14px 14px; display: grid; gap: 10px; }
.field-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); margin-bottom: 4px; }
.slot { background: var(--panel-2); border-radius: 9px; padding: 9px 11px; font-size: 13px; }
.slot.empty { color: var(--dim); font-style: italic; }
.task-key { font-weight: 700; text-decoration: none; color: var(--green); }
.task-key:hover { text-decoration: underline; }
.task-summary { color: var(--text); margin-top: 3px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.tag { background: rgba(255, 255, 255, 0.06); border-radius: 6px; padding: 1px 7px; }
.repos { display: flex; flex-wrap: wrap; gap: 6px; }
.repo { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; background: var(--panel-2); border-radius: 6px; padding: 3px 7px; color: #c8d0de; }
.progress { height: 5px; background: rgba(255, 255, 255, 0.08); border-radius: 3px; margin-top: 7px; overflow: hidden; }
.run-repo { margin-top: 7px; }
.progress > span { width: 0; display: block; height: 100%; background: var(--blue); border-radius: 3px; transition: width 0.6s; }
.mini-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.mini-list li { display: flex; align-items: center; gap: 8px; font-size: 12px; min-width: 0; }
.mini-list .k { font-weight: 600; flex: none; text-decoration: none; }
.mini-list .s { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.mini-list .o { flex: none; font-size: 11px; }
.card-foot { display: flex; justify-content: space-between; padding: 8px 14px; border-top: 1px solid rgba(255, 255, 255, 0.06); font-size: 11.5px; color: var(--dim); }
.hb { display: inline-flex; align-items: center; gap: 6px; }
.hb::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.hb.alive::before { background: var(--green); box-shadow: 0 0 6px var(--green-glow); }
.hb.dead::before { background: var(--red); }
.error-text { color: var(--red); font-size: 12px; }

.t-ok { color: var(--green); }
.t-info { color: var(--blue); }
.t-warn { color: var(--amber); }
.t-bad { color: var(--red); }
.t-muted { color: var(--muted); }

/* hub (Jira) */
.hub { width: 240px; display: flex; flex-direction: column; align-items: center; }
.diamond-wrap { width: 112px; height: 112px; display: grid; place-items: center; cursor: move; }
.diamond {
  width: 80px; height: 80px; transform: rotate(45deg); border-radius: 14px;
  background: var(--panel-2); border: 1.5px solid #8fb1e6;
  box-shadow: 0 0 24px rgba(96, 165, 250, 0.25); display: grid; place-items: center;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.diamond svg { transform: rotate(-45deg); width: 34px; height: 34px; }
.hub-label { margin-top: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 16px; font-weight: 600; font-size: 14px; }
.hub-sub { font-size: 11.5px; color: var(--dim); margin-top: 4px; }
.transit { margin-top: 10px; width: 100%; background: rgba(31, 37, 51, 0.92); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.transit .field-label { display: flex; justify-content: space-between; }

/* ---------- zoom + log ---------- */
.zoom {
  position: absolute; left: 16px; bottom: 16px; display: flex; align-items: center; gap: 2px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px; z-index: 5;
}
.zoom button { background: none; border: 0; width: 30px; height: 28px; border-radius: 7px; cursor: pointer; font-size: 17px; }
.zoom button.fit { width: auto; padding: 0 10px; font-size: 12.5px; color: var(--muted); }
.zoom button:hover { background: var(--panel-2); }
.zoom span { min-width: 48px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }

.log {
  position: absolute; right: 16px; top: 16px; bottom: 16px; width: 320px; z-index: 5;
  background: rgba(31, 37, 51, 0.94); border: 1px solid var(--line); border-radius: 14px;
  display: flex; flex-direction: column; overflow: hidden; cursor: default;
}
.log-head { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.log-head h2 { font-size: 14px; margin: 0; }
.log-hint { font-size: 11.5px; color: var(--dim); }
.log-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.log-list li { padding: 8px 9px; border-radius: 9px; font-size: 12.5px; display: grid; gap: 3px; }
.log-list li:hover { background: rgba(255, 255, 255, 0.04); }
.log-list li.fresh { animation: fresh 2.4s ease-out; }
@keyframes fresh { from { background: rgba(74, 222, 128, 0.16); } to { background: transparent; } }
.log-row { display: flex; gap: 8px; align-items: baseline; }
.log-time { color: var(--dim); font-variant-numeric: tabular-nums; font-size: 11.5px; flex: none; }
.log-path { color: var(--muted); font-size: 11.5px; }
.log-sum { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-empty { color: var(--dim); font-size: 12.5px; padding: 14px; line-height: 1.5; }
@media (max-width: 900px) { .log { display: none; } }

/* ---------- login ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card { width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 26px; display: grid; gap: 14px; }
.login-card .sub { margin: -6px 0 4px; color: var(--muted); font-size: 13px; }
.login-card label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.login-card input:not([type="checkbox"]) { background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; color: var(--text); font: inherit; }
.login-card .remember { display: flex; align-items: center; gap: 8px; }
.login-card button { background: var(--green); color: #0f141d; border: 0; border-radius: 9px; padding: 10px; font-weight: 600; cursor: pointer; }
.login-error { color: var(--red); font-size: 13px; margin: 0; }

/* İnsan düğümü */
.avatar.logo { object-fit: contain; padding: 4px; background: #fff; }
.more { font-size: 11px; color: var(--dim); margin-top: 4px; }
