/* MASTER AI — system wizualny. Czerń / antracyt / grafit + zieleń technologiczna i elektryczny błękit. */
@font-face { font-family: 'Google Sans'; src: url('/fonts/GoogleSans-VF.woff2') format('woff2'); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Google Sans'; src: url('/fonts/GoogleSans-Italic-VF.woff2') format('woff2'); font-weight: 400 700; font-style: italic; font-display: swap; }

:root {
  --bg-0: #040607; --bg-1: #090d0f; --bg-2: #0f1518; --bg-3: #151d21; --line: #1c2a2f; --line-2: #2a3d44;
  --text: #e8f3f0; --muted: #8fa7a0; --dim: #5d736c;
  --green: #1fe08f; --emerald: #0fb37a; --blue: #2aa8ff; --electric: #35c8ff; --warn: #ffb547; --danger: #ff5d6c; --violet: #7c9cff;
  --font: 'Google Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r: 10px; --r-lg: 14px; --rail: 236px; --topbar: 58px; --space: var(--green);
  --glass: linear-gradient(180deg, rgba(18, 26, 30, .86), rgba(8, 12, 14, .9));
  --edge: linear-gradient(135deg, rgba(31, 224, 143, .6), rgba(42, 168, 255, .1) 28%, rgba(28, 42, 47, .9) 55%, rgba(42, 168, 255, .55));
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .015) inset;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg-0); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45; font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased; overflow: hidden; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
a { color: var(--electric); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(31, 224, 143, .35); }
:focus-visible { outline: 2px solid var(--electric); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
svg.ic { width: 18px; height: 18px; flex: none; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .ok { color: var(--green); } .warn { color: var(--warn); } .bad { color: var(--danger); }
.small { font-size: 13px; } .tiny { font-size: 11.5px; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .row.top { align-items: flex-start; } .row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: #1d2b30; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #2c4249; } * { scrollbar-width: thin; scrollbar-color: #22343a transparent; }

/* ---------- tło: głębia, poświata, siatka ---------- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: radial-gradient(1200px 700px at 12% -10%, rgba(31, 224, 143, .09), transparent 60%), radial-gradient(1100px 800px at 105% 110%, rgba(42, 168, 255, .1), transparent 60%), var(--bg-0); }
.aurora { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: .16; will-change: transform; }
.aurora.a1 { background: radial-gradient(circle, var(--green), transparent 62%); left: -18vmax; top: -24vmax; animation: drift1 38s ease-in-out infinite alternate; }
.aurora.a2 { background: radial-gradient(circle, var(--blue), transparent 62%); right: -22vmax; bottom: -26vmax; animation: drift2 46s ease-in-out infinite alternate; }
.gridlines { position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px); background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 78%); -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 78%); }
@keyframes drift1 { to { transform: translate3d(14vmax, 9vmax, 0) scale(1.15); } }
@keyframes drift2 { to { transform: translate3d(-12vmax, -8vmax, 0) scale(1.1); } }
html[data-quality="low"] .aurora, html[data-motion="off"] .aurora { animation: none; }
html[data-quality="low"] .aurora { display: none; }

/* ---------- start ---------- */
.boot { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; align-content: center; gap: 18px; background: var(--bg-0); color: var(--muted); letter-spacing: .32em; font-size: 12px; }
.boot-ring { width: 64px; height: 64px; border-radius: 50%; border: 2px solid rgba(31, 224, 143, .15); border-top-color: var(--green); border-right-color: var(--blue); animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- układ ---------- */
.app { position: relative; z-index: 1; height: 100%; display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); grid-template-rows: var(--topbar) minmax(0, 1fr); }
.app.rail-min { --rail: 66px; }
.rail { grid-row: 1 / 3; display: flex; flex-direction: column; min-height: 0; background: linear-gradient(180deg, rgba(10, 15, 17, .94), rgba(5, 8, 9, .96)); border-right: 1px solid var(--line); }
.brand { height: var(--topbar); display: flex; align-items: center; gap: 11px; padding: 0 16px; border-bottom: 1px solid var(--line); flex: none; cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand b { font-size: 15px; letter-spacing: .2em; font-weight: 700; background: linear-gradient(90deg, #eafff6, var(--green) 55%, var(--electric)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand small { display: block; font-size: 10px; letter-spacing: .28em; color: var(--dim); margin-top: -2px; }
.nav { flex: 1; overflow-y: auto; padding: 10px 8px 16px; }
.nav h6 { margin: 14px 10px 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); }
.nav a { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--muted); font-size: 14px; text-decoration: none; transition: color .15s, background .15s; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, .035); }
.nav a.on { color: #fff; background: linear-gradient(90deg, rgba(31, 224, 143, .16), rgba(42, 168, 255, .05)); }
.nav a.on::before { content: ''; position: absolute; left: -8px; top: 7px; bottom: 7px; width: 3px; border-radius: 3px; background: linear-gradient(var(--green), var(--blue)); box-shadow: 0 0 12px var(--green); }
.nav a .cnt { margin-left: auto; min-width: 20px; padding: 0 6px; height: 18px; border-radius: 9px; background: rgba(255, 181, 71, .16); color: var(--warn); font-size: 11px; display: grid; place-items: center; font-weight: 600; }
.nav a .off { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: #3a4a47; }
.app.rail-min .nav h6, .app.rail-min .nav a span, .app.rail-min .brand div, .app.rail-min .nav a .cnt, .app.rail-min .nav a .off { display: none; }
.app.rail-min .nav a { justify-content: center; padding: 10px 0; }

.top { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(12, 18, 20, .9), rgba(8, 12, 14, .82)); backdrop-filter: blur(10px); min-width: 0; }
.spacesw { position: relative; }
.spacesw > button { display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 12px 0 10px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .03); cursor: pointer; max-width: 240px; }
.spacesw i.dot, .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--space); box-shadow: 0 0 10px var(--space); flex: none; display: inline-block; }
.menu { position: absolute; top: 42px; left: 0; z-index: 30; min-width: 250px; padding: 6px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(10, 15, 17, .97); box-shadow: var(--shadow); }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; }
.menu button:hover { background: rgba(255, 255, 255, .05); }
.search { flex: 1; max-width: 560px; position: relative; }
.search input { width: 100%; height: 36px; padding: 0 12px 0 36px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .35); outline: none; }
.search input:focus { border-color: rgba(53, 200, 255, .6); box-shadow: 0 0 0 3px rgba(53, 200, 255, .12); }
.search svg { position: absolute; left: 11px; top: 9px; width: 18px; height: 18px; color: var(--dim); }
.top .iconbtn { position: relative; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border-radius: 14px; border: 1px solid var(--line-2); font-size: 12px; color: var(--muted); background: rgba(255, 255, 255, .02); white-space: nowrap; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.pill.on i { background: var(--green); box-shadow: 0 0 8px var(--green); } .pill.warn i { background: var(--warn); } .pill.bad i { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

.view { overflow-y: auto; padding: 22px 24px 120px; min-width: 0; outline: none; }
.view.flush { padding: 0; overflow: hidden; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.eyebrow { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--green); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.eyebrow::before { content: ''; width: 18px; height: 1px; background: linear-gradient(90deg, var(--green), transparent); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; }

/* ---------- panel HUD ---------- */
.panel { position: relative; border: 1px solid transparent; border-radius: var(--r-lg); background: var(--glass) padding-box, var(--edge) border-box; box-shadow: var(--shadow); padding: 16px; min-width: 0;
  --mx: 50%; --my: 0%; }
.panel::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(53, 200, 255, .07), transparent 60%); }
.panel:hover::after { opacity: 1; }
html[data-quality="low"] .panel::after { display: none; }
.panel > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -2px 0 12px; }
.panel > header h3 { font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.panel > header h3::before { content: ''; width: 6px; height: 6px; border-radius: 2px; background: var(--green); box-shadow: 0 0 8px var(--green); transform: rotate(45deg); }
.panel.blue > header h3::before { background: var(--blue); box-shadow: 0 0 8px var(--blue); }
.panel.warnp > header h3::before { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.panel.tight { padding: 12px; }
.empty { color: var(--dim); font-size: 13.5px; padding: 6px 0; }
.stat { font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.stat small { font-size: 13px; color: var(--muted); font-weight: 400; margin-left: 6px; letter-spacing: 0; }

/* ---------- kontrolki ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); cursor: pointer; white-space: nowrap;
  background: linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .015)); color: var(--text); font-weight: 500; font-size: 14px; overflow: hidden; transition: border-color .15s, transform .06s, box-shadow .15s; }
.btn:hover { border-color: rgba(53, 200, 255, .55); box-shadow: 0 0 0 3px rgba(53, 200, 255, .08); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { color: #03130c; font-weight: 600; border-color: rgba(31, 224, 143, .8); background: linear-gradient(180deg, #5dffb8, var(--green) 45%, var(--emerald)); box-shadow: 0 6px 22px -8px rgba(31, 224, 143, .7), inset 0 1px 0 rgba(255, 255, 255, .55); }
.btn.primary:hover { box-shadow: 0 8px 28px -8px rgba(31, 224, 143, .9), inset 0 1px 0 rgba(255, 255, 255, .6); border-color: #9bffd4; }
.btn.blue { color: #021018; font-weight: 600; border-color: rgba(53, 200, 255, .8); background: linear-gradient(180deg, #8fe2ff, var(--electric) 45%, #1687d6); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55); }
.btn.danger { border-color: rgba(255, 93, 108, .5); color: #ffb3bb; } .btn.danger:hover { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(255, 93, 108, .12); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); } .btn.ghost:hover { color: var(--text); background: rgba(255, 255, 255, .05); box-shadow: none; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.big { height: 50px; padding: 0 26px; font-size: 15px; letter-spacing: .08em; border-radius: 13px; }
.iconbtn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--muted); }
.iconbtn:hover { color: var(--text); background: rgba(255, 255, 255, .05); } .iconbtn svg { width: 19px; height: 19px; }
.iconbtn .badge { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--warn); color: #1a1000; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; }
.input, select.input, textarea.input { width: 100%; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, .4); outline: none; }
textarea.input { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: rgba(31, 224, 143, .65); box-shadow: 0 0 0 3px rgba(31, 224, 143, .12); }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
label.f b { color: var(--text); font-weight: 500; }
label.chk { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--muted); cursor: pointer; }
label.chk input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--green); flex: none; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, .35); gap: 2px; }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; font-size: 13px; }
.seg button.on { color: #03130c; font-weight: 600; background: linear-gradient(180deg, #5dffb8, var(--green)); }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 500; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.tag.fakt, .tag.g { color: #8ff5c6; border-color: rgba(31, 224, 143, .4); background: rgba(31, 224, 143, .08); }
.tag.hipoteza, .tag.pomysl, .tag.v { color: #c9b5ff; border-color: rgba(124, 156, 255, .4); background: rgba(124, 156, 255, .08); }
.tag.pamiec, .tag.zrodlo, .tag.ustalenie, .tag.b { color: #9fdcff; border-color: rgba(42, 168, 255, .4); background: rgba(42, 168, 255, .08); }
.tag.niepewne, .tag.w { color: #ffd596; border-color: rgba(255, 181, 71, .45); background: rgba(255, 181, 71, .08); }
.tag.r { color: #ffb3bb; border-color: rgba(255, 93, 108, .45); background: rgba(255, 93, 108, .08); }
.bar { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--green), var(--electric)); }
.bar.hot i { background: linear-gradient(90deg, var(--warn), var(--danger)); }

.list { display: flex; flex-direction: column; }
.item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 2px; border-top: 1px solid rgba(255, 255, 255, .05); min-width: 0; }
.item:first-child { border-top: 0; }
.item.click { cursor: pointer; border-radius: 8px; padding: 10px 8px; margin: 0 -6px; } .item.click:hover { background: rgba(255, 255, 255, .04); }
.item .t { font-weight: 500; } .item .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg-1); }
.tbl td { padding: 9px 10px; border-bottom: 1px solid rgba(255, 255, 255, .045); vertical-align: top; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: rgba(255, 255, 255, .035); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13.5px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { height: 38px; padding: 0 14px; border: 0; background: none; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--green); }
.notice { display: flex; gap: 10px; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(42, 168, 255, .06); font-size: 13.5px; color: #cfe9f7; }
.notice.w { background: rgba(255, 181, 71, .07); border-color: rgba(255, 181, 71, .35); color: #ffe2b5; }
.notice.r { background: rgba(255, 93, 108, .08); border-color: rgba(255, 93, 108, .4); color: #ffd0d5; }
.notice.g { background: rgba(31, 224, 143, .07); border-color: rgba(31, 224, 143, .35); color: #c8f9e2; }
.demo-flag { font-size: 10.5px; letter-spacing: .18em; color: var(--warn); border: 1px dashed rgba(255, 181, 71, .5); padding: 2px 7px; border-radius: 5px; }

/* ---------- ekran główny ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px) minmax(0, 1fr); gap: 14px; align-items: stretch; margin-bottom: 14px; }
.hero-core { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px 0 2px; min-height: 380px; }
.hero-core canvas { width: 320px; height: 320px; max-width: 100%; cursor: pointer; }
.core-state { font-size: 11.5px; letter-spacing: .3em; text-transform: uppercase; color: var(--green); font-weight: 600; min-height: 18px; }
.core-detail { font-size: 13px; color: var(--muted); min-height: 19px; text-align: center; }
.cmd { display: flex; gap: 8px; align-items: center; padding: 6px; border-radius: 16px; border: 1px solid transparent; background: linear-gradient(rgba(6, 10, 11, .92), rgba(6, 10, 11, .92)) padding-box, linear-gradient(90deg, var(--green), var(--electric)) border-box; box-shadow: 0 0 34px -14px rgba(31, 224, 143, .7); }
.cmd input { flex: 1; min-width: 0; height: 44px; border: 0; background: none; outline: none; padding: 0 12px; font-size: 15.5px; }
.cmd input::placeholder { color: var(--dim); }
.mic { width: 44px; height: 44px; border-radius: 13px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .04); display: grid; place-items: center; cursor: pointer; color: var(--text); flex: none; transition: box-shadow .2s, border-color .2s; }
.mic svg { width: 20px; height: 20px; }
.mic.live { border-color: var(--green); color: var(--green); box-shadow: 0 0 0 4px rgba(31, 224, 143, .15), 0 0 26px -4px var(--green); }
.mic.speaking { border-color: var(--electric); color: var(--electric); }

/* ---------- dok Servitora (zawsze dostępny) ---------- */
.dock { position: fixed; right: 18px; bottom: 18px; z-index: 20; width: 400px; max-width: calc(100vw - 24px); border-radius: 18px; border: 1px solid transparent;
  background: linear-gradient(180deg, rgba(14, 21, 24, .96), rgba(6, 10, 11, .97)) padding-box, var(--edge) border-box; box-shadow: 0 24px 60px -18px #000; backdrop-filter: blur(14px); }
.dock.min { width: auto; border-radius: 30px; }
.dock-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 8px; cursor: pointer; }
.dock-head canvas { width: 46px; height: 46px; flex: none; }
.dock-head .n { font-weight: 600; letter-spacing: .14em; font-size: 12.5px; }
.dock-head .st { font-size: 11.5px; color: var(--muted); }
.dock-head > svg.ic { color: var(--muted); transition: transform .2s; margin-right: 4px; }
.dock.min .dock-head > svg.ic { display: none; }
.dock:not(.min) .dock-head > svg.ic { transform: rotate(180deg); }
.dock.min .dock-head { padding: 6px; }
.dock.min .dock-body { display: none; } .dock.min .dock-head .grow { display: none; }
.dock-body { padding: 0 10px 10px; }
.dock-log { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px 10px; }
.msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: linear-gradient(180deg, rgba(31, 224, 143, .2), rgba(31, 224, 143, .1)); border: 1px solid rgba(31, 224, 143, .3); }
.msg.assistant { align-self: flex-start; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.msg.error { align-self: flex-start; background: rgba(255, 93, 108, .09); border: 1px solid rgba(255, 93, 108, .35); color: #ffd0d5; }
.msg .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.msg .src { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line-2); font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.msg .src button { all: unset; cursor: pointer; color: var(--electric); } .msg .src button:hover { text-decoration: underline; }

/* ---------- czat pełny ---------- */
.chat { display: grid; grid-template-rows: minmax(0, 1fr) auto; height: calc(100vh - var(--topbar) - 44px); max-width: 980px; margin: 0 auto; }
.chat-log { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 6px 4px 18px; }
.chat .msg { font-size: 14.5px; max-width: 84%; }

/* ---------- hierarchia agentów ---------- */
.org { display: flex; flex-direction: column; align-items: center; gap: 26px; padding: 10px 0 20px; overflow-x: auto; }
.org-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; position: relative; }
.agent { width: 208px; text-align: left; padding: 12px; border-radius: 13px; border: 1px solid transparent; cursor: pointer; background: var(--glass) padding-box, linear-gradient(160deg, rgba(42, 168, 255, .5), rgba(28, 42, 47, .8) 50%, rgba(31, 224, 143, .35)) border-box; color: var(--text); position: relative; }
.agent:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -14px rgba(42, 168, 255, .6); }
.agent .glyph { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, .25), transparent 60%), linear-gradient(135deg, var(--emerald), #0b5fa8); color: #eafff6; flex: none; }
.agent.t0 .glyph { background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, .35), transparent 60%), linear-gradient(135deg, var(--green), var(--electric)); color: #03130c; }
.agent .st { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.agent .st i { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.agent .st.pracuje i { background: var(--green); box-shadow: 0 0 9px var(--green); animation: blink 1.1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }
html[data-motion="off"] .agent .st.pracuje i { animation: none; }

/* ---------- nakładki: kreator, logowanie, modale, szuflady ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 18px; overflow-y: auto; background: rgba(2, 4, 5, .72); backdrop-filter: blur(8px); }
.overlay.solid { background: transparent; backdrop-filter: none; }
.dialog { width: min(560px, 100%); border-radius: 18px; border: 1px solid transparent; background: linear-gradient(180deg, rgba(16, 24, 27, .97), rgba(6, 10, 11, .98)) padding-box, var(--edge) border-box; box-shadow: 0 40px 90px -30px #000; padding: 22px; }
.dialog.wide { width: min(860px, 100%); } .dialog.xl { width: min(1080px, 100%); }
.dialog > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.dialog > footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 35; width: min(560px, 100vw); overflow-y: auto; padding: 20px; border-left: 1px solid var(--line-2); background: linear-gradient(180deg, rgba(13, 19, 22, .98), rgba(6, 9, 10, .99)); box-shadow: -30px 0 70px -30px #000; animation: slidein .22s ease-out; }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }
html[data-motion="off"] .drawer { animation: none; }
.wizard { width: min(980px, 100%); display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 26px; align-items: center; }
.wizard-core { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.wizard-core canvas { width: 280px; height: 280px; }
.wizard h1 { font-size: 30px; line-height: 1.15; }
.wizard h1 em { font-style: normal; background: linear-gradient(90deg, var(--green), var(--electric)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.steps { display: flex; flex-direction: column; gap: 4px; }
.step { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(255, 255, 255, .05); font-size: 13.5px; }
.step:first-child { border-top: 0; }
.step i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); margin-top: 1px; display: grid; place-items: center; font-style: normal; font-size: 11px; }
.step.ok i { border-color: var(--green); background: var(--green); color: #03130c; } .step.ok i::before { content: '✓'; font-weight: 700; }
.step.run i { border-color: rgba(53, 200, 255, .3); border-top-color: var(--electric); animation: spin .9s linear infinite; }
.step.err i { border-color: var(--danger); color: var(--danger); } .step.err i::before { content: '!'; font-weight: 700; }
.step.skip i { border-style: dashed; } .step.skip i::before { content: '–'; color: var(--dim); }
.step small { display: block; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }

.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(12, 18, 20, .97); box-shadow: var(--shadow); font-size: 13.5px; max-width: min(560px, 92vw); animation: rise .2s ease-out; }
.toast.ok { border-color: rgba(31, 224, 143, .5); } .toast.err { border-color: rgba(255, 93, 108, .6); color: #ffd0d5; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.bars i { flex: 1; min-width: 3px; border-radius: 3px 3px 0 0; background: linear-gradient(var(--electric), rgba(31, 224, 143, .5)); min-height: 2px; }
.decision { border-left: 3px solid var(--warn); }
.decision.done { border-left-color: var(--line-2); opacity: .8; }
.skillbody { font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; color: #cfe0db; max-height: 46vh; overflow-y: auto; padding: 12px; border-radius: 10px; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); }
.chunk { padding: 10px 0; border-top: 1px solid rgba(255, 255, 255, .05); font-size: 13.5px; }
.chunk .h { font-size: 11.5px; color: var(--dim); margin-bottom: 4px; }
.chunk.retracted { opacity: .45; text-decoration: line-through; }
.drop { border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.drop.over, .drop:hover { border-color: var(--green); background: rgba(31, 224, 143, .05); color: var(--text); }
.lockbox { max-width: 460px; margin: 8vh auto 0; text-align: center; }
.lockbox .big-ico { width: 74px; height: 74px; margin: 0 auto 14px; border-radius: 22px; display: grid; place-items: center; background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, .18), transparent 60%), linear-gradient(135deg, #223a66, #101a2e); border: 1px solid rgba(124, 156, 255, .5); color: var(--violet); }
.lockbox .big-ico svg { width: 34px; height: 34px; }

/* ---------- responsywność ---------- */
@media (max-width: 1180px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .span3 { grid-column: span 2; }
  .hero { grid-template-columns: minmax(0, 1fr); } .hero-core { order: -1; min-height: 0; } }
@media (max-width: 820px) {
  body { font-size: 14.5px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; z-index: 45; left: 0; top: 0; bottom: 0; width: 264px; transform: translateX(-100%); transition: transform .2s ease-out; }
  .app.rail-open .rail { transform: none; box-shadow: 30px 0 80px #000; }
  .view { padding: 16px 14px 150px; } .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } .span2, .span3 { grid-column: auto; }
  .top { padding: 0 10px; gap: 8px; } .top .hide-m { display: none; } .spacesw > button { max-width: 150px; }
  .dock { right: 8px; left: 8px; bottom: 8px; width: auto; } .dock.min { left: auto; }
  .wizard { grid-template-columns: minmax(0, 1fr); } .wizard-core canvas { width: 170px; height: 170px; } .wizard h1 { font-size: 24px; }
  .hero-core canvas { width: 240px; height: 240px; }
  .chat { height: calc(100vh - var(--topbar) - 120px); }
}
@media (min-width: 821px) { .only-m { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .aurora, .boot-ring, .step.run i { animation-duration: 0s !important; animation: none !important; } }
