/*
 * Datanet Flow Status dashboard — v0 SPA styles.
 * Design language reused wholesale from the requirements mockup
 * (flow-status-dashboard-mockup.html): same palette, radius, chip and node
 * treatments. Additions over the mockup: the beta-auth banner, the seed panel,
 * the view create/edit form, honest empty states, remediation error cards, and
 * the visible NOT-WIRED tab placeholders.
 */
:root {
  --bg: #0f1419; --panel: #171d26; --panel2: #1e2632; --line: #2b3441;
  --ink: #e6edf3; --muted: #8b98a9; --faint: #5b6675;
  --green: #2ea043; --green-bg: #0f2916; --red: #e5484d; --red-bg: #2a1214;
  --amber: #d9a441; --amber-bg: #2a2110; --grey: #4a5566; --grey-bg: #1a2029;
  --accent: #4c9eeb; --accent-bg: #0e2233;
  --owned: #4c9eeb; --external: #a06ad9;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.5; }

/* beta-auth banner (driven by auth_mode from the API) */
.auth-banner {
  background: repeating-linear-gradient(45deg, #241a10, #241a10 12px, #2a1f12 12px, #2a1f12 24px);
  color: #d9a441; text-align: center; padding: 5px; font-size: 12px; letter-spacing: .04em;
  border-bottom: 1px solid var(--line);
}
.auth-banner b { color: var(--amber); }

header { padding: 16px 22px; border-bottom: 1px solid var(--line); background: var(--panel); }
header h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
header p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }

/* control bar */
.controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; padding: 14px 22px;
  border-bottom: 1px solid var(--line); background: var(--panel2); }
.ctl { display: flex; flex-direction: column; gap: 5px; }
.ctl label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
select, input[type=text], input[type=number] {
  background: var(--bg); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-family: var(--font); font-size: 13px; min-width: 150px;
}
.btn { background: var(--accent); color: #04121e; border: 0; border-radius: 8px; padding: 9px 15px;
  font-weight: 600; font-size: 13px; cursor: pointer; display: inline-flex; gap: 7px; align-items: center; }
.btn.secondary { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.spacer { flex: 1; }

/* tabs */
.tabs { display: flex; gap: 2px; padding: 0 22px; border-bottom: 1px solid var(--line); background: var(--panel2); }
.tab { padding: 11px 16px; color: var(--muted); cursor: pointer; font-size: 13px; border-bottom: 2px solid transparent; }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.tab .soon { font-size: 9.5px; color: var(--faint); border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 5px; margin-left: 6px; text-transform: uppercase; letter-spacing: .04em; }

main { padding: 22px; }
.panel { display: none; }
.panel.on { display: block; }

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 18px; font-size: 12px; color: var(--muted); }
.legend .k { display: inline-flex; gap: 6px; align-items: center; }
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot.g { background: var(--green); } .dot.r { background: var(--red); }
.dot.a { background: var(--amber); } .dot.x { background: var(--grey); }
.swatch { width: 22px; height: 11px; border-radius: 3px; border: 1px solid; }
.swatch.owned { border-color: var(--owned); background: var(--accent-bg); }
.swatch.ext { border-color: var(--external); background: #1c1428; }

/* seed panel */
.seed-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 18px; }
.seed-panel h4 { margin: 0 0 4px; font-size: 13px; color: var(--accent); }
.seed-panel p { margin: 0 0 12px; font-size: 12px; color: var(--muted); }
.seed-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.seed-result { margin-top: 14px; font-size: 12.5px; }
.seed-result .stat { display: inline-flex; gap: 6px; margin-right: 18px; font-family: var(--mono); }
.seed-result .stat b { color: var(--accent); }

/* generic result / error cards */
.card-ok { background: var(--green-bg); border: 1px solid #1c3a24; border-radius: 8px;
  padding: 10px 12px; font-size: 12.5px; color: #8fe0a3; margin-top: 12px; }
.card-err { background: var(--red-bg); border: 1px solid #4a1e20; border-radius: 8px;
  padding: 12px 14px; font-size: 12.5px; color: #f0a3a5; margin-top: 12px; }
.card-err b { color: var(--red); }
.card-err .remedy { display: block; margin-top: 8px; color: var(--amber); }
.card-err .remedy b { color: var(--amber); }
.card-info { background: var(--accent-bg); border: 1px solid #163a52; border-radius: 8px;
  padding: 10px 12px; font-size: 12.5px; color: #a9d3f2; margin-top: 12px; }

/* honest empty states */
.empty { text-align: center; color: var(--faint); font-size: 13px; padding: 40px 20px;
  background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty b { color: var(--muted); }

/* DAG (layered) */
.dag-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px 20px; }
.dag { position: relative; min-width: 900px; }
svg.edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.col-label { position: absolute; top: -6px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--faint); }
.node { position: absolute; width: 190px; background: var(--panel2); border: 1px solid var(--line);
  border-left-width: 4px; border-radius: 9px; padding: 10px 12px; cursor: pointer;
  transition: transform .1s, box-shadow .1s; }
.node:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }
.node.owned { border-left-color: var(--owned); }
.node.external { border-left-color: var(--external); }
.node .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.node .name { font-weight: 600; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node .type { font-size: 10.5px; color: var(--faint); margin-top: 2px; }
.node .meta { margin-top: 8px; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.ext-tag { font-size: 9.5px; color: var(--external); border: 1px solid var(--external); border-radius: 4px; padding: 1px 5px; }

/* matrix */
table.matrix { border-collapse: collapse; width: 100%; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.matrix th, .matrix td { border: 1px solid var(--line); padding: 0; text-align: center; }
.matrix thead th { background: var(--panel2); color: var(--muted); font-size: 11px; font-weight: 600; padding: 9px 6px; }
.matrix td.job { text-align: left; padding: 9px 12px; font-size: 12.5px; white-space: nowrap; cursor: pointer; }
.matrix td.job:hover { background: var(--panel2); }
.cell { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; }
.cell.g { background: var(--green-bg); color: var(--green); }
.cell.r { background: var(--red-bg); color: var(--red); }
.cell.a { background: var(--amber-bg); color: var(--amber); }
.cell.x { background: var(--grey-bg); color: var(--faint); }

/* side detail drawer */
.detail { position: fixed; top: 0; right: 0; width: 360px; height: 100%; background: var(--panel);
  border-left: 1px solid var(--line); padding: 20px; transform: translateX(100%);
  transition: transform .2s; overflow: auto; z-index: 20; }
.detail.on { transform: translateX(0); }
.detail h3 { margin: 0 0 2px; font-size: 15px; word-break: break-all; }
.detail .close { position: absolute; top: 14px; right: 16px; color: var(--muted); cursor: pointer; font-size: 20px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0;
  border-bottom: 1px solid var(--line); font-size: 12.5px; }
.kv .k { color: var(--muted); } .kv .v { font-family: var(--mono); text-align: right; word-break: break-all; }
.note { background: var(--amber-bg); border: 1px solid #3a2e14; border-radius: 8px;
  padding: 10px 12px; font-size: 12px; color: #e9c877; margin-top: 16px; }

/* modal (view create/edit) */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: none;
  align-items: center; justify-content: center; z-index: 40; }
.modal-back.on { display: flex; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; width: 460px; max-width: 92vw; }
.modal h3 { margin: 0 0 14px; font-size: 15px; }
.modal .field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.modal .field label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.modal .field input { min-width: 0; width: 100%; }
.modal .field .hint { font-size: 11px; color: var(--faint); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* not-wired placeholder */
.not-wired { text-align: center; padding: 48px 24px; background: var(--panel);
  border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.not-wired .tag { display: inline-block; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--amber); border: 1px solid #3a2e14; background: var(--amber-bg);
  border-radius: 20px; padding: 3px 10px; margin-bottom: 12px; }
.not-wired h3 { margin: 0 0 6px; font-size: 15px; color: var(--ink); }
.not-wired p { margin: 0 auto; max-width: 460px; font-size: 12.5px; }

/* toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(140%);
  background: var(--panel2); border: 1px solid var(--accent); color: var(--ink);
  padding: 11px 18px; border-radius: 10px; font-size: 13px; transition: transform .3s; z-index: 30; }
.toast.on { transform: translateX(-50%) translateY(0); }
