:root{
  --bg: #0b1220;
  --panel: #0f172a;
  --card: #0b1324;
  --muted: #94a3b8;
  --text: #e5e7eb;
  --line: rgba(148,163,184,.18);
  --btn: rgba(148,163,184,.14);
  --btn2: rgba(148,163,184,.22);
  --primary: #60a5fa;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 800px at 20% 0%, #101b33 0%, #070b14 60%, #04060b 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell header {
  position: sticky;
  top: 0;
  background: rgba(10, 15, 28, 0.65);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 10;
}

.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

.card{
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.card-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 12px;
  border-bottom: 1px solid var(--line);
}

.card-title{
  font-weight: 700;
  letter-spacing: .2px;
}

.section-title{
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.table{
  width:100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th, .table td{
  padding: 10px 10px;
  border-bottom: 1px solid rgba(148,163,184,.10);
}
.table th{
  text-align:left;
  color:#cbd5e1;
  font-weight:600;
}
.table tbody tr:hover{
  background: rgba(148,163,184,.06);
}

.input{
  width: 100%;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(2,6,23,.45);
  color: var(--text);
  outline: none;
}
.input:focus{
  border-color: rgba(96,165,250,.65);
  box-shadow: 0 0 0 3px rgba(96,165,250,.15);
}

.btn{
  border: 1px solid rgba(148,163,184,.25);
  background: var(--btn);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
}
.btn:hover{ background: var(--btn2); }
.btn:disabled{ opacity: .55; cursor: not-allowed; }
.btn-primary{
  background: rgba(96,165,250,.25);
  border-color: rgba(96,165,250,.45);
}
.btn-primary:hover{
  background: rgba(96,165,250,.32);
}
.btn-danger{
  background: rgba(239,68,68,.18);
  border-color: rgba(239,68,68,.35);
}
.btn-danger:hover{
  background: rgba(239,68,68,.26);
}

/* Canvas layout */
.canvas-column{
  display:flex;
  flex-direction: column;
  gap: 10px;
}

.toolbar{
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-pill{
  display:flex;
  gap: 8px;
  align-items:center;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(2,6,23,.35);
  padding: 6px 10px;
  border-radius: 999px;
  cursor: grab;
  user-select:none;
  font-size: 13px;
}
.tool-pill:active{ cursor: grabbing; }
.dot{
  width:10px;
  height:10px;
  border-radius: 999px;
}

.flow-canvas-wrapper{
  position: relative;
  height: calc(100vh - 190px);
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(2,6,23,.35);
}

.zoom-controls{
  position:absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  display:flex;
  gap: 8px;
  align-items:center;
  padding: 8px;
  border-radius: 12px;
  background: rgba(2,6,23,.5);
  border: 1px solid rgba(148,163,184,.20);
}

.flow-canvas{
  position: absolute;
  inset: 0;
  overflow: auto;
}

.flow-content{
  position: relative;
  width: 3000px;
  height: 2200px;
}

/* faint grid */
.flow-content::before{
  content:"";
  position:absolute;
  inset:0;
  background-image:
    linear-gradient(to right, rgba(148,163,184,.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148,163,184,.08) 1px, transparent 1px);
  background-size: 16px 16px;
  opacity: .35;
  pointer-events:none;
}

.flow-node{
  position:absolute;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid var(--node-border, rgba(148,163,184,.25));
  background: var(--node-bg, rgba(148,163,184,.10));
  color: #0b1220;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
  cursor: grab;
  user-select:none;
}
.flow-node.selected{
  outline: 3px solid rgba(96,165,250,.35);
}

.flow-node-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 10px;
}
.flow-node-title{
  font-weight: 800;
  font-size: 13px;
  max-width: 128px;
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow-node-type-badge{
  font-size: 10px;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 10px;
  background: rgba(255,255,255,.55);
}
.flow-node-sub{
  margin-top: 4px;
  font-size: 11px;
  opacity: .85;
  max-width: 160px;
  overflow:hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-node-port{
  position:absolute;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  border: 2px solid rgba(0,0,0,.15);
  cursor: pointer;
}
.flow-node-port--top{ top: -7px; left: calc(50% - 6px); }
.flow-node-port--right{ right: -7px; top: calc(50% - 6px); }
.flow-node-port--bottom{ bottom: -7px; left: calc(50% - 6px); }
.flow-node-port--left{ left: -7px; top: calc(50% - 6px); }

/* SVG connectors */
.flow-connections{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  overflow: visible;
}

.conn{
  fill:none;
  stroke: rgba(255,255,255,.65);
  stroke-width: 2.0;
}
.conn.selected{
  stroke: rgba(96,165,250,.95);
  stroke-width: 2.6;
}
.conn-hit{
  fill:none;
  stroke: rgba(255,255,255,0);
  stroke-width: 18;
  cursor: pointer;
}

.wp rect{
  fill: rgba(96,165,250,.95);
  stroke: rgba(0,0,0,.15);
  stroke-width: 1;
  rx: 3;
  ry: 3;
}
.wp-hit{
  fill: rgba(255,255,255,0);
  stroke: rgba(255,255,255,0);
  stroke-width: 1;
}

/* Properties panel helpers */
.hint{
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.aa-grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.aa-row{
  display:grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  align-items:center;
}
.aa-digit{
  font-size: 12px;
  color: #cbd5e1;
}
.aa-full{
  grid-column: 1 / -1;
}
.aa-check{
  display:flex;
  gap: 8px;
  align-items:center;
  color: #cbd5e1;
  font-size: 12px;
}

.radio-group{
  display:grid;
  gap: 8px;
}
.radio-item{
  display:flex;
  gap: 8px;
  align-items:flex-start;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(2,6,23,.25);
}
.radio-item strong{
  display:block;
  font-size: 12px;
  color: #e5e7eb;
}
.radio-item span{
  display:block;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.25;
}
