:root {
  --bg: #080b0a;
  --panel: #0d1110;
  --panel-2: #121715;
  --panel-3: #18201c;
  --line: #25302b;
  --line-soft: #1a221f;
  --text: #eef5f1;
  --muted: #829087;
  --green: #4de69a;
  --green-deep: #143d2a;
  --blue: #7ba9ff;
  --danger: #ff7272;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { font-family: var(--font-geist-sans), Arial, sans-serif; }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.eyebrow { color: #8c9791; font: 700 11px/1 var(--font-geist-mono), monospace; letter-spacing: .18em; }
.eyebrow.green, .green { color: var(--green); }
.primary-button { height: 50px; border: 0; border-radius: 5px; padding: 0 20px; background: var(--green); color: #06130c; font-weight: 750; cursor: pointer; display: inline-flex; align-items: center; justify-content: space-between; gap: 24px; transition: transform .2s, background .2s; }
.primary-button:hover { background: #6ff0ad; transform: translateY(-1px); }
.primary-button.compact { height: 44px; }
.primary-button.tiny { height: 36px; padding: 0 14px; border-radius: 4px; font-size: 13px; gap: 8px; }
.ghost-button { height: 36px; border: 1px solid var(--line); background: var(--panel-2); padding: 0 13px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.ghost-button:hover { border-color: #44544c; }

/* Login */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(430px, .8fr); background: #070a09; overflow: hidden; }
.login-brand { min-height: 100vh; position: relative; padding: clamp(42px, 7vw, 100px); display: flex; flex-direction: column; justify-content: center; border-right: 1px solid #1b2621; background-image: radial-gradient(circle at 1px 1px, #223029 1px, transparent 0); background-size: 26px 26px; }
.login-brand::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(7,10,9,.25), rgba(7,10,9,.9)); }
.login-brand > * { position: relative; z-index: 1; }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid #315441; color: var(--green); margin-bottom: 64px; transform: rotate(45deg); }
.brand-mark span { font-size: 19px; transform: rotate(-45deg); }
.login-brand h1 { max-width: 720px; font-size: clamp(44px, 5.2vw, 76px); line-height: 1.03; letter-spacing: -.055em; margin: 20px 0 24px; }
.login-brand h1 em { color: var(--green); font-style: normal; font-weight: 500; }
.login-brand > p { max-width: 580px; color: #9eaaa3; font-size: 17px; line-height: 1.7; }
.workflow-preview { margin-top: 58px; width: min(620px, 100%); border-left: 1px solid #30423a; }
.preview-line { height: 52px; display: grid; grid-template-columns: 56px 52px 1fr 90px; align-items: center; border-top: 1px solid #1e2924; color: #bac6bf; background: rgba(13,18,16,.72); }
.preview-line:last-child { border-bottom: 1px solid #1e2924; }
.preview-line b { font: 500 11px var(--font-geist-mono); color: #5f6b64; text-align: center; }
.preview-line span { color: var(--green); font-size: 21px; }
.preview-line strong { font: 600 12px var(--font-geist-mono); letter-spacing: .08em; }
.preview-line i { width: 36px; height: 5px; background: #1a3426; position: relative; }
.preview-line i::after { content: ""; position: absolute; left: 0; inset-block: 0; width: 70%; background: var(--green); }
.login-foot { position: absolute; bottom: 34px; font: 500 10px var(--font-geist-mono); letter-spacing: .12em; color: #526059; }
.login-foot span { color: var(--green); margin: 0 8px; }
.login-panel { min-height: 100vh; display: grid; place-items: center; padding: 42px; background: #0b0f0d; }
.login-card { width: min(390px, 100%); }
.login-card h2 { font-size: 34px; letter-spacing: -.04em; margin: 14px 0 10px; }
.login-card > p { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0 0 36px; }
.login-card label { display: grid; gap: 9px; margin-top: 18px; color: #aeb9b2; font-size: 12px; font-weight: 650; }
.login-card input { height: 48px; border: 1px solid #29332e; border-radius: 4px; background: #101512; color: var(--text); padding: 0 14px; transition: border .2s; }
.login-card input:hover, .login-card input:focus { border-color: #496253; }
.login-card .primary-button { width: 100%; margin-top: 24px; }
.form-error { margin-top: 13px; color: #ff8e8e; font-size: 12px; }
.demo-note { margin-top: 22px; border-top: 1px solid #202925; padding-top: 20px; display: flex; gap: 12px; color: #89968f; }
.demo-note > span { width: 28px; height: 28px; border: 1px solid #35463e; border-radius: 50%; display: grid; place-items: center; color: var(--green); font: 600 12px serif; }
.demo-note div { display: grid; gap: 4px; }
.demo-note b { font-size: 12px; color: #c3cdc7; }.demo-note small { font: 11px var(--font-geist-mono); }
.mobile-logo { display: none; }

/* App chrome */
.app-shell { min-height: 100vh; background: var(--bg); }
.nav-rail { position: fixed; z-index: 30; inset: 0 auto 0 0; width: 66px; background: #0b0f0d; border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; align-items: center; }
.nav-logo { width: 66px; height: 64px; background: transparent; border: 0; border-bottom: 1px solid var(--line-soft); color: var(--green); cursor: pointer; }
.nav-rail nav { display: grid; gap: 8px; margin-top: 24px; }
.nav-rail nav button, .nav-bottom button { width: 40px; height: 40px; border: 0; background: transparent; color: #68756d; border-radius: 5px; cursor: pointer; }
.nav-rail nav button:hover, .nav-rail nav button.active { background: #17201c; color: var(--green); }
.nav-bottom { margin-top: auto; display: grid; gap: 15px; place-items: center; padding-bottom: 20px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #d5efe1; color: #18221d; display: grid; place-items: center; font-weight: 800; font-size: 12px; }

/* Dashboard */
.dashboard { margin-left: 66px; min-height: 100vh; padding: 56px clamp(28px, 5vw, 76px) 70px; background-image: linear-gradient(#111715 1px, transparent 1px), linear-gradient(90deg, #111715 1px, transparent 1px); background-size: 48px 48px; }
.dashboard-header { display: flex; justify-content: space-between; align-items: end; gap: 30px; max-width: 1280px; margin: auto; }
.dashboard-header h1 { font-size: clamp(36px, 4vw, 56px); letter-spacing: -.055em; margin: 14px 0 8px; }
.dashboard-header p { margin: 0; color: var(--muted); }
.stats-row { max-width: 1280px; margin: 42px auto 54px; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); background: rgba(10,14,12,.86); }
.stats-row > div { min-height: 104px; padding: 24px 28px; display: flex; flex-direction: column; gap: 10px; border-right: 1px solid var(--line); }
.stats-row > div:last-child { border: 0; }
.stats-row span { text-transform: uppercase; font: 600 10px var(--font-geist-mono); letter-spacing: .12em; color: #718078; }
.stats-row b { font-size: 25px; }
.stats-row .healthy { color: #bcebd1; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.healthy i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(77,230,154,.09); }
.section-heading { max-width: 1280px; margin: 0 auto 20px; display: flex; justify-content: space-between; align-items: center; }
.section-heading h2 { font-size: 18px; margin: 0; }.section-heading span { color: var(--muted); font-size: 12px; }
.algorithm-grid { max-width: 1280px; margin: auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.algorithm-card, .new-card { min-height: 310px; border: 1px solid var(--line); background: #0f1412; padding: 24px; position: relative; transition: border .2s, transform .2s; }
.algorithm-card:hover { border-color: #43534b; transform: translateY(-2px); }
.algorithm-icon { width: 42px; height: 42px; display: grid; place-items: center; background: #183527; color: var(--green); border: 1px solid #28543c; font-size: 20px; }
.tone-1 { background: #17263c; border-color: #29476d; color: #8bb7ff; }.tone-2 { background: #362a17; border-color: #594426; color: #f5bd5b; }
.card-menu { position: absolute; z-index: 8; right: 18px; top: 17px; color: #aab7b0; }
.card-menu summary { width: 42px; height: 38px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 4px; cursor: pointer; list-style: none; font: 800 17px/1 Arial, sans-serif; letter-spacing: 2px; }
.card-menu summary::-webkit-details-marker { display: none; }
.card-menu summary:hover, .card-menu[open] summary { color: var(--green); border-color: #385247; background: #17231d; }
.card-menu-panel { position: absolute; right: 0; top: 45px; width: 310px; padding: 16px; border: 1px solid #405149; background: #111815; box-shadow: 0 18px 50px rgba(0,0,0,.55); }
.card-menu-panel > b { display: block; margin-bottom: 11px; font-size: 15px; color: #f2f7f4; }
.card-menu-panel form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.card-menu-panel input { min-width: 0; height: 42px; padding: 0 11px; border: 1px solid #3a4941; background: #090e0c; color: #f2f7f4; font-size: 15px; }
.card-menu-panel input:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.card-menu-panel button { height: 42px; padding: 0 14px; border: 0; border-radius: 4px; background: var(--green); color: #06130c; font-weight: 750; cursor: pointer; }
.algorithm-card h3 { margin: 24px 0 9px; font-size: 18px; }.algorithm-card > p { color: var(--muted); font-size: 13px; line-height: 1.55; min-height: 40px; }
.mini-flow { display: flex; align-items: center; height: 48px; margin: 17px 0; }
.mini-flow span { width: 36px; height: 36px; display: grid; place-items: center; color: #91a69a; background: #151d19; border: 1px solid #28342e; border-radius: 50%; margin-right: -4px; }
.mini-flow small { color: #6f7a74; margin-left: 10px; }
.card-meta { border-top: 1px solid var(--line-soft); padding-top: 16px; display: flex; justify-content: space-between; color: #68756e; font-size: 11px; }.card-meta b { color: #c8d3cd; }
.card-actions { position: absolute; inset: auto 24px 20px; display: grid; grid-template-columns: 1fr 38px 38px; gap: 7px; }
.card-actions button { height: 38px; border: 1px solid var(--line); background: #141a17; cursor: pointer; }.card-actions button:first-child { text-align: left; padding: 0 12px; display: flex; justify-content: space-between; align-items: center; }.card-actions button:hover { border-color: var(--green); color: var(--green); }
.new-card { color: #75827b; border-style: dashed; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; }
.new-card > span { width: 44px; height: 44px; border: 1px solid #304039; display: grid; place-items: center; color: var(--green); margin-bottom: 16px; }.new-card b { color: #c6d0ca; margin-bottom: 7px; }.new-card small { color: #66736c; }.new-card:hover { border-color: var(--green); background: #101813; }

/* Builder */
.builder-shell { margin-left: 66px; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.builder-topbar { height: 64px; flex: 0 0 64px; border-bottom: 1px solid var(--line-soft); background: #0b0f0d; display: flex; align-items: center; gap: 12px; padding: 0 18px; z-index: 10; }
.back-button { width: 34px; height: 34px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.builder-title { min-width: 0; display: flex; align-items: center; gap: 7px; flex: 1; color: #647169; font-size: 12px; }
.builder-title input { min-width: 180px; max-width: 340px; width: 35vw; border: 0; background: transparent; color: var(--text); font-weight: 670; padding: 8px; }
.top-status { display: flex; align-items: center; gap: 14px; font: 500 11px var(--font-geist-mono); color: #69766f; }.top-status span { display: flex; align-items: center; gap: 6px; }.top-status span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }.top-status .saving::before { background: #e5be59; }.top-status b { color: #9eaaa3; border-left: 1px solid var(--line); padding-left: 14px; }
.readonly-badge { border: 1px solid #554a29; color: #f4c966; background: #241f11; border-radius: 3px; padding: 8px 10px; font-size: 11px; }
.builder-layout { display: grid; grid-template-columns: 288px minmax(0, 1fr); min-height: 0; flex: 1; }
.action-library { border-right: 1px solid var(--line-soft); background: #0b0f0d; min-height: 0; display: flex; flex-direction: column; }
.library-title { padding: 23px 20px 16px; display: flex; justify-content: space-between; align-items: start; }.library-title div { display: grid; gap: 6px; }.library-title span { font-weight: 720; }.library-title small { color: #66736c; font-size: 10px; }.library-title b { color: #647169; font: 500 11px var(--font-geist-mono); border: 1px solid var(--line); padding: 4px 7px; }
.search-field { height: 39px; margin: 0 14px 11px; display: flex; align-items: center; gap: 8px; padding: 0 11px; background: #111714; border: 1px solid #222d28; }.search-field span { color: #75827a; }.search-field input { width: 100%; border: 0; outline: 0; background: transparent; color: #c9d3cd; font-size: 12px; }
.action-list { min-height: 0; overflow: auto; padding: 0 10px 18px; }
.action-list::-webkit-scrollbar, .canvas-scroll::-webkit-scrollbar { width: 7px; }.action-list::-webkit-scrollbar-thumb, .canvas-scroll::-webkit-scrollbar-thumb { background: #28332e; }
.action-group h3 { margin: 16px 9px 7px; color: #56635c; text-transform: uppercase; font: 650 9px var(--font-geist-mono); letter-spacing: .16em; }
.action-group button { width: 100%; height: 56px; border: 1px solid transparent; background: transparent; border-radius: 3px; display: grid; grid-template-columns: 35px 1fr 22px; align-items: center; text-align: left; cursor: grab; color: #9da9a2; padding: 0 8px; }
.action-group button:hover { background: #131b17; border-color: #26352d; }.action-group button > span:nth-child(2) { display: grid; gap: 4px; }.action-group button b { color: #dce5e0; font-size: 12px; }.action-group button small { color: #5f6c65; font-size: 9px; }.action-group button i { color: #506059; font-style: normal; }.action-icon { width: 29px; height: 29px; display: grid; place-items: center; color: var(--green); background: #14231b; border: 1px solid #20402f; border-radius: 3px; font-size: 16px; }
.library-tip { margin: auto 14px 14px; padding: 13px; border: 1px solid #26342d; background: #101712; display: flex; gap: 10px; }.library-tip > span { color: var(--green); }.library-tip p { display: grid; gap: 3px; margin: 0; }.library-tip b { font-size: 10px; }.library-tip small { color: #66726b; font-size: 9px; line-height: 1.4; }
.canvas-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; background-color: #0d110f; background-image: radial-gradient(circle at 1px 1px, #202a25 1px, transparent 0); background-size: 24px 24px; }
.canvas-toolbar { height: 56px; flex: 0 0 56px; padding: 0 25px; background: rgba(13,17,15,.96); border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: center; }.canvas-toolbar > div { display: flex; align-items: center; gap: 8px; }.canvas-toolbar b { font-size: 12px; }.canvas-toolbar small { color: #5e6a64; font-size: 10px; margin-left: 5px; }.canvas-toolbar button { border: 0; border-left: 1px solid var(--line); background: transparent; color: #7a8780; padding: 4px 12px; font-size: 10px; cursor: pointer; }.canvas-toolbar button:hover { color: var(--green); }.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.canvas-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 26px max(28px, calc((100% - 760px)/2)) 80px; }
.step-card { position: relative; border: 1px solid #29352f; background: #111714; box-shadow: 0 14px 40px rgba(0,0,0,.18); transition: border .2s; }.step-card:hover { border-color: #43544b; }.step-card.collapsed { background: #101512; }
.step-number { position: absolute; left: -45px; top: 19px; width: 31px; text-align: right; color: #4c5b53; font: 600 10px var(--font-geist-mono); }
.step-number::after { content: ""; position: absolute; width: 7px; height: 7px; border: 1px solid #375043; background: #0d110f; border-radius: 50%; right: -17px; top: 2px; }
.step-header { min-height: 68px; display: flex; align-items: center; padding: 10px 12px; }.drag-handle { color: #526159; padding: 8px; cursor: grab; }.step-action-icon { width: 36px; height: 36px; display: grid; place-items: center; color: var(--green); background: #14251c; border: 1px solid #26523a; margin: 0 12px 0 4px; font-size: 18px; }.step-header > div:nth-of-type(1) { display: grid; gap: 3px; }.step-header small { font: 600 8px var(--font-geist-mono); letter-spacing: .1em; color: #67736c; }.step-header h3 { font-size: 13px; margin: 0; }.step-controls { margin-left: auto; display: flex; }.step-controls button { width: 34px; height: 34px; border: 0; background: transparent; color: #68766e; cursor: pointer; font-size: 16px; }.step-controls button:hover { color: var(--green); background: #17201c; }.step-controls .danger:hover { color: var(--danger); }
.step-body { border-top: 1px solid var(--line-soft); padding: 16px 20px 20px 68px; }.source-control { display: flex; justify-content: flex-end; align-items: center; gap: 9px; color: #637068; font-size: 9px; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 11px; }.source-control select { width: 94px; height: 28px; }
.fields-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }.fields-grid label { min-width: 0; display: grid; gap: 6px; color: #738078; text-transform: uppercase; font: 600 8px var(--font-geist-mono); letter-spacing: .1em; }.fields-grid .wide { grid-column: 1 / -1; }.fields-grid input, .fields-grid select, .source-control select { min-width: 0; height: 37px; padding: 0 10px; border: 1px solid #29352f; background: #0c110e; color: #cbd6d0; border-radius: 2px; text-transform: none; font: 11px var(--font-geist-mono); letter-spacing: 0; }.fields-grid input:focus, .fields-grid select:focus { border-color: #3b6e51; outline: none; }
.drop-zone { height: 18px; display: grid; place-items: center; border-left: 1px solid #25332c; margin-left: -29px; }.drop-zone span { display: none; width: 100%; height: 28px; background: #163925; border: 1px dashed var(--green); color: var(--green); text-align: center; font: 600 9px/26px var(--font-geist-mono); text-transform: uppercase; letter-spacing: .12em; }.drop-zone.visible { height: 42px; }.drop-zone.visible span { display: block; }.drop-zone.final { height: 34px; }.drop-zone.final.visible { height: 48px; }
.flow-end { height: 64px; display: flex; align-items: center; gap: 13px; margin-left: -42px; }.flow-end > span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1px solid #28553d; color: var(--green); background: #102117; font-size: 11px; }.flow-end div { display: grid; gap: 3px; }.flow-end b { font-size: 11px; }.flow-end small { color: #5c6862; font-size: 9px; }
.empty-canvas { min-height: 58vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: #738078; }.empty-canvas > span { width: 64px; height: 64px; display: grid; place-items: center; border: 1px dashed #365044; color: var(--green); font-size: 24px; }.empty-canvas h2 { color: #cad4ce; margin: 20px 0 7px; font-size: 18px; }.empty-canvas p { font-size: 12px; }

/* Modal */
.modal-backdrop { position: fixed; z-index: 100; inset: 0; background: rgba(2,5,3,.82); display: grid; place-items: center; padding: 24px; backdrop-filter: blur(5px); }
.json-modal { width: min(760px, 100%); max-height: 86vh; background: #0d1210; border: 1px solid #33433b; display: flex; flex-direction: column; box-shadow: 0 30px 90px rgba(0,0,0,.6); }.json-modal header { display: flex; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }.json-modal header span { font: 700 9px var(--font-geist-mono); letter-spacing: .16em; }.json-modal h2 { margin: 6px 0 0; font-size: 18px; }.json-modal header button { border: 0; background: transparent; color: #849188; font-size: 23px; cursor: pointer; }.json-modal pre { flex: 1; min-height: 0; overflow: auto; margin: 0; padding: 22px; color: #aee9c8; font: 11px/1.7 var(--font-geist-mono); background: #090d0b; }.json-modal footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }.json-modal footer > span { color: #819087; font-size: 10px; }.json-modal footer i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-right: 7px; }
.toast { position: fixed; z-index: 120; right: 24px; bottom: 24px; min-width: 240px; padding: 14px 18px; background: #16241c; border: 1px solid #2d5d42; color: #d7eee1; box-shadow: 0 14px 40px rgba(0,0,0,.4); font-size: 12px; display: flex; align-items: center; gap: 10px; }.toast span { color: var(--green); }

@media (max-width: 1000px) {
  .algorithm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .builder-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .top-status { display: none; }
  .canvas-scroll { padding-inline: 60px 30px; }
}

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }.login-brand { display: none; }.login-panel { padding: 26px; }.mobile-logo { display: block; margin-bottom: 60px; color: #e7efea; font-weight: 750; letter-spacing: .08em; }.mobile-logo span { color: var(--green); margin-right: 8px; }
  .nav-rail { inset: auto 0 0; width: auto; height: 56px; flex-direction: row; border: 0; border-top: 1px solid var(--line); }.nav-logo { width: 58px; height: 56px; border: 0; border-right: 1px solid var(--line); }.nav-rail nav { display: flex; margin: 0; }.nav-bottom { display: none; }
  .dashboard, .builder-shell { margin-left: 0; margin-bottom: 56px; }.dashboard { padding: 34px 18px 60px; }.dashboard-header { align-items: start; flex-direction: column; }.stats-row { grid-template-columns: 1fr; }.stats-row > div { border: 0; border-bottom: 1px solid var(--line); min-height: 86px; }.algorithm-grid { grid-template-columns: 1fr; }
  .builder-shell { height: calc(100vh - 56px); }.builder-topbar { padding: 0 8px; gap: 6px; }.builder-title span, .builder-topbar .ghost-button { display: none; }.builder-title input { width: 100%; min-width: 0; }.builder-layout { grid-template-columns: 1fr; grid-template-rows: 132px minmax(0,1fr); }.action-library { border: 0; border-bottom: 1px solid var(--line); }.library-title, .library-tip { display: none; }.search-field { margin-top: 9px; }.action-list { display: flex; overflow-x: auto; padding: 0 9px 8px; }.action-group { display: flex; }.action-group h3 { display: none; }.action-group button { width: 160px; flex: 0 0 160px; }.canvas-toolbar { padding-inline: 15px; }.canvas-toolbar small, .canvas-toolbar button:first-child { display: none; }.canvas-scroll { padding: 18px 14px 70px 48px; }.step-body { padding-left: 20px; }.fields-grid { grid-template-columns: 1fr; }.fields-grid .wide { grid-column: auto; }.step-number { left: -38px; }
}

/* Builder readability and compact workflow rows */
.builder-shell {
  --muted: #a8b5ae;
  --line: #344139;
  color: #f3f8f5;
}
.builder-layout { grid-template-columns: 350px minmax(0, 1fr); }
.builder-topbar { height: 68px; flex-basis: 68px; }
.builder-title { font-size: 13px; }
.builder-title input { font-size: 15px; color: #f7fbf9; }
.top-status, .top-status b { font-size: 12px; color: #b6c3bc; }
.action-library { background: #0d1210; }
.library-title { padding: 22px 20px 16px; }
.library-title span { font-size: 18px; line-height: 1.25; color: #f7fbf9; }
.library-title small { font-size: 13px; line-height: 1.4; color: #bac7c0; }
.library-title b { font-size: 13px; }
.search-field { height: 48px; margin-inline: 16px; }
.search-field input { font-size: 15px; color: #f2f7f4; }
.search-field input::placeholder { color: #9fada5; opacity: 1; }
.action-list { padding-inline: 12px; }
.action-group h3 { margin: 22px 12px 9px; font-size: 12px; line-height: 1.2; color: #b4c1ba; }
.action-group button {
  height: 58px;
  grid-template-columns: 44px 1fr 30px;
  padding: 0 12px;
  border-radius: 6px;
}
.action-group button:hover { background: #18211d; border-color: #3f5148; }
.action-group button > span:nth-child(2) { gap: 5px; }
.action-group button b { font-size: 15px; line-height: 1.2; color: #f7fbf9; }
.action-group button small { font-size: 12px; line-height: 1.25; color: #b1beb7; }
.action-group button i { color: #9bc8ae; font-size: 19px; }
.action-icon { width: 36px; height: 36px; font-size: 18px; }
.library-tip { margin: auto 16px 16px; padding: 15px; }
.library-tip b { font-size: 13px; }
.library-tip small { font-size: 11px; line-height: 1.45; color: #a7b5ad; }
.canvas-toolbar { height: 58px; flex-basis: 58px; }
.canvas-toolbar b { font-size: 13px; }
.canvas-toolbar small, .canvas-toolbar button { font-size: 11px; color: #9eaaa3; }
.canvas-scroll {
  padding: 24px max(48px, calc((100% - 1040px)/2)) 80px;
}
.step-card {
  min-height: 54px;
  border-color: #344139;
  border-radius: 6px;
  box-shadow: 0 7px 22px rgba(0,0,0,.18);
  background: #121815;
}
.step-card.collapsed { min-height: 54px; background: #121815; }
.step-card:hover { border-color: #628070; background: #151d19; }
.step-header {
  min-height: 54px;
  height: 54px;
  padding: 6px 8px;
  cursor: pointer;
}
.drag-handle {
  align-self: stretch;
  min-width: 40px;
  display: grid;
  place-items: center;
  margin: -6px 3px -6px -8px;
  padding: 0;
  color: #9aaba1;
  cursor: grab;
  font-size: 18px;
  border-right: 1px solid #27332d;
}
.step-card:active .drag-handle { cursor: grabbing; }
.step-action-icon { width: 34px; height: 34px; margin: 0 11px; font-size: 17px; }
.step-header small { font-size: 9px; color: #94a299; }
.step-header h3 { font-size: 14px; color: #f4f8f6; }
.step-summary {
  min-width: 0;
  flex: 1;
  margin-left: 28px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: #b2beb7;
  font: 12px/1.3 var(--font-geist-mono), monospace;
}
.step-controls button { width: 38px; height: 38px; color: #a5b1aa; }
.step-body { padding: 18px 22px 22px 76px; background: #0f1512; }
.fields-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.fields-grid label { font-size: 10px; color: #aebbb3; }
.fields-grid input, .fields-grid select, .source-control select {
  height: 42px;
  border-color: #3a4941;
  color: #f1f6f3;
  background: #0a0f0c;
  font-size: 13px;
}
.step-number { left: -52px; top: 20px; color: #91a098; font-size: 11px; }
.step-number::after { right: -18px; border-color: #4c6f5d; }
.drop-zone {
  height: 30px;
  margin-left: -34px;
  padding-left: 34px;
  border-left-color: #34443b;
  cursor: copy;
}
.drop-zone span {
  display: block;
  height: 22px;
  opacity: 0;
  border: 1px dashed #496255;
  border-radius: 5px;
  color: #9ac9ae;
  background: rgba(28,61,42,.32);
  font: 600 10px/20px var(--font-geist-mono), monospace;
  transition: opacity .15s, background .15s, border-color .15s;
}
.drop-zone:hover span, .drop-zone.visible span { opacity: 1; }
.drop-zone.visible { height: 46px; }
.drop-zone.visible span { height: 36px; line-height: 34px; border-color: var(--green); background: #173d29; }
.drop-zone.final { height: 42px; }
.canvas-scroll.drag-active {
  background-color: rgba(17, 27, 22, .94);
  outline: 2px solid rgba(77, 230, 154, .38);
  outline-offset: -2px;
}
.canvas-scroll.drag-active .drop-zone {
  height: 36px;
}
.canvas-scroll.drag-active .drop-zone span {
  opacity: .52;
  height: 28px;
  line-height: 26px;
  border-color: #537263;
  background: rgba(26, 57, 40, .58);
}
.canvas-scroll.drag-active .drop-zone.active {
  height: 54px;
}
.canvas-scroll.drag-active .drop-zone.active span {
  opacity: 1;
  height: 46px;
  line-height: 44px;
  border: 2px solid var(--green);
  color: #06130c;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(77, 230, 154, .10), 0 12px 32px rgba(0, 0, 0, .24);
  font-size: 12px;
}
.step-card.drop-before::before,
.step-card.drop-after::after {
  content: "Отпустите, чтобы вставить";
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  height: 34px;
  display: grid;
  place-items: center;
  color: #06130c;
  background: var(--green);
  border-radius: 5px;
  font: 750 11px var(--font-geist-mono), monospace;
  pointer-events: none;
}
.step-card.drop-before::before { bottom: calc(100% + 5px); }
.step-card.drop-after::after { top: calc(100% + 5px); }
.flow-end { margin-left: -47px; color: #d8e2dc; }
.flow-end b { font-size: 12px; }
.flow-end small { font-size: 10px; color: #8e9c94; }

@media (max-width: 1100px) {
  .builder-layout { grid-template-columns: 320px minmax(0, 1fr); }
  .step-summary { margin-left: 14px; }
  .fields-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .builder-layout { grid-template-columns: 1fr; grid-template-rows: 138px minmax(0,1fr); }
  .canvas-scroll { padding: 18px 14px 70px 50px; }
  .step-summary { display: none; }
  .step-body { padding: 15px; }
  .fields-grid { grid-template-columns: 1fr; }
  .drop-zone { height: 26px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }

/* PHP application adaptations */
a { color: inherit; text-decoration: none; }
.workflow-preview > div { height: 52px; display: grid; grid-template-columns: 56px 52px 1fr 90px; align-items: center; border-top: 1px solid #1e2924; color: #bac6bf; background: rgba(13,18,16,.72); }
.workflow-preview > div:last-child { border-bottom: 1px solid #1e2924; }
.workflow-preview > div b { font: 500 11px var(--font-geist-mono), monospace; color: #5f6b64; text-align: center; }
.workflow-preview > div span { color: var(--green); font-size: 21px; }
.workflow-preview > div strong { font: 600 12px var(--font-geist-mono), monospace; letter-spacing: .08em; }
.workflow-preview > div i { width: 36px; height: 5px; background: #1a3426; position: relative; }
.workflow-preview > div i::after { content: ""; position: absolute; left: 0; inset-block: 0; width: 70%; background: var(--green); }
.login-brand footer { position: absolute; bottom: 34px; font: 500 10px var(--font-geist-mono), monospace; letter-spacing: .12em; color: #526059; }
.login-brand footer span { color: var(--green); margin: 0 8px; }
.nav-logo { display: grid; place-items: center; }
.nav-rail nav a, .nav-rail nav span, .nav-bottom a { width: 40px; height: 40px; border: 0; background: transparent; color: #68756d; border-radius: 5px; display: grid; place-items: center; }
.nav-rail nav a:hover, .nav-rail nav a.active, .nav-rail nav span.active { background: #17201c; color: var(--green); }
.dashboard-header form { margin: 0; }
.flash { max-width: 1280px; margin: 24px auto -18px; border: 1px solid #6f3c3c; background: #261616; color: #ffabab; padding: 12px 15px; font-size: 12px; }
.card-actions { grid-template-columns: 1fr 38px 38px 38px; }
.card-actions > a { height: 38px; border: 1px solid var(--line); background: #141a17; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; font-size: 13px; }
.card-actions form { margin: 0; }
.card-actions form button { width: 100%; }
.card-actions > a:hover { border-color: var(--green); color: var(--green); }
.card-actions > button { width: 38px; padding: 0; font-size: 18px; }
.card-actions > button:hover { border-color: var(--green); color: var(--green); }
.new-card { padding: 0; }
.new-card button { width: 100%; min-height: 308px; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; color: #75827b; }
.new-card button > span { width: 44px; height: 44px; border: 1px solid #304039; display: grid; place-items: center; color: var(--green); margin-bottom: 16px; }
.new-card button b { color: #c6d0ca; margin-bottom: 7px; }
.builder-shell.shared { margin-left: 0; }
.nav-logo.inline { position: static; width: 36px; height: 36px; border: 1px solid var(--line); }
.share-info { margin: 12px 18px; padding: 18px; border: 1px solid var(--line); background: var(--panel-2); }
.share-info b { font-size: 13px; }.share-info p { color: var(--muted); font-size: 11px; line-height: 1.5; }.share-info small { color: #5e6a64; font-size: 9px; }
.source-value { display: grid; grid-template-columns: 116px 1fr; }
.source-value select { border-right: 0; }
.hidden { display: none !important; }
.top-status .error { color: var(--danger); }
.toast.error { border-color: #743939; background: #291515; color: #ffc0c0; }
.step-card[draggable="true"] { cursor: default; }

@media (max-width: 760px) {
  .login-brand footer { display: none; }
  .nav-rail nav { display: flex; margin: 0; }
  .nav-rail nav a, .nav-rail nav span { width: 40px; height: 40px; }
  .builder-shell.shared { margin-bottom: 0; height: 100vh; }
  .readonly-layout { grid-template-rows: 104px minmax(0,1fr); }
}

/* Larger, high-contrast navigation symbols */
.nav-logo { font-size: 20px; }
.nav-rail nav { gap: 10px; }
.nav-rail nav a,
.nav-rail nav span,
.nav-bottom a {
  width: 48px;
  height: 48px;
  color: #a4b5ab;
  font: 600 21px/1 Arial, sans-serif;
}
.nav-rail nav a:hover,
.nav-rail nav a.active,
.nav-rail nav span.active {
  color: var(--green);
  background: #18231e;
}
.nav-bottom a { font-size: 22px; }

@media (max-width: 760px) {
  .nav-rail nav a, .nav-rail nav span { width: 44px; height: 44px; font-size: 20px; }
}

/* Comfortable typography at 100% browser zoom */
body { font-size: 16px; }
.eyebrow { font-size: 13px; }
.primary-button.tiny, .ghost-button { font-size: 14px; }

/* Builder */
.builder-title { font-size: 15px; color: #aebbb4; }
.builder-title input { font-size: 17px; }
.top-status, .top-status b { font-size: 14px; color: #c4cfc9; }
.canvas-toolbar b { font-size: 15px; }
.canvas-toolbar small, .canvas-toolbar button { font-size: 13px; color: #b0bdb6; }
.step-header small { font-size: 11px; color: #afbbb4; }
.step-header h3 { font-size: 16px; }
.step-summary { font-size: 14px; color: #c6d0ca; }
.step-number { font-size: 13px; color: #a8b5ae; }
.fields-grid label { font-size: 12px; line-height: 1.35; color: #c3cec8; }
.fields-grid input, .fields-grid select, .source-control select { font-size: 15px; }
.drop-zone span { font-size: 12px; }
.flow-end b { font-size: 14px; }
.flow-end small { font-size: 12px; color: #a9b6af; }
.empty-canvas h2 { font-size: 21px; }
.empty-canvas p { font-size: 15px; color: #aab7b0; }
.readonly-badge { font-size: 13px; }

/* Dashboard */
.dashboard-header p { font-size: 16px; color: #aab7b0; }
.stats-row span { font-size: 12px; color: #9eaaa3; }
.section-heading h2 { font-size: 21px; }
.section-heading span { font-size: 14px; color: #aab7b0; }
.algorithm-card h3 { font-size: 21px; }
.algorithm-card > p { font-size: 15px; color: #aab7b0; }
.mini-flow small { font-size: 13px; color: #9eaaa3; }
.card-meta { font-size: 13px; color: #a6b3ac; }
.card-actions > a { font-size: 15px; }
.new-card b { font-size: 17px; }
.new-card small { font-size: 14px; color: #9eaaa3; }
.flash { font-size: 14px; }

/* Login, shared page and dialogs */
.login-card label { font-size: 14px; }
.login-card input { font-size: 16px; }
.form-error, .demo-note b { font-size: 14px; }
.demo-note small { font-size: 13px; }
.share-info b { font-size: 16px; }
.share-info p { font-size: 14px; color: #aab7b0; }
.share-info small { font-size: 12px; color: #9eaaa3; }
.json-modal header span { font-size: 11px; }
.json-modal h2 { font-size: 21px; }
.json-modal pre { font-size: 14px; line-height: 1.65; }
.json-modal footer > span { font-size: 13px; color: #aab7b0; }
.toast { min-width: 280px; font-size: 15px; }
