:root {
    color-scheme: dark;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #080a0f;
    color: #f5f7fb;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 10%, rgba(92, 75, 255, .22), transparent 34rem),
        radial-gradient(circle at 85% 85%, rgba(0, 214, 170, .12), transparent 32rem),
        #080a0f;
}

a { color: inherit; }

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(1120px, calc(100% - 40px));
    margin: 0 auto;
    padding: 28px 0;
}

.brand {
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .16em;
    text-decoration: none;
}

.page-shell {
    display: grid;
    min-height: calc(100vh - 100px);
    place-items: center;
    padding: 40px 20px 100px;
}

.hero { max-width: 860px; text-align: center; }

.eyebrow {
    color: #8f83ff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

h1 {
    margin: 14px 0 18px;
    font-size: clamp(38px, 7vw, 76px);
    line-height: 1.02;
    letter-spacing: -.055em;
}

.hero-copy {
    max-width: 650px;
    margin: 0 auto;
    color: #aeb5c5;
    font-size: clamp(17px, 2vw, 21px);
    line-height: 1.55;
}

.actions { display: flex; justify-content: center; gap: 12px; margin-top: 36px; }

.button {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    padding: 0 22px;
    border: 1px solid transparent;
    border-radius: 12px;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.primary { background: #6f5cff; color: #fff; }
.primary:hover { background: #806fff; }
.secondary { border-color: #343947; background: rgba(255,255,255,.03); }
.full { width: 100%; }

.auth-card, .dashboard-card {
    width: min(100%, 460px);
    padding: 36px;
    border: 1px solid #272b35;
    border-radius: 20px;
    background: rgba(15, 18, 26, .88);
    box-shadow: 0 28px 80px rgba(0,0,0,.35);
}

.auth-card h1, .dashboard-card h1 { font-size: 40px; letter-spacing: -.04em; }
.auth-form p { display: grid; gap: 8px; margin: 18px 0; }
.auth-form label { color: #c9ced9; font-size: 14px; font-weight: 600; }
.auth-form input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid #343947;
    border-radius: 10px;
    outline: none;
    background: #0c0f16;
    color: #fff;
    font: inherit;
}
.auth-form input:focus { border-color: #6f5cff; box-shadow: 0 0 0 3px rgba(111,92,255,.15); }
.auth-form .helptext, .auth-form ul { color: #81899a; font-size: 12px; line-height: 1.5; }
.auth-form .errorlist { color: #ff8f9d; }
.auth-switch { margin: 22px 0 0; color: #9299a9; text-align: center; }
.auth-switch a { color: #b2a9ff; }
.link-button { border: 0; background: transparent; color: #b7bdca; cursor: pointer; font: inherit; }
.header-account { display: flex; align-items: center; gap: 16px; }
.header-username {
    max-width: 240px;
    overflow: hidden;
    color: #e4e7ed;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workspace-page {
    overflow: hidden;
    background: #080a0f;
}

.workspace-page .site-header {
    width: min(1440px, calc(100% - 40px));
    padding: 20px 0;
}

.workspace-page .page-shell {
    min-height: calc(100vh - 76px);
    padding: 0 20px 20px;
}

.workspace-shell {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    width: min(1440px, 100%);
    height: calc(100vh - 96px);
    min-height: 620px;
    overflow: hidden;
    border: 1px solid #252a35;
    border-radius: 22px;
    background: #0d1017;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .4);
}

.agents-sidebar {
    display: flex;
    min-width: 0;
    flex-direction: column;
    border-right: 1px solid #252a35;
    background: #0a0d13;
}

.agents-sidebar-header { padding: 24px 20px 18px; }
.sidebar-kicker {
    margin: 0 0 6px;
    color: #777f91;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.agents-sidebar h1 {
    margin: 0 0 22px;
    font-size: 28px;
    letter-spacing: -.035em;
}

.create-agent-button {
    display: flex;
    width: 100%;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border: 0;
    border-radius: 12px;
    background: #6f5cff;
    color: #fff;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}

.create-agent-button:hover { background: #806fff; }
.create-agent-button span { font-size: 22px; font-weight: 400; line-height: 1; }

.agents-list {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    overflow-y: auto;
    padding: 10px 14px 18px;
}

.agents-empty {
    margin: auto 10px;
    padding: 24px 16px;
    color: #c6cbd6;
    text-align: center;
}

.agents-empty-icon {
    display: grid;
    width: 44px;
    height: 44px;
    margin: 0 auto 14px;
    place-items: center;
    border: 1px solid #303645;
    border-radius: 13px;
    background: #131722;
    color: #9388ff;
    font-size: 12px;
    font-weight: 900;
}

.agents-empty p,
.workspace-empty p {
    margin: 8px 0 0;
    color: #7f8798;
    font-size: 14px;
    line-height: 1.5;
}

.agent-list-item {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 11px;
    width: 100%;
    align-items: center;
    padding: 11px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: #edf0f6;
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.agent-list-item:hover { border-color: #2d3340; background: #121620; }
.agent-list-item.is-active { border-color: #4f45a8; background: #19172b; }
.agent-list-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 11px;
    background: #24203f;
    color: #aaa1ff;
    font-size: 10px;
    font-weight: 900;
}
.agent-list-item strong,
.agent-list-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-list-item strong { font-size: 13px; }
.agent-list-item small { margin-top: 3px; color: #747d8e; font-size: 11px; }

.agent-workspace { display: flex; min-width: 0; flex-direction: column; }
.workspace-header {
    display: flex;
    min-height: 84px;
    align-items: center;
    justify-content: space-between;
    padding: 18px 26px;
    border-bottom: 1px solid #252a35;
}

.workspace-header h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.workspace-user {
    padding: 8px 12px;
    border: 1px solid #2b303c;
    border-radius: 999px;
    color: #abb2c0;
    font-size: 13px;
}

.agent-connection-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #c7954f;
    font-size: 12px;
    font-weight: 700;
}

.agent-connection-status::before {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #d7a252;
    content: "";
    box-shadow: 0 0 0 4px rgba(215, 162, 82, .1);
}

.workspace-header-actions { display: flex; align-items: center; gap: 16px; }
.add-skill-button {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid #494282;
    border-radius: 10px;
    background: #1c1930;
    color: #bdb6ff;
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
}
.add-skill-button:hover { border-color: #6f5cff; background: #24203f; }

.chat-shell { display: flex; min-height: 0; flex: 1; flex-direction: column; }
.chat-messages {
    display: flex;
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding: 28px;
}

.chat-welcome {
    display: grid;
    max-width: 480px;
    margin: auto;
    justify-items: center;
    text-align: center;
}

.chat-welcome .workspace-empty-mark { margin-bottom: 18px; }
.chat-welcome h3 { margin: 0; font-size: 22px; }
.chat-welcome p { margin: 9px 0 0; color: #7f8798; font-size: 14px; line-height: 1.5; }

.chat-composer {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
    margin: 0 24px 24px;
    padding: 10px;
    border: 1px solid #2d3340;
    border-radius: 16px;
    background: #0a0d13;
}

.chat-composer textarea {
    min-height: 42px;
    max-height: 150px;
    resize: none;
    padding: 11px 4px;
    border: 0;
    outline: none;
    background: transparent;
    color: #e9ecf3;
    font: inherit;
}

.chat-composer textarea::placeholder { color: #626b7b; }
.chat-attach,
.chat-send {
    min-height: 42px;
    border: 0;
    border-radius: 11px;
    font: inherit;
}
.chat-attach { width: 42px; background: #171b25; color: #7d8596; font-size: 21px; }
.chat-send { padding: 0 17px; background: #292536; color: #716b7e; font-size: 13px; font-weight: 750; }
.chat-attach:disabled,
.chat-send:disabled,
.chat-composer textarea:disabled { cursor: not-allowed; }

.workspace-empty {
    display: grid;
    max-width: 440px;
    margin: auto;
    justify-items: center;
    padding: 30px;
    text-align: center;
}

.workspace-empty-mark {
    display: grid;
    width: 64px;
    height: 64px;
    margin-bottom: 22px;
    place-items: center;
    border: 1px solid #343a49;
    border-radius: 20px;
    background: linear-gradient(145deg, #1c2030, #10131c);
    color: #9d94ff;
    font-size: 25px;
    font-weight: 900;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .28);
}

.workspace-empty h3 { margin: 0; font-size: 22px; letter-spacing: -.025em; }

.agent-dialog {
    width: min(720px, calc(100% - 28px));
    padding: 0;
    border: 1px solid #303644;
    border-radius: 22px;
    background: #10131b;
    color: #f5f7fb;
    box-shadow: 0 32px 100px rgba(0, 0, 0, .65);
}

.skills-dialog {
    width: min(900px, calc(100% - 28px));
    max-height: min(820px, calc(100vh - 28px));
    padding: 0;
    border: 1px solid #303644;
    border-radius: 22px;
    background: #10131b;
    color: #f5f7fb;
    box-shadow: 0 32px 100px rgba(0, 0, 0, .65);
}
.skills-dialog::backdrop { background: rgba(4, 6, 10, .78); backdrop-filter: blur(8px); }
.skills-dialog-panel { padding: 26px; }
.skills-dialog-panel > .agent-dialog-header { margin-bottom: 24px; }
.skill-platform-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 18px;
    padding: 5px;
    border: 1px solid #292f3c;
    border-radius: 13px;
    background: #0a0d13;
}
.skill-platform-tab {
    min-height: 42px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #858d9e;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}
.skill-platform-tab.is-active { background: #24203f; color: #c6c0ff; }
.skills-panel { max-height: 560px; overflow-y: auto; padding-right: 4px; }
.skills-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.skill-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    min-height: 92px;
    padding: 14px;
    border: 1px solid #2d3340;
    border-radius: 13px;
    background: #11151e;
}
.skill-card > span {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 12px;
    background: #24203f;
    color: #aaa1ff;
    font-size: 10px;
    font-weight: 900;
}
.skill-card h3 { margin: 0 0 5px; font-size: 14px; }
.skill-card p { margin: 0; color: #7e8798; font-size: 11px; line-height: 1.4; }
.skill-card button {
    min-height: 30px;
    padding: 0 9px;
    border: 1px solid #343a49;
    border-radius: 8px;
    background: #171b25;
    color: #747d8e;
    font-size: 10px;
    font-weight: 800;
}

.agent-dialog::backdrop { background: rgba(4, 6, 10, .78); backdrop-filter: blur(8px); }
.agent-dialog-panel { padding: 26px; }
.agent-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.agent-dialog-header h2 { margin: 0; font-size: 28px; letter-spacing: -.035em; }
.dialog-close {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid #303644;
    border-radius: 10px;
    background: #171b25;
    color: #aeb5c5;
    font-size: 24px;
    cursor: pointer;
}

.agent-type-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin: 26px 0 18px;
    padding: 5px;
    border: 1px solid #292f3c;
    border-radius: 13px;
    background: #0a0d13;
}

.agent-type-tab {
    min-height: 42px;
    padding: 8px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #858d9e;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.agent-type-tab.is-active { background: #24203f; color: #c6c0ff; }
.agent-type-content {
    min-height: 180px;
    padding: 28px;
    border: 1px solid #292f3c;
    border-radius: 16px;
    background: linear-gradient(145deg, #151925, #0e1118);
}

.agent-type-content h3 { margin: 14px 0 8px; font-size: 23px; }
.agent-type-content p { max-width: 560px; margin: 0; color: #929aaa; line-height: 1.6; }
.agent-type-badge {
    display: inline-flex;
    padding: 6px 9px;
    border-radius: 999px;
    background: rgba(111, 92, 255, .14);
    color: #aaa1ff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.agent-option-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    min-height: 124px;
    padding: 20px;
    border: 1px solid #343a49;
    border-radius: 15px;
    background: #111620;
}

.agent-option-card-featured { box-shadow: inset 0 0 0 1px rgba(111, 92, 255, .08); }
.agent-option-icon {
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 15px;
    background: #24203f;
    color: #aaa1ff;
    font-size: 13px;
    font-weight: 900;
}

.agent-option-copy h3 { margin: 9px 0 4px; font-size: 20px; }
.agent-option-copy p { font-size: 13px; line-height: 1.45; }
.agent-option-price { color: #fff; font-size: 20px; white-space: nowrap; }
.agent-option-action { display: grid; gap: 10px; justify-items: end; }
.agent-select-button { min-height: 40px; padding: 0 18px; }
.agent-config-form { margin-top: 20px; }
.agent-config-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.agent-config-grid label { display: grid; gap: 6px; }
.agent-config-grid label > span { color: #858e9f; font-size: 11px; font-weight: 700; }
.agent-config-grid select {
    width: 100%;
    height: 40px;
    padding: 0 10px;
    border: 1px solid #343b49;
    border-radius: 9px;
    outline: none;
    background: #0a0d13;
    color: #e9ecf3;
    font: inherit;
    font-size: 13px;
}
.agent-config-grid select:focus { border-color: #6f5cff; }
.agent-config-period { grid-column: 1 / -1; }

.role-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.role-card {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 2px 10px;
    min-height: 72px;
    align-items: center;
    padding: 12px;
    border: 1px solid #2d3340;
    border-radius: 12px;
    background: #11151e;
    color: #f2f4f8;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.role-card:not(:disabled):hover { border-color: #6255ce; background: #171629; }
.role-card:disabled { cursor: not-allowed; opacity: .76; }
.role-card span {
    grid-row: 1 / 4;
    color: #7469df;
    font-size: 11px;
    font-weight: 900;
}
.role-card strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.role-card small { overflow: hidden; color: #7e8798; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.role-card em {
    width: fit-content;
    margin-top: 4px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(255, 180, 70, .1);
    color: #d9a85c;
    font-size: 9px;
    font-style: normal;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.agent-dialog-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

@media (max-width: 560px) {
    .actions { flex-direction: column; }
    .auth-card, .dashboard-card { padding: 26px 22px; }
}

@media (max-width: 760px) {
    .workspace-page { overflow: auto; }
    .workspace-page .site-header { width: calc(100% - 28px); }
    .workspace-page .page-shell { display: block; padding: 0 14px 14px; }
    .workspace-shell {
        grid-template-columns: 1fr;
        height: auto;
        min-height: calc(100vh - 90px);
    }
    .agents-sidebar { min-height: 310px; border-right: 0; border-bottom: 1px solid #252a35; }
    .agent-workspace { min-height: 420px; }
    .workspace-header { padding: 18px 20px; }
    .workspace-header-actions { align-items: flex-end; flex-direction: column-reverse; gap: 8px; }
    .agent-connection-status { font-size: 10px; }
    .chat-composer { grid-template-columns: auto minmax(0, 1fr); margin: 0 14px 14px; }
    .chat-send { grid-column: 2; }
    .agent-dialog-panel { padding: 20px; }
    .skills-dialog-panel { padding: 20px; }
    .skills-grid { grid-template-columns: 1fr; }
    .skill-card { grid-template-columns: 38px minmax(0, 1fr); }
    .skill-card button { grid-column: 2; width: fit-content; }
    .agent-type-tabs { grid-template-columns: 1fr; }
    .agent-type-content { min-height: 200px; padding: 22px; }
    .agent-option-card { grid-template-columns: auto 1fr; }
    .agent-option-action { grid-column: 2; justify-items: start; }
    .agent-config-grid { grid-template-columns: 1fr; }
    .agent-config-period { grid-column: auto; }
    .role-grid { grid-template-columns: 1fr; }
}
