:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-soft: #0b1728;
  --panel: rgba(14, 29, 48, .92);
  --panel-2: #101f33;
  --line: rgba(148, 163, 184, .16);
  --line-strong: rgba(148, 163, 184, .3);
  --text: #e8f0fa;
  --muted: #8ca0b8;
  --blue: #38bdf8;
  --cyan: #22d3ee;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #fb7185;
  --purple: #a78bfa;
  --shadow: 0 18px 55px rgba(0, 0, 0, .32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body { background-image: radial-gradient(circle at 15% 0%, rgba(56,189,248,.09), transparent 28%), radial-gradient(circle at 90% 15%, rgba(167,139,250,.08), transparent 25%); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
[hidden] { display: none !important; }

.login-screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 15%, rgba(56,189,248,.12), transparent 36%), #06101d; z-index: 100; }
.login-card { width: min(430px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 22px; background: rgba(10,23,39,.94); box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.login-card h1 { font-size: 36px; margin: 6px 0 8px; letter-spacing: -.04em; }
.login-card > p:not(.eyebrow,.form-error) { margin: 0 0 30px; color: var(--muted); line-height: 1.55; }
.brand-mark { display: grid; grid-template-columns: repeat(3, 5px); gap: 3px; align-items: end; width: 22px; height: 28px; }
.brand-mark span { display: block; border-radius: 3px; background: linear-gradient(180deg, var(--cyan), var(--blue)); }
.brand-mark span:nth-child(1) { height: 13px; }.brand-mark span:nth-child(2) { height: 24px; }.brand-mark span:nth-child(3) { height: 18px; }
.brand-mark.large { transform: scale(1.4); transform-origin: left bottom; margin-bottom: 22px; }
.eyebrow { margin: 0; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .17em; }

.topbar { height: 68px; padding: 0 24px; display: flex; align-items: center; gap: 34px; border-bottom: 1px solid var(--line); background: rgba(7,17,31,.86); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 40; }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; min-width: 205px; }
.brand strong, .brand small { display: block; }.brand strong { font-size: 15px; }.brand small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.main-nav { display: flex; align-self: stretch; gap: 8px; }
.main-nav button { border: 0; background: transparent; color: var(--muted); padding: 0 12px; border-bottom: 2px solid transparent; font-weight: 650; font-size: 13px; }
.main-nav button:hover, .main-nav button.active { color: var(--text); border-bottom-color: var(--blue); }
.topbar-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.status-pill { display: inline-flex; gap: 7px; align-items: center; color: var(--muted); font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; }
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 9px var(--green); }
.status-pill.offline i { background: var(--red); box-shadow: 0 0 9px var(--red); }
.user-chip { border: 1px solid rgba(56,189,248,.3); background: rgba(56,189,248,.13); color: var(--blue); width: 32px; height: 32px; border-radius: 50%; font-weight: 800; }

main { min-height: calc(100vh - 68px); }
.view { display: none; padding: 34px; max-width: 1500px; margin: auto; }.view.active-view { display: block; }
.editor-view { max-width: none; padding: 0; height: calc(100vh - 68px); overflow: hidden; }.editor-view.active-view { display: flex; flex-direction: column; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin: 0 0 26px; }
.page-heading h1 { font-size: 31px; margin: 6px 0; letter-spacing: -.035em; }.page-heading h2 { margin: 5px 0; }.page-heading p:last-child { color: var(--muted); margin: 0; }
.page-heading.subheading { margin-top: 30px; }
.panel { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: 0 14px 35px rgba(0,0,0,.12); overflow: hidden; }
.panel-heading { padding: 20px 22px; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }.panel-heading span { color: var(--muted); font-size: 10px; letter-spacing: .15em; }.panel-heading h2 { margin: 5px 0 0; font-size: 18px; }

button.primary, button.secondary, button.accent, button.ghost, button.danger { border-radius: 9px; min-height: 36px; padding: 0 14px; font-weight: 750; font-size: 12px; border: 1px solid transparent; }
button.primary { color: #03131d; background: linear-gradient(135deg, var(--cyan), var(--blue)); }
button.accent { color: #07111f; background: linear-gradient(135deg, #fbbf24, #fb923c); }
button.secondary { color: var(--text); border-color: var(--line-strong); background: rgba(148,163,184,.07); }
button.ghost { color: var(--muted); background: transparent; border-color: var(--line); }
button.danger { color: var(--red); background: rgba(251,113,133,.08); border-color: rgba(251,113,133,.25); }
button.small { min-height: 30px; padding: 0 10px; font-size: 11px; }.wide { width: 100%; margin-top: 10px; min-height: 44px !important; }
.text-button { border: 0; background: transparent; color: var(--blue); font-size: 12px; }
.icon-button { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: transparent; font-size: 20px; }

.field { display: grid; gap: 7px; margin: 16px 0; }.field > span, .compact-field { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .03em; }
input, select, textarea { width: 100%; color: var(--text); border: 1px solid var(--line-strong); border-radius: 9px; background: #081523; padding: 10px 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(56,189,248,.1); }
.form-error { color: var(--red); min-height: 18px; font-size: 12px; }

.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }.stat-card span { color: var(--muted); font-size: 11px; }.stat-card strong { display: block; margin-top: 8px; font-size: 28px; }.stat-card em { font-style: normal; font-size: 11px; color: var(--green); }
.dashboard-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 20px; }
.event-list { max-height: 430px; overflow: auto; }.event { display: grid; grid-template-columns: 9px 1fr auto; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); align-items: center; }.event i { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }.event strong { font-size: 12px; }.event p, .event time { color: var(--muted); font-size: 11px; margin: 3px 0 0; }

.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }.data-table th { text-align: left; color: var(--muted); font-size: 10px; letter-spacing: .08em; padding: 13px 18px; background: rgba(148,163,184,.035); }.data-table td { padding: 15px 18px; border-top: 1px solid var(--line); vertical-align: middle; }.data-table tr:hover td { background: rgba(56,189,248,.025); }.table-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.state-dot { display: inline-flex; align-items: center; gap: 7px; }.state-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }.state-dot.online i, .state-dot.completed i, .state-dot.running i { background: var(--green); }.state-dot.queued i, .state-dot.downloading i { background: var(--amber); }.state-dot.failed i, .state-dot.safe i { background: var(--red); }
.empty-state { padding: 50px 25px; color: var(--muted); text-align: center; }.empty-state strong { color: var(--text); display: block; margin-bottom: 5px; }
.access-note { margin: 14px 4px 0; color: var(--muted); font-size: 11px; }
.role-badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line); background: rgba(148,163,184,.07); color: var(--blue); font-size: 10px; font-weight: 750; text-transform: uppercase; }

.editor-toolbar { height: 58px; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-bottom: 1px solid var(--line); background: rgba(11,23,40,.95); }.editor-toolbar select { width: 230px; padding: 8px 10px; }.toolbar-separator { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }.compact-field { display: flex; align-items: center; gap: 7px; }.compact-field input { width: 66px; padding: 7px; }.draft-state { margin-left: auto; color: var(--muted); font-size: 11px; }.draft-state.dirty { color: var(--amber); }
.editor-layout { display: grid; grid-template-columns: 190px minmax(0,1fr) 270px; min-height: 0; flex: 1; }
.node-palette, .properties-panel { background: #091625; overflow: auto; }.node-palette { border-right: 1px solid var(--line); padding: 15px 12px; }.properties-panel { border-left: 1px solid var(--line); padding: 17px; }
.palette-group { margin-bottom: 20px; }.palette-group h3 { color: var(--muted); font-size: 10px; letter-spacing: .13em; margin: 0 6px 9px; text-transform: uppercase; }.palette-node { width: 100%; display: flex; align-items: center; gap: 10px; color: var(--text); background: rgba(148,163,184,.045); border: 1px solid var(--line); border-left: 2px solid var(--node-accent); border-radius: 9px; padding: 9px; margin: 6px 0; font-size: 11px; text-align: left; }.palette-node:hover { background: rgba(56,189,248,.07); transform: translateX(2px); }.palette-icon { min-width: 29px; height: 25px; display: grid; place-items: center; color: var(--node-accent); border-radius: 6px; background: color-mix(in srgb, var(--node-accent) 12%, transparent); font-weight: 850; font-size: 9px; }
.canvas-viewport { overflow: auto; background: #07111d; }.flow-canvas { width: 3000px; height: 1800px; position: relative; background-image: linear-gradient(rgba(148,163,184,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(148,163,184,.04) 1px, transparent 1px), radial-gradient(circle, rgba(148,163,184,.16) 1px, transparent 1px); background-size: 100px 100px, 100px 100px, 20px 20px; }.edge-layer, .node-layer { position: absolute; inset: 0; }.edge-layer { pointer-events: none; overflow: visible; }.node-layer { pointer-events: none; }.canvas-hint { position: sticky; left: 30px; top: 20px; display: inline-block; color: rgba(140,160,184,.45); font-size: 11px; pointer-events: none; padding: 12px; }
.flow-node { position: absolute; width: 176px; min-height: 82px; padding: 10px 13px 11px; border: 1px solid var(--line-strong); border-top: 2px solid var(--node-accent); border-radius: 11px; background: linear-gradient(145deg, rgba(17,34,54,.98), rgba(9,22,37,.98)); box-shadow: 0 10px 25px rgba(0,0,0,.24); pointer-events: auto; user-select: none; }.flow-node:hover { border-color: color-mix(in srgb, var(--node-accent) 55%, var(--line)); }.flow-node.selected { outline: 2px solid color-mix(in srgb, var(--node-accent) 75%, white); outline-offset: 2px; }.flow-node.active { box-shadow: 0 0 0 1px var(--green), 0 0 24px rgba(52,211,153,.22); }.flow-node.issue { border-color: var(--red); }.node-header { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 9px; }.node-icon { color: var(--node-accent); font-weight: 900; }.flow-node strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }.flow-node small { display: block; color: var(--muted); margin-top: 5px; font-size: 9px; }
.node-port { position: absolute; width: 13px; height: 13px; border-radius: 50%; border: 2px solid #081522; background: var(--node-accent); padding: 0; transform: translateY(-50%); z-index: 3; }.node-port span { position: absolute; color: var(--muted); font-size: 8px; top: -2px; opacity: 0; transition: opacity .15s; }.node-port:hover span { opacity: 1; }.input-port { left: -7px; }.input-port span { left: 15px; }.output-port { right: -7px; }.output-port span { right: 15px; }.node-port.pending { box-shadow: 0 0 0 5px rgba(56,189,248,.18), 0 0 12px var(--blue); }
.flow-edge { fill: none; stroke: #52677f; stroke-width: 2.3; pointer-events: stroke; cursor: pointer; }.flow-edge:hover, .flow-edge.selected { stroke: var(--blue); stroke-width: 4; }.flow-edge.active { stroke: var(--green); filter: drop-shadow(0 0 4px rgba(52,211,153,.8)); }
.properties-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }.properties-heading span { color: var(--muted); font-size: 9px; letter-spacing: .13em; text-transform: uppercase; }.properties-heading h3 { margin: 4px 0 0; font-size: 17px; }.properties-panel .field { margin: 13px 0; }.properties-panel input, .properties-panel select { padding: 8px; font-size: 11px; }.properties-panel input:disabled { color: #64748b; }.check-field { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; margin: 14px 0; }.check-field input { width: 16px; }.input-suffix { display: flex; align-items: center; gap: 6px; }.input-suffix em { color: var(--muted); font-size: 10px; font-style: normal; }.empty-properties { color: var(--muted); font-size: 12px; line-height: 1.5; }.empty-properties span { color: var(--text); font-weight: 800; display: block; margin-bottom: 8px; }.empty-properties strong { display: block; margin-bottom: 18px; }.property-note { color: var(--muted); font-size: 11px; line-height: 1.5; }.property-issues { margin-top: 20px; padding: 10px; color: var(--red); border: 1px solid rgba(251,113,133,.25); background: rgba(251,113,133,.06); border-radius: 9px; font-size: 10px; }
.validation-bar { min-height: 42px; padding: 10px 18px; border-top: 1px solid var(--line); background: #0b1728; color: var(--muted); font-size: 11px; }.validation-bar.error { color: var(--red); }.validation-bar.success { color: var(--green); }

.modal { width: min(560px, calc(100% - 32px)); border: 1px solid var(--line-strong); border-radius: 16px; color: var(--text); background: #0c192a; box-shadow: var(--shadow); padding: 0; }.modal::backdrop { background: rgba(0,7,15,.74); backdrop-filter: blur(4px); }.modal form { margin: 0; }.modal-heading { padding: 20px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }.modal-heading h2 { margin: 0; font-size: 19px; }.modal-body { padding: 20px 22px; max-height: 65vh; overflow: auto; }.modal-actions { padding: 15px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }.secret-box { padding: 14px; border: 1px solid rgba(251,191,36,.3); border-radius: 9px; background: rgba(251,191,36,.06); word-break: break-all; color: var(--amber); font-family: ui-monospace, monospace; font-size: 11px; }
.toast-region { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 9px; z-index: 200; }.toast { min-width: 280px; max-width: 420px; padding: 13px 15px; color: var(--text); border: 1px solid var(--line-strong); border-left: 3px solid var(--blue); border-radius: 10px; background: #102137; box-shadow: var(--shadow); font-size: 12px; animation: toast-in .2s ease-out; }.toast.error { border-left-color: var(--red); }.toast.success { border-left-color: var(--green); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 1050px) {
  .main-nav { display: none; }.stats-grid { grid-template-columns: repeat(2,1fr); }.dashboard-grid { grid-template-columns: 1fr; }.editor-layout { grid-template-columns: 165px minmax(600px,1fr) 240px; }.topbar { padding: 0 14px; }.view { padding: 24px 16px; }
}
