:root {
    color-scheme: dark;
    --bg: #0e1728;
    --deep: #0a1322;
    --panel: #142137;
    --field: #101c30;
    --border: #2a3c55;
    --text: #f3f7ff;
    --muted: #aebdd0;
    --mint: #57eed2;
    --mint-dark: #08251d;
    --red: #ffabae;
    --gold: #f5cb89;
    --radius: 16px;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.55; }
a { color: var(--mint); text-underline-offset: .22em; }
a:hover { color: #a9ffed; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.1; text-wrap: balance; }
h1 { font-size: clamp(2.15rem, 3.8vw, 3.4rem); letter-spacing: -.05em; }
h2 { font-size: clamp(1.3rem, 2.4vw, 1.85rem); letter-spacing: -.035em; }
h3 { font-size: 1.18rem; letter-spacing: -.02em; }
p + p { margin-top: .8rem; }
[id] { scroll-margin-block: 1rem; }
.muted, .helptext { color: var(--muted); }
.skip-link {
    position: fixed; z-index: 20; top: .7rem; left: .7rem; transform: translateY(-180%);
    background: var(--mint); color: var(--mint-dark); padding: .6rem 1rem; border-radius: 6px;
}
.skip-link:focus { transform: translateY(0); }
.eyebrow {
    margin-bottom: .65rem; color: var(--mint); font-weight: 650;
    font-size: .79rem; letter-spacing: .12em; text-transform: uppercase;
}

.site-container { width: min(1190px, calc(100% - 64px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--border); background: rgba(10, 19, 34, .6); }
.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; }
.brand {
    display: inline-flex; gap: .7rem; align-items: center; color: var(--text); text-decoration: none;
    font-size: 1.1rem; font-weight: 750; letter-spacing: -.04em; line-height: 1.12;
}
.brand-secondary { font-weight: 500; color: var(--muted); }
.brand-mark {
    flex: none; width: 31px; height: 31px; position: relative; border: 1px solid #498475; border-radius: 10px;
    background: radial-gradient(circle at 54% 36%, var(--mint) 0 3px, transparent 4px), #163c37;
}
.brand-mark::after {
    content: ""; position: absolute; inset: 9px 7px; border: 1px solid var(--mint);
    border-radius: 50%; transform: rotate(-35deg);
}
.site-nav { display: flex; align-items: center; gap: clamp(1.1rem, 3vw, 2.4rem); }
.site-nav a, .site-footer a:not(.brand), .workspace-bar a { color: var(--muted); text-decoration: none; }
.site-nav a:hover, .site-footer a:hover, .workspace-bar a:hover { color: var(--mint); }
.buttons { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.button {
    display: inline-flex; justify-content: center; align-items: center; gap: .55rem;
    min-height: 46px; padding: .62rem 1rem; border: 1px solid transparent; border-radius: 9px;
    color: var(--text); font-weight: 650; text-decoration: none; line-height: 1.2;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.button--primary { background: var(--mint); color: var(--mint-dark); }
.button--primary:hover { background: #98ffe9; color: #071d17; }
.button--outline { background: #152238; border-color: #3a526e; color: var(--text); }
.button--outline:hover { background: #1d3149; border-color: #5da998; color: var(--text); }
.button--small { min-height: 44px; padding-inline: .85rem; font-size: .9rem; }
.site-page { background: radial-gradient(ellipse at 86% 16%, #10283a 0, transparent 36%), var(--bg); }

.hero {
    min-height: min(620px, calc(100vh - 74px));
    padding-block: clamp(3rem, 8vw, 6.4rem);
    display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
    align-items: center; gap: clamp(2rem, 6vw, 5rem);
}
.hero-label {
    color: var(--mint); font-weight: 650; font-size: .78rem;
    letter-spacing: .13em; text-transform: uppercase; margin-bottom: 1.4rem;
}
.hero h1 {
    max-width: 700px; font-size: clamp(2.9rem, 5.55vw, 5.8rem);
    line-height: .98; letter-spacing: -.07em; text-wrap: initial;
}
.hero h1 span { display: block; color: var(--mint); margin-top: .13em; }
.hero-intro { max-width: 46ch; margin-top: 1.55rem; color: var(--muted); font-size: clamp(1.08rem, 1.6vw, 1.35rem); }
.hero .buttons { margin-top: 1.75rem; }
.orbit {
    width: min(100%, 450px); aspect-ratio: 1.04; justify-self: center; position: relative; isolation: isolate;
    background: radial-gradient(circle at center, rgba(55, 173, 155, .12), transparent 58%);
}
.orbit-ring { border: 1px solid #34516a; border-radius: 50%; position: absolute; aspect-ratio: 1; }
.orbit-ring--outer { width: 82%; inset: 7% 9% auto; }
.orbit-ring--inner { width: 59%; inset: 19% 20.5% auto; border-style: dashed; opacity: .7; }
.orbit-core {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    display: grid; justify-items: center; align-content: center; gap: .45rem;
    aspect-ratio: 1; width: 35%; border: 1px solid var(--mint); border-radius: 50%;
    background: #173341; box-shadow: 0 0 36px #45d9be22, inset 0 0 30px #182c40;
}
.orbit-core span {
    border-radius: 50%; background: var(--mint); color: var(--mint-dark); font-size: clamp(1rem, 2.5vw, 1.65rem);
    line-height: 1; font-weight: 850; padding: .45em;
}
.orbit-core strong { font-size: clamp(.74rem, 1.5vw, 1.01rem); }
.orbit-node {
    position: absolute; border: 1px solid #406076; background: #16263c; padding: .35rem .7rem;
    border-radius: 7px; line-height: 1.2; color: #e7f2fd; font-size: .85rem; font-weight: 640;
}
.orbit-node--crm { top: 3%; left: 50%; transform: translateX(-50%); }
.orbit-node--data { top: 32%; left: 1%; }
.orbit-node--telegram { top: 32%; right: 0; }
.orbit-node--tasks { bottom: 13%; left: 10%; }
.orbit-node--reports { bottom: 13%; right: 9%; }
.orbit-star {
    width: 7px; aspect-ratio: 1; position: absolute; border-radius: 50%;
    background: var(--mint); box-shadow: 0 0 14px #57eed27b;
}
.orbit-star--one { left: 35%; top: 19%; }
.orbit-star--two { right: 24%; top: 26%; }
.orbit-star--three { left: 51%; bottom: 16%; }

.site-band { padding-block: 3.3rem; border-top: 1px solid var(--border); }
.section-heading p { margin-top: .55rem; color: var(--muted); }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1.6rem; }
.feature { background: var(--panel); border: 1px solid var(--border); padding: 1.45rem; border-radius: var(--radius); }
.feature-symbol {
    display: grid; place-items: center; width: 39px; height: 39px; border-radius: 9px;
    border: 1px solid #2e655e; background: #143937; margin-bottom: 1rem; color: var(--mint); font-size: 1.28rem;
}
.feature p { color: var(--muted); margin-top: .62rem; }
.start-panel {
    display: grid; grid-template-columns: minmax(0, 1.3fr) auto; align-items: center;
    gap: 1.4rem; border-radius: var(--radius); padding: clamp(1.25rem, 4vw, 2.4rem);
    background: linear-gradient(110deg, #16363b, var(--panel) 70%); border: 1px solid #346364;
}
.start-panel p { margin-top: .65rem; color: var(--muted); max-width: 54ch; }
.site-footer { border-top: 1px solid var(--border); }

.auth-page { min-height: 100vh; background: radial-gradient(ellipse at 53% 0%, #142f42, transparent 54%), var(--bg); }
.auth-container { width: min(100% - 2rem, 840px); margin: clamp(2rem, 6vw, 5rem) auto; }
.panel {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: clamp(1rem, 2.5vw, 1.5rem); min-width: 0;
}
.auth-panel { width: min(100%, 490px); margin: auto; padding: clamp(1.25rem, 4vw, 2.5rem); }
.auth-panel--wide { width: min(100%, 800px); margin-inline: auto; }
.auth-panel h1 { margin-bottom: .75rem; }
.auth-panel .form-stack, .auth-panel > .button { margin-top: 1.35rem; }
.auth-note { margin-top: 1.5rem; border-top: 1px solid var(--border); padding-top: 1rem; color: var(--muted); }
.field-groups { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.45rem; }
.field-groups fieldset { min-width: 0; margin: 0; padding: 0; border: 0; display: grid; align-content: start; gap: .9rem; }
.field-groups legend { font-weight: 650; margin-bottom: .65rem; }
.form-stack { display: grid; gap: .95rem; align-items: start; }
.form-stack > .button { justify-self: start; }
.form-stack label, .member-form label, .invite-copy label { display: block; color: var(--text); font-weight: 600; margin-bottom: .32rem; }
.form-stack :is(input, select, textarea):not([type=hidden], [type=checkbox]),
.member-form select, .invite-copy input {
    width: 100%; color: var(--text); background: var(--field);
    padding: .64rem .71rem; border: 1px solid #435b78; border-radius: 8px; min-height: 44px;
}
input[type=color] { display: block; cursor: pointer; max-width: 85px; }
input[type=checkbox] { width: 1rem; height: 1rem; accent-color: var(--mint); vertical-align: text-bottom; }
textarea { resize: vertical; }
::placeholder { color: #a0afc3; }
.helptext { margin-top: .4rem; font-size: .88rem; }
.helptext ul { margin: .35rem 0 0; padding-inline-start: 1.12rem; }
.errorlist { color: var(--red); margin: 0 0 .45rem; padding-inline-start: 1.2rem; }
[aria-invalid=true] { border-color: #ef8791 !important; }
.feedback { display: grid; gap: .55rem; margin-bottom: 1rem; }
.notice {
    margin: 0; padding: .75rem 1rem; border-radius: 8px; color: var(--text);
    background: #183044; border: 1px solid #395c77;
}
.notice--success { border-color: #3e8b72; background: #14362e; color: #bdffeb; }
.notice--error { border-color: #a3525b; background: #391e2c; color: #ffd2d3; }

.workspace-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.workspace-side {
    display: flex; flex-direction: column; min-width: 0; min-height: 100vh;
    padding: 1.35rem 1rem; background: var(--deep); border-right: 1px solid var(--border);
}
.workspace-side > .brand { margin: .12rem .45rem 1.7rem; }
.workspace-side .brand-secondary { display: block; }
.org-context {
    display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .65rem;
    border-block: 1px solid var(--border); padding: .82rem .45rem; overflow-wrap: anywhere;
}
.org-context small { display: block; color: var(--muted); }
.org-mark {
    display: grid; place-items: center; width: 38px; height: 38px; background: #182b3d;
    color: var(--text); border: 1px solid var(--org-accent, var(--mint)); border-radius: 8px; font-weight: 750;
}
.org-mark img { width: 100%; height: 100%; object-fit: cover; border-radius: 7px; }
.workspace-nav { display: grid; margin-block: 1.15rem; }
.workspace-nav a, .org-switch {
    display: flex; align-items: center; min-height: 44px; padding: .45rem .68rem;
    border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .92rem;
}
.workspace-nav a:hover, .workspace-nav a[aria-current], .org-switch:hover { background: #16263a; color: var(--text); }
.workspace-nav a[aria-current] { border-left: 2px solid var(--org-accent, var(--mint)); font-weight: 650; }
.org-switch { margin-top: auto; justify-content: space-between; }
.workspace-bar {
    min-height: 65px; padding: .65rem clamp(1rem, 3vw, 2.5rem); display: flex;
    gap: .65rem; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border);
}
.workspace-bar > span { min-width: 0; overflow-wrap: anywhere; color: var(--muted); }
.workspace-main { width: min(100%, 1260px); margin-inline: auto; padding: clamp(1rem, 3.2vw, 2.65rem); }
.workspace-main > .panel + .panel, .workspace-main > .card-grid + .panel { margin-top: 1rem; }
.page-heading { margin-bottom: 1.45rem; }
.page-heading .muted, .page-heading > .status { margin-top: .55rem; }
.page-heading h1 { overflow-wrap: anywhere; }
.heading-pair { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.org-choice {
    margin-top: .7rem; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
    gap: .82rem; text-decoration: none; color: var(--text);
}
.org-choice:hover { border-color: #61ae9e; color: var(--text); }
.choice-arrow { color: var(--mint); }
.org-picker-logout { margin-top: 1.05rem; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.metric span { display: block; color: var(--muted); font-size: .9rem; }
.metric strong { display: block; margin-top: .4rem; font-size: 2.2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.card-grid--sales > section:last-child { order: -1; }
.dashboard-composer { margin-bottom: 1rem; }
.panel h2 + .form-stack, .panel h2 + .record-list, .panel h2 + p { margin-top: .9rem; }
.section-top { display: flex; gap: .75rem; justify-content: space-between; align-items: center; }
.record-list { list-style: none; margin: .7rem 0 0; padding: 0; }
.record-list > li {
    display: flex; align-items: center; justify-content: space-between; gap: .85rem;
    padding: .8rem 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere;
}
.record-list > li:last-child { border-bottom: 0; padding-bottom: 0; }
.record-list :is(small, time) { display: block; color: var(--muted); }
.record-list strong { font-weight: 640; }
.status {
    display: inline-flex; align-items: center; flex: none; border: 1px solid #3b5069;
    border-radius: 999px; padding: .13rem .54rem; color: #d6e5f7; background: #1e324b; font-size: .81rem;
}
.status--connected, .status--succeeded { color: #aaffe6; border-color: #367462; background: #14372f; }
.status--approval, .status--uncertain { color: var(--gold); border-color: #695b46; background: #352e27; }
.status--failed, .status--error { color: #ffd0d0; border-color: #84505a; background: #3a2634; }
.form-panel { max-width: 650px; }
.form-panel > p + a, .form-panel > p + form { margin-top: 1rem; }
.connection-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.connection-card { display: flex; flex-direction: column; align-items: flex-start; gap: .72rem; }
.connection-card p { margin-top: 0; }
.connection-card .button { margin-top: auto; }
.connection-tip, .panel > .buttons, .invite-copy { margin-top: 1rem; }
.back-link { display: inline-block; margin-bottom: .6rem; }
.member-item { width: 100%; }
.member-item summary, .inline-field { min-height: 44px; cursor: pointer; align-content: center; }
.member-form { display: grid; grid-template-columns: 1fr; gap: .5rem; max-width: 330px; }
.member-form .button, .invite-copy .button { justify-self: start; }
.invite-copy { padding-top: .9rem; border-top: 1px solid var(--border); }
.invite-copy .button { margin-top: .6rem; }

.tabs { display: flex; gap: .35rem; margin-top: .8rem; flex-wrap: wrap; }
.tabs a {
    display: grid; place-items: center; color: var(--muted); padding: .45rem .85rem;
    min-height: 44px; border: 1px solid transparent; border-radius: 8px; text-decoration: none;
}
.tabs a[aria-current], .tabs a:hover { background: var(--panel); color: var(--text); border-color: var(--border); }
.chat-panel { margin-bottom: 1rem; }
.chat-feed { display: flex; flex-direction: column; gap: .9rem; }
.chat-entry {
    max-width: min(100%, 710px); padding: .8rem 1rem; border: 1px solid var(--border);
    border-radius: 12px; background: var(--field); width: fit-content; overflow-wrap: anywhere;
}
.chat-entry--user { align-self: flex-end; background: #183632; border-color: #3a6962; }
.chat-meta { display: flex; justify-content: space-between; flex-wrap: wrap; column-gap: 1.1rem; font-size: .85rem; color: var(--muted); }
.chat-meta strong { color: var(--text); }
.chat-body { white-space: pre-wrap; margin: .4rem 0; }
.chat-empty { padding-block: 1.15rem; }
.chat-empty p { margin-top: .45rem; }
.task-preview { margin-top: .6rem; padding-top: .65rem; border-top: 1px solid #4a6965; }
.task-preview > :is(p, .buttons) { margin-top: .55rem; }
.execution-link { display: block; margin-top: .45rem; }
.agent-tabs { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; }
.agent-tabs [aria-current] { border-color: var(--org-accent, var(--mint)); color: var(--org-accent, var(--mint)); }
.skill-workspace { margin-bottom: 1rem; }
.automation-form { max-width: 760px; margin-bottom: 1rem; }
.automation-form:last-child { margin-bottom: 0; }
.automation-control { margin-top: 1rem; }
.automation-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.skill-test-result, .skill-code { max-height: 20rem; overflow: auto; }
.skill-code { white-space: pre-wrap; overflow-wrap: anywhere; border-radius: 8px; padding: 1rem; background: var(--field); }
.review-questions { padding-inline-start: 1.3rem; }
.progress-note { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; margin-bottom: 1rem; color: var(--muted); }
.status--reviewed, .status--ready { color: #aaffe6; border-color: #367462; background: #14372f; }
.status--clarify, .status--blocked { color: var(--gold); border-color: #695b46; background: #352e27; }
.form-stack fieldset { padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 8px; min-width: 0; }
.form-stack :is(fieldset, div):has(input[type=checkbox]) label { font-weight: 500; }

@media (max-width: 980px) {
    .workspace-shell { grid-template-columns: 195px minmax(0, 1fr); }
    .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .connection-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .start-panel { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .site-container { width: calc(100% - 2rem); }
    .site-nav { display: none; }
    .hero { grid-template-columns: 1fr; gap: 1.5rem; padding-block: 3rem 2rem; }
    .orbit { width: min(100%, 355px); }
    .feature-grid, .field-groups, .card-grid, .connection-grid { grid-template-columns: 1fr; }
    .workspace-shell { grid-template-columns: 1fr; }
    .workspace-side { min-height: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: .75rem 1rem; }
    .workspace-side > .brand { margin: .1rem 0 .6rem; }
    .workspace-side .brand-secondary { display: inline; }
    .org-context { padding-inline: 0; }
    .workspace-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-block: .35rem; }
    .workspace-nav a, .org-switch { padding-inline: .45rem; }
    .org-switch { width: fit-content; gap: .55rem; }
}
@media (max-width: 380px) {
    .hero h1 { font-size: 2.55rem; }
    .hero .buttons > a { width: 100%; }
    .orbit-node { padding: .26rem .45rem; font-size: .77rem; }
    .record-list > li { align-items: flex-start; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; }
}
