:root {
    --bg: #081121;
    --panel: rgba(11, 23, 42, 0.82);
    --panel-strong: rgba(15, 28, 51, 0.96);
    --line: rgba(130, 164, 255, 0.18);
    --text: #edf4ff;
    --muted: #9cb0d1;
    --primary: #5aa9ff;
    --primary-strong: #3b82f6;
    --accent: #67f0ff;
    --success: #2fc794;
    --danger: #ff6b81;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
    --radius: 28px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(91, 143, 249, 0.28), transparent 30%),
        radial-gradient(circle at top right, rgba(85, 236, 255, 0.18), transparent 28%),
        linear-gradient(180deg, #09111f 0%, #0d1730 45%, #111a2f 100%);
    color: var(--text);
    font-family: "IBM Plex Sans SC", "Noto Sans SC", "PingFang SC", sans-serif;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(94, 128, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(94, 128, 255, 0.04) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(180deg, rgba(255,255,255,0.45), transparent 85%);
}

a {
    color: inherit;
}

button, input, textarea, select {
    font: inherit;
}

.portal-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
}

.portal-hero {
    padding: 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.portal-mark {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border: 1px solid rgba(104, 158, 255, 0.25);
    border-radius: 999px;
    background: rgba(10, 20, 38, 0.56);
    color: var(--muted);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 12px;
}

.portal-mark strong {
    color: var(--text);
    letter-spacing: 0.04em;
}

.portal-headline {
    max-width: 760px;
}

.portal-headline h1 {
    margin: 18px 0 16px;
    font-size: 72px;
    line-height: 0.98;
    letter-spacing: -0.04em;
}

.portal-headline p {
    margin: 0;
    color: var(--muted);
    font-size: 23px;
    line-height: 1.6;
}

.portal-boards {
    margin-top: 48px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.portal-card {
    padding: 22px 24px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(15, 27, 49, 0.88), rgba(12, 23, 42, 0.78));
    border: 1px solid rgba(122, 170, 255, 0.18);
    box-shadow: var(--shadow);
}

.portal-card h3 {
    margin: 0 0 10px;
    font-size: 18px;
}

.portal-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.portal-login {
    margin: 24px;
    padding: 42px;
    border-radius: 36px;
    background: linear-gradient(180deg, rgba(236, 243, 255, 0.95), rgba(222, 232, 247, 0.92));
    color: #1f2a43;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.portal-login .eyebrow {
    color: #6698ff;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 13px;
    margin-bottom: 12px;
}

.portal-login h2 {
    margin: 0 0 14px;
    font-size: 50px;
    line-height: 1.02;
}

.portal-login p {
    color: #64748b;
    font-size: 18px;
    line-height: 1.7;
}

.login-form {
    margin-top: 28px;
    display: grid;
    gap: 18px;
}

.field {
    display: grid;
    gap: 10px;
}

.field label {
    font-size: 16px;
    color: #64748b;
}

.field input, .field textarea, .field select {
    width: 100%;
    border: 1px solid rgba(102, 137, 199, 0.28);
    border-radius: 22px;
    padding: 18px 20px;
    background: rgba(255,255,255,0.8);
    outline: none;
}

.field textarea {
    min-height: 120px;
    resize: vertical;
}

.field-hint {
    color: #98a2b3;
    font-size: 12px;
    line-height: 1.6;
}

.primary-btn, .secondary-btn, .ghost-btn, .danger-btn {
    border: 0;
    cursor: pointer;
    border-radius: 20px;
    padding: 14px 20px;
    transition: transform .18s ease, opacity .18s ease, background .18s ease;
}

.primary-btn:hover, .secondary-btn:hover, .ghost-btn:hover, .danger-btn:hover {
    transform: translateY(-1px);
}

.primary-btn {
    background: linear-gradient(135deg, #2f6df8, #4aa5ff);
    color: white;
    font-weight: 700;
}

.secondary-btn {
    background: rgba(90, 122, 176, 0.12);
    color: #244072;
    border: 1px solid rgba(103, 132, 187, 0.25);
}

.ghost-btn {
    background: rgba(87, 132, 230, 0.12);
    color: var(--text);
    border: 1px solid rgba(114, 164, 255, 0.18);
}

.danger-btn {
    background: rgba(255, 107, 129, 0.14);
    color: #ffb3c0;
    border: 1px solid rgba(255, 107, 129, 0.28);
}

.portal-meta {
    margin-top: 18px;
    color: #ef4444;
    font-size: 15px;
}

.chat-workbench-shell {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 22px;
    min-height: calc(100vh - 180px);
    align-items: start;
}

.chat-workbench-sidebar,
.chat-workbench-stage {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.chat-selector-card,
.chat-session-card,
.chat-stage-head,
.chat-message-board,
.chat-composer {
    border-radius: 28px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(248, 247, 244, 0.95));
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.06);
}

.chat-selector-card,
.chat-session-card,
.chat-stage-head,
.chat-composer {
    padding: 22px 24px;
}

.chat-selector-card h3,
.chat-stage-head h2,
.chat-empty-state h3 {
    margin: 8px 0 10px;
    color: #101828;
}

.chat-selector-card p,
.chat-stage-head p,
.chat-empty-state p {
    margin: 0;
    color: #667085;
    line-height: 1.7;
}

.chat-selector-actions,
.chat-stage-meta,
.chat-composer-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}

.chat-session-list {
    display: grid;
    gap: 12px;
    max-height: calc(100vh - 430px);
    overflow: auto;
}

.chat-session-item {
    width: 100%;
    text-align: left;
    padding: 16px 18px;
    border-radius: 20px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: #101828;
    display: grid;
    gap: 8px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.chat-session-item.active {
    border-color: rgba(91, 140, 255, 0.34);
    background: linear-gradient(135deg, rgba(235, 243, 255, 0.98), rgba(244, 248, 255, 0.96));
    box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.08), 0 16px 34px rgba(15, 23, 42, 0.06);
}

.chat-session-item strong,
.chat-session-item span,
.chat-session-item small {
    display: block;
}

.chat-session-item span,
.chat-session-item small {
    color: #667085;
}

.chat-message-board {
    flex: 1;
    padding: 24px;
    overflow: auto;
    display: grid;
    gap: 16px;
    min-height: 520px;
    background:
        radial-gradient(circle at top right, rgba(121, 172, 255, 0.14), transparent 30%),
        radial-gradient(circle at bottom left, rgba(255, 113, 145, 0.08), transparent 25%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 247, 243, 0.96));
}

.chat-bubble {
    max-width: min(82%, 880px);
    padding: 18px 20px;
    border-radius: 24px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: rgba(255, 255, 255, 0.96);
    display: grid;
    gap: 10px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.05);
}

.chat-bubble.user {
    justify-self: end;
    border-color: rgba(91, 140, 255, 0.16);
    background: linear-gradient(135deg, #eef4ff 0%, #f7fbff 100%);
}

.chat-bubble.assistant {
    justify-self: start;
    background: linear-gradient(180deg, #ffffff 0%, #fbf8f4 100%);
}

.chat-bubble-role,
.chat-bubble-time {
    font-size: 12px;
    color: #667085;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.chat-bubble-content {
    line-height: 1.8;
    word-break: break-word;
    color: #101828;
}

.chat-feedback-panel {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 4px;
}

.chat-feedback-btn {
    appearance: none;
    border: 1px solid rgba(16, 24, 40, 0.1);
    background: rgba(255, 255, 255, 0.88);
    color: #475467;
    border-radius: 999px;
    min-height: 28px;
    padding: 5px 10px;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition: 0.2s ease;
}

.chat-feedback-btn:hover {
    border-color: rgba(91, 140, 255, 0.35);
    color: #2f5ac8;
    background: rgba(239, 245, 255, 0.95);
}

.chat-feedback-btn:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.chat-feedback-status {
    color: #667085;
    font-size: 12px;
}

.chat-message-attachments {
    display: grid;
    gap: 8px;
}

.chat-message-attachment-summary {
    color: #667085;
    font-size: 13px;
}

.chat-message-attachment-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(91, 140, 255, 0.08);
    border: 1px solid rgba(91, 140, 255, 0.14);
    color: #3b4a6b;
    font-size: 12px;
}

.chat-attachment-chip.muted {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.06);
    color: #667085;
}

.chat-empty-state {
    align-self: center;
    justify-self: center;
    max-width: 720px;
    text-align: center;
    display: grid;
    gap: 14px;
}

.chat-composer {
    display: grid;
    gap: 18px;
}

.chat-attachment-panel {
    display: grid;
    gap: 14px;
    padding: 18px;
    border-radius: 24px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: linear-gradient(180deg, rgba(250, 249, 246, 0.96), rgba(255, 255, 255, 0.94));
}

.chat-attachment-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.chat-attachment-toolbar > :first-child {
    min-width: 0;
    flex: 1;
}

.chat-attachment-title {
    font-weight: 700;
    color: #101828;
    margin-bottom: 6px;
}

.chat-attachment-toolbar p {
    margin: 0;
    color: #667085;
    line-height: 1.7;
}

.chat-upload-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    min-width: 156px;
    padding: 0 18px;
    white-space: nowrap;
    text-align: center;
    flex-shrink: 0;
    cursor: pointer;
}

.chat-upload-trigger.disabled {
    opacity: 0.56;
    pointer-events: none;
}

.chat-attachment-dropzone {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 18px;
    border-radius: 22px;
    border: 1px dashed rgba(103, 132, 187, 0.34);
    background:
        radial-gradient(circle at top right, rgba(127, 175, 255, 0.12), transparent 28%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 244, 238, 0.94));
    cursor: pointer;
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.chat-attachment-dropzone:hover {
    transform: translateY(-1px);
    border-color: rgba(91, 140, 255, 0.42);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.06);
}

.chat-attachment-dropzone.disabled {
    opacity: 0.72;
    pointer-events: none;
}

.chat-attachment-dropzone-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(47, 109, 248, 0.12), rgba(74, 165, 255, 0.22));
    color: #2f6df8;
    font-size: 26px;
    font-weight: 700;
}

.chat-attachment-dropzone-copy {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.chat-attachment-dropzone-copy strong {
    color: #101828;
    font-size: 16px;
}

.chat-attachment-dropzone-copy span {
    color: #667085;
    line-height: 1.7;
}

.chat-attachment-list {
    display: grid;
    gap: 12px;
}

.chat-attachment-list.gallery {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.chat-attachment-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: stretch;
    padding: 14px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(17, 17, 17, 0.06);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.chat-attachment-preview {
    position: relative;
    width: 100%;
    min-height: 188px;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(226, 232, 240, 0.9), rgba(248, 250, 252, 0.96));
}

.chat-attachment-preview img,
.chat-attachment-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chat-attachment-preview video {
    background: #0f172a;
}

.chat-attachment-badge {
    position: absolute;
    left: 8px;
    bottom: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.78);
    color: #ffffff;
    font-size: 11px;
    letter-spacing: 0.04em;
}

.chat-attachment-fallback {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: #475467;
    font-weight: 700;
}

.chat-attachment-meta {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.chat-attachment-meta strong,
.chat-attachment-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-attachment-meta small {
    color: #667085;
    line-height: 1.6;
}

.chat-attachment-meta span {
    color: #475467;
}

.chat-attachment-meta small,
.chat-attachment-empty {
    color: #667085;
}

.chat-attachment-empty {
    min-height: 132px;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 20px;
    border-radius: 20px;
    border: 1px dashed rgba(103, 132, 187, 0.28);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(247, 244, 238, 0.92));
    line-height: 1.8;
}

.chat-attachment-card .mini-btn {
    justify-self: end;
}

.chat-composer-toolbar {
    margin-top: 0;
}

.chat-composer-toolbar .field {
    min-width: 180px;
    flex: 1;
}

.chat-composer-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: end;
}

.chat-composer-input textarea {
    min-height: 132px;
    border-radius: 24px;
    border: 1px solid rgba(17, 17, 17, 0.08);
    background: rgba(255, 255, 255, 0.96);
    color: #101828;
    padding: 18px 20px;
    resize: vertical;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.chat-composer-input .primary-btn {
    min-width: 124px;
    min-height: 52px;
}

.chat-selector-card .field label,
.chat-composer .field label,
.chat-session-card h4 {
    color: #344054;
}

.chat-selector-card .field input,
.chat-selector-card .field select,
.chat-composer .field input,
.chat-composer .field select {
    border-color: rgba(17, 17, 17, 0.08);
    background: rgba(255, 255, 255, 0.96);
    color: #101828;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.chat-workbench-shell .eyebrow {
    color: #e6223a;
}

.chat-stage-meta .capsule,
.chat-empty-state .capsule,
.chat-session-card .capsule {
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: rgba(255, 255, 255, 0.92);
    color: #475467;
}

.mini-btn.active {
    background: linear-gradient(135deg, #eb5f6d, #f48a5c);
    color: #ffffff;
    border-color: transparent;
}

.mini-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.digital-pet-archive-card,
.digital-pet-stage-card {
    border-radius: 28px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 247, 241, 0.96));
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.06);
}

.digital-pet-archive-card {
    padding: 20px;
}

.digital-pet-archive-list {
    display: grid;
    gap: 12px;
}

.digital-pet-archive-item {
    text-align: left;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: rgba(255, 255, 255, 0.92);
    border-radius: 20px;
    padding: 14px 16px;
    display: grid;
    gap: 6px;
    cursor: pointer;
}

.digital-pet-archive-item.active {
    border-color: rgba(235, 95, 109, 0.3);
    background: linear-gradient(135deg, rgba(255, 244, 245, 0.98), rgba(255, 248, 242, 0.96));
    box-shadow: inset 0 0 0 1px rgba(235, 95, 109, 0.1);
}

.digital-pet-archive-item strong {
    color: #101828;
}

.digital-pet-archive-item span,
.digital-pet-archive-item small {
    color: #667085;
}

.digital-pet-stage-card {
    padding: 24px;
    display: grid;
    gap: 20px;
    margin-bottom: 18px;
}

.digital-pet-stage-empty {
    text-align: center;
    padding: 42px 24px;
}

.digital-pet-stage-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
    gap: 20px;
}

.digital-pet-stage-viewport {
    border-radius: 28px;
    overflow: hidden;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.92), transparent 40%),
        linear-gradient(180deg, #f8ede5 0%, #f5f1eb 40%, #efe7dd 100%);
    min-height: 420px;
    position: relative;
}

.digital-pet-stage-canvas {
    width: 100%;
    min-height: 420px;
    height: 100%;
    display: grid;
    place-items: center;
}

.digital-pet-stage-webgl {
    width: 100%;
    height: 100%;
    display: block;
}

.digital-pet-stage-fallback {
    color: #667085;
    text-align: center;
    padding: 24px;
    line-height: 1.8;
}

.digital-pet-model-stage,
.digital-pet-model-placeholder {
    width: 100%;
    min-height: 420px;
    height: 100%;
    position: relative;
}

.digital-pet-model-viewer {
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.82), transparent 42%),
        linear-gradient(180deg, rgba(252, 247, 240, 0.84), rgba(244, 238, 229, 0.95));
}

.digital-pet-preview-video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.82), transparent 42%),
        linear-gradient(180deg, rgba(252, 247, 240, 0.84), rgba(244, 238, 229, 0.95));
}

.digital-pet-model-hud {
    position: absolute;
    left: 18px;
    top: 18px;
    display: grid;
    gap: 8px;
    max-width: min(360px, calc(100% - 36px));
}

.digital-pet-model-subtitle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(17, 17, 17, 0.06);
    color: #475467;
    font-size: 12px;
}

.digital-pet-model-placeholder {
    display: grid;
    align-content: stretch;
}

.digital-pet-model-poster {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.digital-pet-model-poster.empty {
    display: grid;
    place-items: center;
    color: #98a2b3;
    background: rgba(255, 255, 255, 0.6);
}

.digital-pet-model-status {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 18px;
    display: grid;
    gap: 8px;
    padding: 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(17, 17, 17, 0.06);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.digital-pet-model-status strong {
    color: #101828;
    font-size: 18px;
}

.digital-pet-model-status p,
.digital-pet-stage-note {
    margin: 0;
    color: #667085;
    line-height: 1.7;
}

.digital-pet-model-badge,
.digital-pet-status-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: rgba(255, 255, 255, 0.9);
    color: #475467;
    font-size: 12px;
    font-weight: 600;
}

.digital-pet-model-badge.success,
.digital-pet-status-pill.success {
    background: rgba(47, 199, 148, 0.12);
    color: #13795b;
    border-color: rgba(47, 199, 148, 0.26);
}

.digital-pet-model-badge.warning,
.digital-pet-status-pill.warning {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.22);
}

.digital-pet-model-badge.danger,
.digital-pet-status-pill.danger {
    background: rgba(239, 68, 68, 0.12);
    color: #b42318;
    border-color: rgba(239, 68, 68, 0.22);
}

.digital-pet-model-badge.muted,
.digital-pet-status-pill.muted {
    background: rgba(148, 163, 184, 0.14);
    color: #475467;
    border-color: rgba(148, 163, 184, 0.22);
}

.digital-pet-stage-static {
    min-height: 420px;
    padding: 28px 24px 64px;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 18px;
}

.digital-pet-stage-static-art {
    width: 260px;
    height: 220px;
    position: relative;
}

.digital-pet-stage-static-shadow {
    position: absolute;
    left: 40px;
    right: 40px;
    bottom: 8px;
    height: 22px;
    border-radius: 999px;
    background: rgba(78, 60, 42, 0.12);
    filter: blur(6px);
}

.digital-pet-stage-static-body,
.digital-pet-stage-static-head,
.digital-pet-stage-static-tail,
.digital-pet-stage-static-head i {
    position: absolute;
    display: block;
}

.digital-pet-stage-static-body {
    width: 154px;
    height: 118px;
    left: 54px;
    top: 72px;
    border-radius: 52% 48% 46% 54%;
    background: var(--pet-primary, #8b6b4f);
    box-shadow: inset -12px -18px 0 rgba(255, 255, 255, 0.14);
}

.digital-pet-stage-static-tail {
    width: 72px;
    height: 20px;
    right: 24px;
    top: 98px;
    border-radius: 999px;
    background: var(--pet-primary, #8b6b4f);
    transform: rotate(28deg);
    transform-origin: left center;
}

.digital-pet-stage-static-head {
    width: 110px;
    height: 110px;
    left: 120px;
    top: 24px;
    border-radius: 48% 52% 50% 50%;
    background: var(--pet-primary, #8b6b4f);
    box-shadow: inset -10px -14px 0 rgba(255, 255, 255, 0.14);
}

.digital-pet-stage-static-head .left-ear,
.digital-pet-stage-static-head .right-ear {
    width: 28px;
    height: 44px;
    top: -20px;
    border-radius: 18px 18px 8px 8px;
    background: var(--pet-primary, #8b6b4f);
}

.digital-pet-stage-static-head .left-ear {
    left: 16px;
    transform: rotate(-22deg);
}

.digital-pet-stage-static-head .right-ear {
    right: 16px;
    transform: rotate(22deg);
}

.digital-pet-stage-static-head .left-eye,
.digital-pet-stage-static-head .right-eye {
    width: 12px;
    height: 12px;
    top: 42px;
    border-radius: 999px;
    background: var(--pet-eye, #6c4c2b);
}

.digital-pet-stage-static-head .left-eye {
    left: 28px;
}

.digital-pet-stage-static-head .right-eye {
    right: 28px;
}

.digital-pet-stage-static-head .nose {
    width: 16px;
    height: 12px;
    left: 47px;
    top: 58px;
    border-radius: 10px 10px 14px 14px;
    background: #6f4b40;
}

.digital-pet-stage-static-head .chest {
    width: 56px;
    height: 34px;
    left: 27px;
    bottom: -10px;
    border-radius: 999px;
    background: var(--pet-secondary, #efe2cf);
}

.digital-pet-stage-static-copy {
    display: grid;
    gap: 6px;
    text-align: center;
    color: #475467;
}

.digital-pet-stage-static-copy strong {
    color: #101828;
    font-size: 16px;
}

.digital-pet-stage-legend {
    position: absolute;
    left: 18px;
    bottom: 18px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.digital-pet-stage-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(17, 17, 17, 0.06);
    color: #475467;
    font-size: 12px;
}

.digital-pet-stage-legend i {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.digital-pet-stage-panel {
    display: grid;
    gap: 16px;
}

.digital-pet-pipeline-panel {
    border-radius: 22px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: rgba(255, 255, 255, 0.92);
    padding: 16px;
    display: grid;
    gap: 14px;
}

.digital-pet-pipeline-list {
    display: grid;
    gap: 10px;
}

.digital-pet-pipeline-item {
    display: grid;
    gap: 6px;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: rgba(249, 250, 251, 0.92);
}

.digital-pet-pipeline-item.success {
    background: rgba(236, 253, 243, 0.92);
    border-color: rgba(47, 199, 148, 0.2);
}

.digital-pet-pipeline-item.warning {
    background: rgba(255, 250, 235, 0.95);
    border-color: rgba(245, 158, 11, 0.18);
}

.digital-pet-pipeline-item.danger {
    background: rgba(254, 243, 242, 0.95);
    border-color: rgba(239, 68, 68, 0.18);
}

.digital-pet-pipeline-item.muted {
    background: rgba(248, 250, 252, 0.95);
    border-color: rgba(148, 163, 184, 0.18);
}

.digital-pet-pipeline-head {
    display: flex;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
}

.digital-pet-pipeline-head strong {
    color: #101828;
    font-size: 15px;
}

.digital-pet-pipeline-item p,
.digital-pet-pipeline-item span {
    margin: 0;
    color: #667085;
    line-height: 1.6;
    font-size: 13px;
}

.digital-pet-pipeline-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
}

.digital-pet-asset-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.digital-pet-asset-thumb {
    margin: 0;
    aspect-ratio: 1 / 1;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: rgba(249, 250, 251, 0.9);
}

.digital-pet-asset-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.digital-pet-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.digital-pet-stat,
.digital-pet-pipeline-panel,
.digital-pet-motion-panel,
.digital-pet-profile-panel {
    border-radius: 22px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: rgba(255, 255, 255, 0.92);
    padding: 16px;
}

.digital-pet-stat {
    display: grid;
    gap: 8px;
}

.digital-pet-stat label {
    color: #667085;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.digital-pet-stat strong {
    color: #101828;
    font-size: 18px;
}

.digital-pet-motion-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.digital-pet-profile-text {
    margin-top: 12px;
    color: #344054;
    line-height: 1.8;
    max-height: 220px;
    overflow: auto;
}

.digital-pet-factory-shell {
    display: grid;
    grid-template-columns: 380px minmax(0, 1fr);
    gap: 20px;
}

.digital-pet-factory-sidebar,
.digital-pet-factory-stage {
    display: grid;
    gap: 18px;
    align-content: start;
}

.digital-pet-generator-card,
.digital-pet-chat-card {
    border-radius: 28px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 247, 241, 0.96));
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.06);
    padding: 22px;
}

.digital-pet-generator-card h2,
.digital-pet-chat-card h3 {
    margin: 8px 0 10px;
}

.digital-pet-generator-card p,
.digital-pet-chat-card p {
    color: #667085;
    line-height: 1.8;
}

.digital-pet-generator-form {
    display: grid;
    gap: 16px;
    margin-top: 14px;
}

.chat-attachment-panel.compact {
    padding: 16px;
}

.chat-attachment-card.compact {
    border-radius: 18px;
}

.chat-attachment-card.compact .chat-attachment-preview {
    min-height: 148px;
    border-radius: 14px;
}

.chat-attachment-panel.compact .chat-attachment-dropzone {
    grid-template-columns: 1fr;
    text-align: left;
}

.chat-attachment-panel.compact .chat-upload-trigger {
    width: 100%;
}

.digital-pet-generate-btn {
    min-height: 52px;
}

.chat-message-board.compact {
    min-height: 320px;
    max-height: 480px;
    padding: 18px;
}

.chat-composer.compact {
    margin-top: 16px;
}

.chat-composer-input.single {
    grid-template-columns: minmax(0, 1fr) auto;
}

.chat-composer.compact textarea {
    min-height: 112px;
}

.digital-pet-stage-card .section-head {
    margin-bottom: 0;
}

.console-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    border-bottom: 1px solid rgba(116, 154, 237, 0.18);
    background: rgba(6, 13, 26, 0.82);
    backdrop-filter: blur(20px);
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #1b63ff, #67f0ff);
    color: white;
    font-weight: 800;
    letter-spacing: .08em;
}

.topbar-brand h1 {
    margin: 0;
    font-size: 30px;
}

.topbar-brand p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.top-nav {
    display: flex;
    gap: 12px;
}

.top-nav button {
    border: 1px solid rgba(112, 155, 255, 0.2);
    background: rgba(12, 22, 41, 0.76);
    color: var(--muted);
    border-radius: 999px;
    padding: 12px 18px;
    cursor: pointer;
}

.top-nav button.active {
    color: white;
    background: rgba(44, 108, 241, 0.34);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.console-main {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 0;
    flex: 1;
}

.sidebar {
    border-right: 1px solid rgba(112, 155, 255, 0.18);
    background: rgba(7, 15, 29, 0.76);
    padding: 22px;
}

.profile-card {
    padding: 18px;
    border-radius: 24px;
    border: 1px solid rgba(111, 157, 255, 0.16);
    background: linear-gradient(180deg, rgba(13, 24, 43, 0.92), rgba(10, 19, 35, 0.88));
    margin-bottom: 18px;
}

.profile-card strong {
    display: block;
    font-size: 26px;
}

.profile-card span {
    display: block;
    color: var(--muted);
    margin-top: 6px;
}

.sidebar-menu {
    display: grid;
    gap: 12px;
}

.sidebar-menu button {
    text-align: left;
    border: 1px solid rgba(116, 159, 255, 0.14);
    background: rgba(10, 18, 34, 0.76);
    color: var(--text);
    border-radius: 22px;
    padding: 18px 18px;
    cursor: pointer;
}

.sidebar-menu button.active {
    background: linear-gradient(135deg, rgba(43, 103, 227, 0.28), rgba(46, 152, 255, 0.18));
    border-color: rgba(110, 169, 255, 0.3);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.content {
    padding: 28px;
}

.hero-panel,
.table-card,
.metric-card,
.surface {
    border-radius: 28px;
    border: 1px solid rgba(113, 157, 255, 0.14);
    background: linear-gradient(180deg, rgba(15, 25, 46, 0.82), rgba(10, 20, 36, 0.82));
    box-shadow: var(--shadow);
}

.hero-panel {
    padding: 30px 32px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.hero-panel h2, .section-head h3 {
    margin: 8px 0 12px;
    font-size: 34px;
}

.hero-panel p, .section-head p, .muted {
    color: var(--muted);
    line-height: 1.7;
}

.eyebrow {
    font-size: 12px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: #7caeff;
}

.hero-stats, .stat-grid {
    display: grid;
    gap: 16px;
}

.hero-stats {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
    min-width: 360px;
}

.stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 18px;
}

.metric-card {
    padding: 22px;
}

.metric-card p {
    margin: 0 0 8px;
    color: var(--muted);
}

.metric-card strong {
    font-size: 34px;
    display: block;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.table-card {
    padding: 24px;
    margin-top: 18px;
}

.table-scroll {
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 14px 10px;
    border-bottom: 1px solid rgba(122, 155, 230, 0.12);
    vertical-align: top;
}

th {
    color: #b2c3df;
    font-weight: 600;
    font-size: 13px;
}

td small {
    color: var(--muted);
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    background: rgba(96, 129, 184, 0.15);
    color: #d5e3ff;
}

.tag.success {
    background: rgba(47, 199, 148, 0.15);
    color: #8ff0ca;
}

.tag.danger {
    background: rgba(255, 107, 129, 0.14);
    color: #ffb7c2;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.filters input, .filters select {
    min-width: 180px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(114, 156, 242, 0.18);
    background: rgba(10, 18, 33, 0.78);
    color: var(--text);
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.mini-btn {
    border: 1px solid rgba(114, 156, 242, 0.2);
    background: rgba(10, 18, 33, 0.76);
    color: var(--text);
    border-radius: 14px;
    padding: 9px 12px;
    cursor: pointer;
}

.mini-btn.danger {
    color: #ffb6c6;
    border-color: rgba(255, 107, 129, 0.2);
}

.empty-state {
    padding: 28px 16px;
    text-align: center;
    color: var(--muted);
}

.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(4, 10, 20, 0.68);
    backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 20;
}

.modal {
    width: min(960px, 100%);
    max-height: 90vh;
    overflow: auto;
    padding: 28px;
    border-radius: 30px;
    border: 1px solid rgba(116, 161, 255, 0.18);
    background: linear-gradient(180deg, rgba(13, 24, 44, 0.98), rgba(8, 18, 34, 0.96));
}

.modal h3 {
    margin-top: 0;
    font-size: 28px;
}

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

.modal-grid .field.full {
    grid-column: 1 / -1;
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.notice-bar {
    margin-bottom: 18px;
    padding: 14px 18px;
    border-radius: 18px;
    border: 1px solid rgba(112, 155, 255, 0.22);
    background: rgba(16, 28, 48, 0.72);
}

.notice-bar.success {
    border-color: rgba(47, 199, 148, 0.28);
    background: rgba(19, 52, 45, 0.72);
}

.capsule-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.capsule {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(84, 134, 255, 0.12);
    border: 1px solid rgba(112, 155, 255, 0.18);
    color: var(--muted);
    font-size: 13px;
}

.capsule.success {
    border-color: rgba(47, 199, 148, 0.28);
    color: #abefd7;
}

.capsule.warn {
    border-color: rgba(255, 190, 92, 0.28);
    color: #ffd58a;
}

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

.template-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ops-grid.single {
    grid-template-columns: 1fr;
}

.ops-card,
.agent-card,
.template-card,
.timeline-card,
.entity-card,
.design-panel {
    border-radius: 24px;
    border: 1px solid rgba(112, 155, 255, 0.14);
    background: rgba(9, 18, 34, 0.78);
    box-shadow: var(--shadow);
}

.ops-card,
.template-card,
.design-panel {
    padding: 22px;
}

.entity-stack,
.timeline-stack {
    display: grid;
    gap: 12px;
}

.entity-card,
.timeline-card {
    padding: 16px 18px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.entity-card p,
.timeline-card p,
.template-card p,
.agent-card p {
    margin: 6px 0 0;
    color: var(--muted);
    line-height: 1.7;
}

.agent-card {
    padding: 22px;
    display: grid;
    gap: 16px;
}

.agent-card-head,
.agent-row,
.section-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.agent-card-body,
.agent-card-meta {
    display: grid;
    gap: 10px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(122, 170, 255, 0.12);
    overflow: hidden;
}

.progress-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(135deg, #2f6df8, #67f0ff);
}

.modal-wide {
    width: min(1320px, 100%);
}

.modal-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.modal-error {
    margin-top: 16px;
    color: #ff9db0;
    min-height: 22px;
}

.field small {
    color: var(--muted);
    font-size: 12px;
}

.design-panel pre,
.timeline-card pre,
.ops-card pre {
    margin: 10px 0 0;
    padding: 14px;
    border-radius: 16px;
    background: rgba(6, 13, 24, 0.82);
    border: 1px solid rgba(112, 155, 255, 0.12);
    color: #dce8ff;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.stat-grid.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.json-preview, .workflow-preview {
    margin-top: 16px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(9, 16, 29, 0.72);
    border: 1px solid rgba(110, 157, 255, 0.12);
}

.workflow-nodes {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.workflow-node {
    min-width: 140px;
    padding: 14px 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(41, 105, 226, 0.16), rgba(103, 240, 255, 0.1));
    border: 1px solid rgba(109, 164, 255, 0.2);
}

.workflow-node small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
}

.workflow-workbench {
    margin-top: 22px;
    padding: 20px;
    border-radius: 24px;
    border: 1px solid rgba(112, 155, 255, 0.14);
    background: rgba(9, 18, 34, 0.68);
}

.workflow-workbench h4 {
    margin: 6px 0 0;
    font-size: 22px;
}

.workflow-workbench-shell {
    margin-top: 18px;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 360px;
    gap: 16px;
    align-items: start;
}

.workflow-palette,
.workflow-canvas,
.workflow-node-editor {
    min-height: 560px;
    border-radius: 24px;
    border: 1px solid rgba(112, 155, 255, 0.14);
    background: rgba(7, 15, 28, 0.78);
    box-shadow: var(--shadow);
}

.workflow-palette,
.workflow-node-editor {
    padding: 18px;
}

.workflow-panel-head,
.workflow-canvas-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.workflow-panel-head small,
.workflow-canvas-head small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
}

.workflow-palette-list {
    display: grid;
    gap: 12px;
}

.workflow-palette-item {
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(112, 155, 255, 0.16);
    background: rgba(16, 28, 48, 0.74);
    display: grid;
    gap: 12px;
    cursor: grab;
}

.workflow-palette-item p {
    margin: 6px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.workflow-canvas {
    padding: 18px;
}

.workflow-canvas-list {
    min-height: 480px;
    border-radius: 20px;
    border: 1px dashed rgba(112, 155, 255, 0.2);
    background: rgba(9, 18, 34, 0.45);
    padding: 16px;
    display: grid;
    gap: 12px;
}

.workflow-canvas-node {
    position: relative;
    padding: 18px 18px 18px 64px;
    border-radius: 20px;
    border: 1px solid rgba(112, 155, 255, 0.14);
    background: linear-gradient(135deg, rgba(25, 50, 96, 0.92), rgba(13, 27, 51, 0.92));
    cursor: pointer;
}

.workflow-canvas-node.active {
    border-color: rgba(103, 240, 255, 0.48);
    box-shadow: 0 0 0 2px rgba(103, 240, 255, 0.16);
}

.workflow-canvas-node-order {
    position: absolute;
    left: 18px;
    top: 18px;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(103, 240, 255, 0.12);
    border: 1px solid rgba(103, 240, 255, 0.28);
    color: #bdefff;
    font-weight: 700;
}

.workflow-canvas-node-body {
    display: grid;
    gap: 10px;
}

.workflow-node-editor .field {
    margin-bottom: 14px;
}

.workflow-node-editor textarea,
.workflow-node-editor input,
.workflow-node-editor select,
#workflow-graph-json {
    width: 100%;
}

.workflow-node-actions {
    margin-top: 10px;
    justify-content: flex-start;
}

.agent-composer-modal {
    width: min(1500px, 100%);
}

.agent-composer-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr) 360px;
    gap: 16px;
    align-items: start;
}

.agent-composer-rail,
.agent-composer-main,
.agent-composer-sandbox {
    border-radius: 24px;
    border: 1px solid rgba(112, 155, 255, 0.14);
    background: rgba(9, 18, 34, 0.78);
    box-shadow: var(--shadow);
}

.agent-composer-rail,
.agent-composer-sandbox {
    padding: 18px;
}

.agent-composer-main {
    padding: 22px;
}

.agent-mode-stack,
.agent-editor-tabs {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.agent-mode-card,
.agent-editor-tab,
.agent-version-card {
    width: 100%;
    text-align: left;
    border-radius: 20px;
    border: 1px solid rgba(112, 155, 255, 0.16);
    background: rgba(15, 28, 49, 0.72);
    color: var(--text);
}

.agent-mode-card,
.agent-version-card {
    padding: 16px;
}

.agent-mode-card p,
.agent-version-card p,
.agent-composer-hero p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.7;
}

.agent-mode-card.active,
.agent-editor-tab.active,
.agent-version-card.active {
    border-color: rgba(103, 240, 255, 0.44);
    box-shadow: 0 0 0 2px rgba(103, 240, 255, 0.14);
    background: linear-gradient(135deg, rgba(29, 70, 140, 0.9), rgba(20, 44, 84, 0.92));
}

.agent-editor-tab {
    padding: 14px 16px;
    display: grid;
    gap: 6px;
}

.agent-editor-tab small {
    color: var(--muted);
}

.agent-composer-hero {
    padding: 18px 20px;
    border-radius: 22px;
    border: 1px solid rgba(112, 155, 255, 0.14);
    background: linear-gradient(135deg, rgba(17, 34, 62, 0.96), rgba(13, 27, 49, 0.84));
}

.agent-composer-hero h4 {
    margin: 6px 0 0;
    font-size: 24px;
}

.agent-version-grid {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.agent-composer-form {
    margin-top: 18px;
}

.agent-editor-panel {
    display: none;
}

.agent-editor-panel.active {
    display: block;
}

.agent-range-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 12px;
    align-items: center;
}

.agent-composer-sandbox .design-panel + .design-panel {
    margin-top: 16px;
}

@media (max-width: 1180px) {
    .portal-shell {
        grid-template-columns: 1fr;
    }

    .portal-login {
        margin: 0 24px 24px;
    }

    .console-main {
        grid-template-columns: 1fr;
    }

    .stat-grid,
    .ops-grid,
    .agent-grid,
    .template-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workflow-workbench-shell {
        grid-template-columns: 1fr;
    }

    .workflow-palette,
    .workflow-canvas,
    .workflow-node-editor {
        min-height: auto;
    }

    .agent-composer-shell {
        grid-template-columns: 1fr;
    }

    .agent-version-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .portal-hero, .portal-login, .content, .sidebar, .topbar {
        padding: 18px;
    }

    .portal-headline h1 {
        font-size: 42px;
    }

    .hero-panel, .section-head {
        flex-direction: column;
    }

    .hero-stats, .stat-grid, .modal-grid, .ops-grid, .agent-grid, .template-grid {
        grid-template-columns: 1fr;
    }
}

/* 20260410-7 light console refresh */
:root {
    --bg: #f6f6f4;
    --panel: rgba(255, 255, 255, 0.96);
    --panel-strong: #ffffff;
    --line: rgba(17, 17, 17, 0.08);
    --text: #151515;
    --muted: #6b7280;
    --primary: #e6223a;
    --primary-strong: #c8182f;
    --accent: #111111;
    --success: #16a34a;
    --danger: #dc2626;
    --shadow: 0 16px 48px rgba(17, 17, 17, 0.08);
    --radius: 18px;
}

html,
body {
    background:
        radial-gradient(circle at top left, rgba(230, 34, 58, 0.08), transparent 22%),
        radial-gradient(circle at top right, rgba(17, 17, 17, 0.05), transparent 18%),
        linear-gradient(180deg, #faf9f7 0%, #f4f4f2 100%);
    color: var(--text);
    font-size: 14px;
}

body::before {
    background:
        linear-gradient(rgba(17, 17, 17, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(17, 17, 17, 0.03) 1px, transparent 1px);
}

.portal-mark,
.sidebar,
.topbar,
.hero-panel,
.portal-card,
.profile-card,
.metric-card,
.table-card,
.surface,
.ops-card,
.timeline-card,
.entity-card,
.template-card,
.agent-card,
.design-panel,
.workflow-palette,
.workflow-canvas,
.workflow-node-editor,
.modal,
.portal-login {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    color: var(--text);
}

.portal-login {
    color: var(--text);
}

.portal-login .eyebrow,
.eyebrow {
    color: rgba(230, 34, 58, 0.82);
    letter-spacing: 0.12em;
    font-size: 11px;
}

.portal-headline h1 {
    font-size: 56px;
    line-height: 1.02;
    color: #111111;
}

.portal-headline p,
.portal-login p,
.portal-card p,
.muted,
.field small,
.workflow-panel-head small,
.agent-editor-tab small,
.routing-card-head small {
    color: var(--muted);
}

.portal-login h2 {
    font-size: 36px;
}

.portal-mark {
    padding: 8px 14px;
    border-radius: 999px;
}

.portal-mark img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 6px;
}

.portal-mark strong {
    color: #111111;
}

.topbar,
.sidebar {
    backdrop-filter: saturate(140%) blur(10px);
}

.topbar-brand h1 {
    font-size: 18px;
    color: #111111;
}

.topbar-brand p,
.profile-card p,
.profile-card span,
.agent-card-meta,
.portal-meta {
    color: var(--muted);
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: #fff5f6;
    border: 1px solid rgba(230, 34, 58, 0.12);
    overflow: hidden;
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5px;
}

.sidebar-menu button,
.agent-editor-tab,
.agent-mode-card {
    background: #ffffff;
    border: 1px solid var(--line);
    color: #202020;
    padding: 12px 14px;
    border-radius: 16px;
}

.sidebar-menu button.active,
.agent-editor-tab.active,
.agent-mode-card.active {
    background: linear-gradient(180deg, rgba(230, 34, 58, 0.09), rgba(230, 34, 58, 0.04));
    border-color: rgba(230, 34, 58, 0.28);
    color: #b81428;
    box-shadow: 0 10px 24px rgba(230, 34, 58, 0.08);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn,
.mini-btn {
    border-radius: 14px;
    padding: 10px 16px;
    font-size: 13px;
}

.primary-btn {
    background: linear-gradient(135deg, #f53b53, #d91f37);
    color: #fff;
}

.secondary-btn,
.ghost-btn,
.mini-btn {
    background: #ffffff;
    color: #202020;
    border: 1px solid var(--line);
}

.mini-btn.danger,
.secondary-btn.danger,
.danger-btn {
    background: #fff5f5;
    color: #c81e1e;
    border: 1px solid rgba(220, 38, 38, 0.14);
}

.field {
    gap: 8px;
}

.field label {
    font-size: 13px;
    color: #5f6673;
}

.field input,
.field textarea,
.field select {
    border-radius: 14px;
    padding: 11px 13px;
    background: #ffffff;
    border: 1px solid rgba(17, 17, 17, 0.1);
    color: #121212;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    border-color: rgba(230, 34, 58, 0.4);
    box-shadow: 0 0 0 4px rgba(230, 34, 58, 0.08);
}

.modal {
    border-radius: 24px;
}

.modal h3,
.hero-panel h2,
.section-head h3,
.section-head h4,
.agent-composer-hero h4 {
    color: #111111;
    font-size: 24px;
}

.hero-panel p,
.section-head p,
.agent-composer-hero p {
    color: var(--muted);
}

.table-scroll table th {
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    background: #fbfbfb;
}

.table-scroll table td {
    color: #1f2937;
    font-size: 13px;
}

.capsule,
.tag {
    border-radius: 999px;
    padding: 5px 10px;
    background: #f4f4f5;
    border: 1px solid rgba(17, 17, 17, 0.06);
    color: #52525b;
    font-size: 12px;
}

.capsule.success,
.tag.success {
    background: #f0fdf4;
    color: #15803d;
    border-color: rgba(34, 197, 94, 0.15);
}

.capsule.warn,
.tag.warn {
    background: #fff7ed;
    color: #c2410c;
    border-color: rgba(249, 115, 22, 0.18);
}

.capsule.agent-type-badge {
    font-weight: 700;
}

.capsule.agent-type-badge.data {
    background: #fff1f2;
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.22);
}

.capsule.agent-type-badge.assistant,
.capsule.agent-type-badge.general {
    background: #f5f3ff;
    color: #6d28d9;
    border-color: rgba(109, 40, 217, 0.18);
}

.capsule.agent-type-badge.service {
    background: #eff6ff;
    color: #2563eb;
    border-color: rgba(37, 99, 235, 0.18);
}

.capsule.agent-type-badge.content,
.capsule.agent-type-badge.video {
    background: #ecfeff;
    color: #0f766e;
    border-color: rgba(15, 118, 110, 0.18);
}

.capsule.agent-type-badge.workflow {
    background: #f5f5f4;
    color: #57534e;
    border-color: rgba(87, 83, 78, 0.18);
}

.progress-bar {
    background: #efefef;
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar span {
    background: linear-gradient(90deg, #f43f5e, #dc2626);
}

.metric-card strong {
    font-size: 26px;
    color: #111111;
}

.profile-card strong,
.agent-card h4,
.template-card h4,
.entity-card h4,
.ops-card h4 {
    font-size: 16px;
    color: #111111;
}

.agent-composer-shell {
    gap: 18px;
}

.agent-composer-rail {
    background: #fbfbfa;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 16px;
}

.agent-composer-main,
.agent-composer-sandbox {
    gap: 16px;
}

.agent-composer-hero,
.design-panel {
    border-radius: 20px;
}

.model-routing-panel {
    background: #fafafa;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
}

.model-routing-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.routing-card {
    background: #ffffff;
    border: 1px solid rgba(17, 17, 17, 0.08);
    border-radius: 16px;
    padding: 14px;
}

.routing-card-head {
    display: grid;
    gap: 4px;
    margin-bottom: 10px;
}

.routing-card-head strong {
    font-size: 14px;
    color: #111111;
}

.compact-grid {
    gap: 10px;
}

.workflow-preview,
.json-preview {
    background: #fbfbfb;
    color: #1f2937;
    border: 1px solid rgba(17, 17, 17, 0.08);
    border-radius: 16px;
}

.notice-bar {
    background: #fff7ed;
    border: 1px solid rgba(249, 115, 22, 0.16);
    color: #9a3412;
}

@media (max-width: 1280px) {
    .model-routing-grid {
        grid-template-columns: 1fr;
    }
}

/* 20260410-8 precision light refinement */
html,
body {
    background:
        radial-gradient(circle at top left, rgba(230, 34, 58, 0.05), transparent 18%),
        linear-gradient(180deg, #faf9f7 0%, #f5f4f1 52%, #f2f2ef 100%);
    font-size: 13px;
}

body::before {
    background:
        linear-gradient(rgba(17, 17, 17, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(17, 17, 17, 0.018) 1px, transparent 1px);
}

.console-shell {
    background: transparent;
}

.topbar {
    padding: 14px 22px;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(17, 17, 17, 0.06);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.topbar-brand {
    gap: 12px;
}

.topbar-brand h1 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.topbar-brand p {
    margin-top: 2px;
    font-size: 11px;
}

.top-nav {
    gap: 8px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(17, 17, 17, 0.03);
}

.top-nav button {
    padding: 9px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #5b6170;
    background: transparent;
    border: 1px solid transparent;
}

.top-nav button.active {
    color: #c5162c;
    background: #ffffff;
    border-color: rgba(230, 34, 58, 0.16);
    box-shadow: 0 6px 18px rgba(230, 34, 58, 0.08);
}

.topbar-actions {
    gap: 8px;
}

.ghost-btn,
.secondary-btn,
.mini-btn {
    padding: 8px 13px;
    font-size: 12px;
}

.primary-btn,
.danger-btn {
    padding: 9px 14px;
    font-size: 12px;
}

.console-main {
    grid-template-columns: 236px 1fr;
}

.sidebar {
    padding: 16px 14px;
    background: rgba(255, 255, 255, 0.7);
    border-right: 1px solid rgba(17, 17, 17, 0.06);
}

.profile-card {
    padding: 14px;
    border-radius: 18px;
    margin-bottom: 14px;
    background: #ffffff;
}

.profile-card strong {
    font-size: 14px;
    font-weight: 700;
}

.profile-card span,
.profile-card p {
    font-size: 12px;
}

.sidebar-menu {
    gap: 8px;
}

.sidebar-menu button {
    padding: 11px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 14px;
}

.content {
    padding: 20px 22px;
}

.hero-panel,
.table-card,
.metric-card,
.surface,
.ops-card,
.timeline-card,
.entity-card,
.template-card,
.agent-card,
.design-panel,
.workflow-palette,
.workflow-canvas,
.workflow-node-editor,
.portal-card,
.portal-login,
.agent-composer-rail,
.agent-composer-main,
.agent-composer-sandbox {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(17, 17, 17, 0.06);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.05);
}

.hero-panel {
    padding: 22px 24px;
    border-radius: 20px;
}

.hero-panel h2,
.section-head h3,
.modal h3,
.agent-composer-hero h4 {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.section-head h4,
.agent-card h4,
.template-card h4,
.entity-card h4,
.ops-card h4 {
    font-size: 14px;
    font-weight: 700;
}

.hero-panel p,
.section-head p,
.muted,
.portal-login p,
.portal-card p,
.agent-composer-hero p {
    font-size: 12px;
    line-height: 1.65;
}

.metric-card {
    padding: 16px 16px 14px;
}

.metric-card strong {
    font-size: 22px;
    font-weight: 700;
}

.metric-card p {
    font-size: 11px;
}

.table-scroll table th {
    font-size: 11px;
}

.table-scroll table td {
    font-size: 12px;
}

.field {
    gap: 6px;
}

.field label {
    font-size: 12px;
    font-weight: 600;
    color: #6c7382;
}

.field input,
.field textarea,
.field select {
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 12px;
}

.field textarea {
    min-height: 92px;
}

.capsule,
.tag {
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 600;
}

.agent-composer-modal {
    width: min(1540px, 100%);
}

.agent-composer-shell {
    grid-template-columns: 238px minmax(0, 1fr) 320px;
    gap: 14px;
}

.agent-composer-rail,
.agent-composer-main,
.agent-composer-sandbox {
    border-radius: 18px;
}

.agent-composer-rail {
    padding: 14px;
    background: #fdfcfa;
}

.agent-composer-main {
    padding: 16px;
    background: #fbfaf8;
}

.agent-composer-sandbox {
    padding: 14px;
    background: #fdfdfc;
}

.workflow-panel-head {
    margin-bottom: 10px;
}

.workflow-panel-head strong {
    font-size: 13px;
    font-weight: 700;
    color: #202020;
}

.workflow-panel-head small {
    font-size: 11px;
}

.agent-mode-stack,
.agent-editor-tabs {
    gap: 8px;
    margin-bottom: 14px;
}

.agent-mode-card,
.agent-editor-tab,
.agent-version-card {
    padding: 11px 12px;
    border-radius: 14px;
    background: #ffffff;
}

.agent-mode-card strong,
.agent-editor-tab strong,
.agent-version-card strong {
    font-size: 13px;
    font-weight: 700;
}

.agent-mode-card p,
.agent-version-card p,
.agent-editor-tab small {
    font-size: 11px;
    line-height: 1.55;
}

.agent-composer-hero {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(230, 34, 58, 0.08);
    background:
        linear-gradient(135deg, rgba(255, 245, 246, 0.98), rgba(255, 255, 255, 0.98)),
        #ffffff;
}

.agent-composer-hero .eyebrow {
    font-size: 10px;
}

.agent-composer-form {
    margin-top: 12px;
}

.modal-grid {
    gap: 12px;
}

.model-routing-panel {
    padding: 12px;
    background: #fcfbfa;
    border-radius: 16px;
}

.model-routing-panel > label {
    font-size: 12px;
    font-weight: 700;
}

.model-routing-grid {
    gap: 10px;
    margin-top: 8px;
}

.routing-card {
    padding: 12px;
    border-radius: 14px;
}

.routing-card-head strong {
    font-size: 13px;
}

.routing-card-head small {
    font-size: 11px;
}

.agent-range-row {
    grid-template-columns: minmax(0, 1fr) 76px;
}

.notice-bar {
    padding: 10px 12px;
    font-size: 12px;
    border-radius: 12px;
}

.portal-headline h1 {
    font-size: 48px;
}

.portal-login h2 {
    font-size: 28px;
}

@media (max-width: 1280px) {
    .agent-composer-shell {
        grid-template-columns: 1fr;
    }
}

.agent-workspace-strip {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(420px, 0.95fr) auto;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.05);
}

.agent-workspace-main h2 {
    margin: 6px 0;
    font-size: 20px;
    color: #111111;
}

.agent-workspace-main p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.agent-workspace-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.agent-inline-metric {
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: linear-gradient(180deg, #ffffff, #faf7f7);
}

.agent-inline-metric span {
    display: block;
    color: #6b7280;
    font-size: 11px;
}

.agent-inline-metric strong {
    display: block;
    margin-top: 6px;
    font-size: 19px;
    line-height: 1;
    color: #111111;
}

.agent-workspace-actions {
    display: flex;
    justify-content: flex-end;
}

.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.toolbar-search {
    flex: 1;
}

.toolbar-search input {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(17, 17, 17, 0.08);
    padding: 10px 12px;
    background: #ffffff;
    color: #151515;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar-actions select {
    border-radius: 14px;
    border: 1px solid rgba(17, 17, 17, 0.08);
    padding: 9px 12px;
    background: #ffffff;
    color: #151515;
}

.agent-table td {
    white-space: normal;
    vertical-align: top;
}

.list-pager {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.list-pager-summary {
    color: #6b7280;
    font-size: 12px;
}

.list-pager-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mini-btn[disabled] {
    opacity: 0.42;
    cursor: not-allowed;
    transform: none;
}

.mini-btn.is-current {
    background: #fff4f5;
    border-color: rgba(230, 34, 58, 0.2);
    color: #c5162c;
}

.prompt-editor-modal {
    width: min(1280px, 100%);
}

.prompt-large-textarea {
    min-height: 220px;
    font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
    line-height: 1.65;
}

.workflow-workbench {
    margin-top: 18px;
    padding: 18px;
    border-radius: 22px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background:
        radial-gradient(circle at top left, rgba(230, 34, 58, 0.05), transparent 18%),
        linear-gradient(180deg, #f8f7f5, #f3f1ee);
}

.workflow-palette,
.workflow-canvas,
.workflow-node-editor {
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(17, 17, 17, 0.06);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.05);
}

.workflow-palette-item {
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(230, 34, 58, 0.08);
    background: linear-gradient(180deg, #fffafb, #ffffff);
    cursor: grab;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.workflow-palette-item:hover {
    transform: translateY(-1px);
    border-color: rgba(230, 34, 58, 0.18);
    box-shadow: 0 10px 22px rgba(230, 34, 58, 0.06);
}

.workflow-palette-item.is-dragging {
    opacity: 0.72;
}

.workflow-palette-item-head {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.workflow-drag-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: #fff3f4;
    border: 1px solid rgba(230, 34, 58, 0.12);
    color: #c5162c;
    font-size: 11px;
    font-weight: 700;
}

.workflow-drag-chip.subtle {
    background: #f4f4f5;
    border-color: rgba(17, 17, 17, 0.06);
    color: #6b7280;
}

.workflow-canvas-list {
    background: #f8f7f5;
    border: 1px dashed rgba(230, 34, 58, 0.18);
    transition: border-color 0.16s ease, background 0.16s ease;
}

.workflow-canvas-list.is-drag-over {
    background: #fff7f8;
    border-color: rgba(230, 34, 58, 0.34);
}

.workflow-canvas-node {
    padding: 18px 18px 18px 64px;
    border-radius: 20px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: linear-gradient(180deg, #ffffff, #fbfaf8);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
    cursor: grab;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.workflow-canvas-node:hover {
    transform: translateY(-1px);
    border-color: rgba(230, 34, 58, 0.14);
}

.workflow-canvas-node.active {
    border-color: rgba(230, 34, 58, 0.24);
    box-shadow: 0 0 0 3px rgba(230, 34, 58, 0.08);
}

.workflow-canvas-node.is-dragging {
    opacity: 0.64;
}

.workflow-canvas-node.drag-over {
    border-color: rgba(230, 34, 58, 0.28);
    background: #fff6f7;
}

.workflow-canvas-node-order {
    background: #fff5f6;
    border: 1px solid rgba(230, 34, 58, 0.14);
    color: #c5162c;
}

.workflow-node-caption {
    margin-bottom: 6px;
    color: #9ca3af;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.workflow-node-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 1280px) {
    .agent-workspace-strip {
        grid-template-columns: 1fr;
    }

    .agent-workspace-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .table-toolbar,
    .list-pager {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-actions,
    .list-pager-actions {
        justify-content: flex-start;
    }

    .agent-workspace-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.workflow-designer-modal {
    width: min(1680px, calc(100vw - 40px));
    max-height: calc(100vh - 32px);
    padding: 24px;
    border-radius: 28px;
    border: 1px solid rgba(17, 17, 17, 0.08);
    background:
        radial-gradient(circle at top right, rgba(230, 34, 58, 0.06), transparent 22%),
        linear-gradient(180deg, #fffdfb 0%, #fbf9f6 48%, #f7f4ef 100%);
    color: #101828;
}

.workflow-designer-modal h3 {
    margin: 0;
    font-size: 24px;
    letter-spacing: -0.02em;
    color: #121826;
}

.workflow-designer-modal .field label,
.workflow-designer-modal .workflow-panel-head strong,
.workflow-designer-modal .workflow-stage-toolbar strong {
    color: #1f2937;
}

.workflow-designer-modal .field small,
.workflow-designer-modal .workflow-panel-head small,
.workflow-designer-modal .workflow-stage-toolbar small {
    color: #6b7280;
}

.workflow-designer-modal .field input,
.workflow-designer-modal .field textarea,
.workflow-designer-modal .field select {
    border-color: rgba(17, 17, 17, 0.08);
    background: rgba(255, 255, 255, 0.94);
    color: #111827;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.workflow-designer-modal .field textarea {
    min-height: 96px;
}

.workflow-designer-modal .mini-btn,
.workflow-designer-modal .secondary-btn,
.workflow-designer-modal .primary-btn {
    min-height: 38px;
}

.workflow-designer-hero {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 20px;
    margin-bottom: 18px;
}

.workflow-designer-hero p {
    margin: 8px 0 0;
    max-width: 760px;
    color: #667085;
    font-size: 13px;
    line-height: 1.7;
}

.workflow-designer-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    min-width: 360px;
}

.workflow-summary-metric {
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: rgba(255, 255, 255, 0.8);
}

.workflow-summary-metric span {
    display: block;
    color: #6b7280;
    font-size: 11px;
}

.workflow-summary-metric strong {
    display: block;
    margin-top: 8px;
    color: #101828;
    font-size: 24px;
    letter-spacing: -0.03em;
}

.workflow-meta-form {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.workflow-meta-form .field.full {
    grid-column: 1 / -1;
}

.workflow-designer-modal .workflow-workbench {
    margin-top: 0;
    padding: 18px;
    border-radius: 24px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.06);
}

.workflow-designer-modal .workflow-workbench-shell {
    margin-top: 16px;
    display: grid;
    grid-template-columns: 278px minmax(0, 1fr) 356px;
    gap: 16px;
    align-items: start;
}

.workflow-designer-modal .workflow-palette,
.workflow-designer-modal .workflow-canvas,
.workflow-designer-modal .workflow-node-editor {
    min-height: 660px;
    border-radius: 22px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.04);
}

.workflow-designer-modal .workflow-palette,
.workflow-designer-modal .workflow-node-editor {
    padding: 16px;
}

.workflow-stage-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.workflow-stage-toolbar-main strong {
    display: block;
    font-size: 15px;
}

.workflow-stage-toolbar-main small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
}

.workflow-palette-groups {
    display: grid;
    gap: 14px;
    margin-top: 10px;
}

.workflow-palette-group-title {
    margin-bottom: 10px;
    color: #667085;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.workflow-designer-modal .workflow-palette-list {
    display: grid;
    gap: 10px;
}

.workflow-designer-modal .workflow-palette-item {
    padding: 13px;
    border-radius: 16px;
    border: 1px solid rgba(17, 17, 17, 0.05);
    background: linear-gradient(180deg, #ffffff 0%, #fcfaf8 100%);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.03);
}

.workflow-designer-modal .workflow-palette-item strong {
    display: block;
    color: #101828;
    font-size: 14px;
}

.workflow-designer-modal .workflow-palette-item p {
    margin: 6px 0 0;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.6;
}

.workflow-node-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #ffffff;
}

.workflow-node-icon.accent-violet {
    background: linear-gradient(135deg, #7c75ff, #9f8bff);
}

.workflow-node-icon.accent-blue {
    background: linear-gradient(135deg, #5b8cff, #3db7ff);
}

.workflow-node-icon.accent-sky {
    background: linear-gradient(135deg, #46b4ff, #72d5ff);
}

.workflow-node-icon.accent-amber {
    background: linear-gradient(135deg, #ff9e54, #ffc067);
}

.workflow-node-icon.accent-pink {
    background: linear-gradient(135deg, #ee7eb1, #ff9cc3);
}

.workflow-node-icon.accent-mint {
    background: linear-gradient(135deg, #44c9a9, #79ddb0);
}

.workflow-stage-wrap {
    padding: 0;
    overflow: auto;
}

.workflow-stage {
    position: relative;
    min-width: 100%;
    min-height: 660px;
    border-radius: 22px;
    background:
        radial-gradient(circle at 1px 1px, rgba(124, 117, 255, 0.22) 1.1px, transparent 0),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(249, 247, 243, 0.98));
    background-size: 24px 24px, auto;
}

.workflow-stage.is-drag-over {
    box-shadow: inset 0 0 0 2px rgba(230, 34, 58, 0.18);
}

.workflow-stage-links,
.workflow-stage-nodes {
    position: absolute;
    inset: 0;
}

.workflow-stage-links {
    overflow: visible;
    pointer-events: none;
}

.workflow-link {
    fill: none;
    stroke: rgba(93, 101, 143, 0.56);
    stroke-width: 2.6;
    stroke-linecap: round;
}

.workflow-link-dot {
    fill: #ffffff;
    stroke: rgba(124, 117, 255, 0.86);
    stroke-width: 2;
}

.workflow-link-dot.target {
    stroke: rgba(230, 34, 58, 0.72);
}

.workflow-stage-empty {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 12px 18px;
    border-radius: 999px;
    border: 1px dashed rgba(17, 17, 17, 0.12);
    background: rgba(255, 255, 255, 0.72);
    color: #6b7280;
    font-size: 12px;
}

.workflow-stage-node {
    position: absolute;
    width: 282px;
    min-height: 120px;
    padding: 16px 16px 14px;
    border-radius: 22px;
    border: 1px solid rgba(17, 17, 17, 0.07);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.workflow-stage-node:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 38px rgba(15, 23, 42, 0.09);
}

.workflow-stage-node.active {
    border-color: rgba(124, 117, 255, 0.46);
    box-shadow: 0 0 0 4px rgba(124, 117, 255, 0.12), 0 18px 32px rgba(15, 23, 42, 0.09);
}

.workflow-stage-node.is-moving {
    cursor: grabbing;
    box-shadow: 0 0 0 4px rgba(230, 34, 58, 0.12), 0 22px 42px rgba(15, 23, 42, 0.12);
}

.workflow-stage-node-head,
.workflow-stage-node-title,
.workflow-stage-node-actions,
.workflow-config-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.workflow-stage-node-title strong,
.workflow-config-head strong {
    display: block;
    color: #101828;
    font-size: 16px;
    letter-spacing: -0.02em;
}

.workflow-stage-node-title small,
.workflow-config-head small {
    display: block;
    margin-top: 3px;
    color: #6b7280;
    font-size: 11px;
    line-height: 1.5;
}

.workflow-stage-node-body {
    margin-top: 14px;
    display: grid;
    gap: 10px;
}

.workflow-stage-node-body p {
    margin: 0;
    color: #344054;
    font-size: 12px;
    line-height: 1.65;
}

.workflow-stage-node-chips,
.workflow-stage-node-resources {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.workflow-chip,
.workflow-stage-node-resources span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.workflow-chip {
    background: #f4f4f6;
    border: 1px solid rgba(17, 17, 17, 0.07);
    color: #475467;
}

.workflow-chip.subtle {
    color: #667085;
}

.workflow-chip.success,
.workflow-stage-node-resources span {
    background: #eefaf3;
    border: 1px solid rgba(52, 168, 83, 0.18);
    color: #1f8f4d;
}

.workflow-port {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 2px solid rgba(124, 117, 255, 0.84);
    background: #ffffff;
    transform: translateY(-50%);
}

.workflow-port.in {
    left: -7px;
}

.workflow-port.out {
    right: -7px;
}

.icon-btn {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(17, 17, 17, 0.08);
    border-radius: 10px;
    background: rgba(249, 250, 251, 0.96);
    color: #667085;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.icon-btn:hover {
    border-color: rgba(230, 34, 58, 0.2);
    color: #c5162c;
    background: #fff6f7;
}

.workflow-designer-modal .workflow-node-editor {
    overflow: auto;
}

.workflow-designer-modal .workflow-node-editor .field {
    margin-bottom: 12px;
}

.workflow-designer-modal .workflow-node-editor textarea {
    min-height: 92px;
}

.workflow-config-head {
    margin-bottom: 14px;
}

.workflow-json-shell {
    margin-top: 16px;
    padding: 16px;
    border-radius: 20px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: rgba(255, 255, 255, 0.72);
}

.workflow-designer-modal .workflow-preview {
    margin-top: 16px;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: rgba(255, 255, 255, 0.72);
}

.workflow-designer-modal .workflow-node {
    background: linear-gradient(180deg, #ffffff, #fcfaf8);
    border-color: rgba(17, 17, 17, 0.06);
}

.modal.modal-light {
    border: 1px solid rgba(17, 17, 17, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(250, 247, 243, 0.98));
    color: #111827;
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.18);
}

.modal-light h3,
.modal-light h4,
.modal-light strong,
.modal-light label {
    color: #111827;
}

.modal-light .muted,
.modal-light .field small,
.modal-light p {
    color: #667085;
}

.modal-light .metric-card,
.modal-light .table-card,
.modal-light .ops-card,
.modal-light .timeline-card,
.modal-light .entity-card,
.modal-light .design-panel {
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

.modal-light .metric-card strong {
    font-size: 28px;
}

.modal-light .design-panel pre,
.modal-light .timeline-card pre,
.modal-light .ops-card pre,
.modal-light .workflow-preview,
.modal-light .json-preview {
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: rgba(247, 248, 250, 0.96);
    color: #344054;
}

.modal-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(17, 17, 17, 0.08);
}

.modal-topbar-main {
    display: grid;
    gap: 6px;
}

.modal-topbar-kicker {
    color: #e6223a;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.modal-topbar-title {
    font-size: 21px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: #111827;
}

.modal-topbar-main p {
    margin: 0;
    font-size: 13px;
    line-height: 1.7;
    color: #667085;
}

.modal-topbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.detail-summary-grid,
.detail-activity-grid {
    margin-top: 18px;
}

.detail-column-stack {
    display: grid;
    gap: 16px;
}

.detail-log-card {
    align-items: flex-start;
}

.detail-log-main {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 6px;
}

.detail-log-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.detail-log-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.detail-log-meta span {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(17, 17, 17, 0.06);
    background: rgba(248, 250, 252, 0.92);
    color: #667085;
    font-size: 12px;
}

.detail-log-note {
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px dashed rgba(17, 17, 17, 0.08);
    background: rgba(248, 250, 252, 0.76);
    color: #667085;
    font-size: 12px;
    line-height: 1.7;
}

.detail-log-actions {
    display: flex;
    align-items: center;
}

@media (max-width: 1480px) {
    .workflow-meta-form {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .workflow-designer-modal .workflow-workbench-shell {
        grid-template-columns: 250px minmax(0, 1fr) 320px;
    }
}

@media (max-width: 1180px) {
    .chat-workbench-shell {
        grid-template-columns: 1fr;
    }

    .digital-pet-factory-shell {
        grid-template-columns: 1fr;
    }

    .chat-session-list {
        max-height: 320px;
    }

    .chat-composer-input {
        grid-template-columns: 1fr;
    }

    .chat-attachment-toolbar {
        flex-direction: column;
    }

    .digital-pet-stage-grid {
        grid-template-columns: 1fr;
    }

    .digital-pet-asset-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chat-composer-input.single {
        grid-template-columns: 1fr;
    }

    .chat-attachment-card {
        grid-template-columns: 1fr;
    }

    .chat-attachment-dropzone {
        grid-template-columns: 1fr;
    }

    .chat-attachment-preview {
        width: 100%;
        height: 180px;
    }

    .workflow-designer-hero,
    .workflow-stage-toolbar {
        flex-direction: column;
    }

    .workflow-designer-summary {
        min-width: 0;
    }

    .workflow-meta-form,
    .workflow-designer-modal .workflow-workbench-shell {
        grid-template-columns: 1fr;
    }

    .workflow-designer-modal .workflow-palette,
    .workflow-designer-modal .workflow-canvas,
    .workflow-designer-modal .workflow-node-editor {
        min-height: auto;
    }

    .workflow-stage {
        min-height: 620px;
    }

    .modal-topbar {
        flex-direction: column;
    }

    .modal-topbar-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 720px) {
    .digital-pet-meta-grid,
    .digital-pet-asset-strip {
        grid-template-columns: 1fr;
    }
}
