:root {
    --bg: #e0e5ec;
    --surface: #e0e5ec;
    --surface-soft: #e8edf3;
    --text: #354052;
    --muted: #7b8495;
    --primary: #6d5dfc;
    --primary-strong: #5747e8;
    --coral: #ff7f87;
    --mint: #55bdb2;
    --danger: #d84f61;
    --shadow-dark: #b8bcc2;
    --shadow-light: #ffffff;
    --line: rgba(99, 110, 129, 0.12);
    --raised: 8px 8px 16px var(--shadow-dark), -8px -8px 16px var(--shadow-light);
    --raised-small: 4px 4px 9px var(--shadow-dark), -4px -4px 9px var(--shadow-light);
    --inset: inset 4px 4px 9px var(--shadow-dark), inset -4px -4px 9px var(--shadow-light);
    color-scheme: light;
}

html[data-theme="dark"] {
    --bg: #262d37;
    --surface: #262d37;
    --surface-soft: #2c3440;
    --text: #e9edf4;
    --muted: #a8b0bd;
    --primary: #8f82ff;
    --primary-strong: #7465f4;
    --coral: #ff9399;
    --mint: #70d2c7;
    --danger: #ff8490;
    --shadow-dark: #191e25;
    --shadow-light: #333c49;
    --line: rgba(221, 228, 239, 0.09);
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    background: var(--bg);
}

body {
    min-width: 320px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
    font-size: 14px;
    letter-spacing: 0;
    transition: background-color 180ms ease, color 180ms ease;
}

body.modal-open {
    overflow: hidden;
}

button,
textarea {
    color: inherit;
    font: inherit;
    letter-spacing: 0;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    border: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

[hidden] {
    display: none !important;
}

.app {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr) 280px;
    gap: 26px;
    width: min(100%, 1600px);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding: 24px 28px 28px;
}

.raised {
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--raised);
}

.inset {
    border: 1px solid rgba(99, 110, 129, 0.06);
    background: var(--surface);
    box-shadow: var(--inset);
}

.sidebar,
.right {
    position: sticky;
    top: 24px;
    align-self: start;
}

.sidebar {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 52px);
    min-height: calc(100dvh - 52px);
    padding: 2px;
}

.brand {
    display: flex;
    align-items: center;
    min-width: 0;
    padding: 4px 8px 22px;
}

.brand img {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    border: 3px solid var(--surface);
    border-radius: 50%;
    object-fit: cover;
    box-shadow: var(--raised-small);
}

.brand > span {
    display: flex;
    min-width: 0;
    margin-left: 13px;
    flex-direction: column;
}

.brand strong {
    overflow: hidden;
    font-size: 20px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand small {
    margin-top: 2px;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.new-chat {
    display: flex;
    width: 100%;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    border-radius: 14px;
    color: var(--primary-strong);
    cursor: pointer;
    font-weight: 700;
    transition: color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.new-chat:hover {
    color: var(--primary);
    transform: translateY(-1px);
}

.new-chat:active {
    transform: translateY(0);
    box-shadow: var(--inset);
}

.nav-label {
    margin: 25px 12px 8px;
    color: var(--muted);
    font-size: 12px;
}

.nav {
    display: flex;
    width: 100%;
    min-height: 45px;
    align-items: center;
    gap: 12px;
    margin: 3px 0;
    padding: 0 15px;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    text-align: left;
    transition: color 160ms ease, box-shadow 160ms ease;
}

.nav i {
    width: 22px;
    color: inherit;
    font-size: 20px;
    text-align: center;
}

.nav:hover,
.nav.active {
    color: var(--primary-strong);
}

.nav.active {
    background: var(--surface);
    box-shadow: var(--inset);
    font-weight: 700;
}

.side-card {
    margin-top: auto;
    padding: 17px;
    border-radius: 16px;
}

.side-card h2 {
    margin: 0 0 14px;
    font-size: 14px;
}

.side-card p {
    margin: 13px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}

.status-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
}

.status-line > span,
.online {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.status-line strong {
    max-width: 98px;
    overflow: hidden;
    color: var(--text);
    font-size: 11px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 0 4px rgba(85, 189, 178, 0.14);
}

[data-state="offline"] .dot {
    background: var(--coral);
    box-shadow: 0 0 0 4px rgba(255, 127, 135, 0.14);
}

.main {
    display: flex;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex-direction: column;
}

.topbar {
    display: flex;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 46px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 17px;
}

.topbar-left,
.top-actions {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.top-actions {
    flex: 0 0 auto;
}

.auth-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-left: 3px;
}

.auth-button {
    min-height: 38px;
    padding: 0 15px;
    border-radius: 11px;
    cursor: pointer;
    font-weight: 700;
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.auth-button:hover {
    transform: translateY(-1px);
}

.auth-button:active {
    transform: translateY(0);
}

.auth-button-secondary {
    background: var(--surface);
    box-shadow: var(--raised-small);
    color: var(--primary-strong);
}

.auth-button-secondary:active {
    box-shadow: var(--inset);
}

.auth-button-primary {
    background: var(--primary);
    box-shadow: 4px 4px 9px rgba(84, 72, 190, 0.22), -3px -3px 8px var(--shadow-light);
    color: #fff;
}

.auth-button-primary:hover,
.auth-submit:hover {
    background: var(--primary-strong);
}

.user-chip {
    display: inline-flex;
    max-width: 170px;
    min-height: 38px;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    border-radius: 11px;
    box-shadow: var(--inset);
    color: var(--text);
}

.user-chip > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crumb {
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crumb b {
    color: var(--text);
}

.icon-btn {
    display: inline-flex;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--raised-small);
    cursor: pointer;
    transition: color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.icon-btn:hover {
    color: var(--primary);
    transform: translateY(-1px);
}

.icon-btn:active {
    transform: translateY(0);
    box-shadow: var(--inset);
}

.icon-btn i {
    font-size: 18px;
}

.welcome {
    position: relative;
    display: grid;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 164px;
    grid-template-columns: minmax(0, 1fr) 155px;
    align-items: center;
    overflow: hidden;
    padding: 27px 34px;
    border-radius: 20px;
}

.welcome > div {
    position: relative;
    z-index: 1;
}

.welcome h1 {
    margin: 0;
    font-size: 25px;
    line-height: 1.35;
}

.welcome p {
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.8;
}

.welcome img {
    position: absolute;
    right: 34px;
    bottom: -55px;
    width: 126px;
    height: 190px;
    object-fit: contain;
    object-position: center top;
    filter: drop-shadow(0 8px 8px rgba(73, 69, 112, 0.12));
}

.chat-card {
    display: flex;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 560px;
    flex: 1 1 auto;
    flex-direction: column;
    margin-top: 18px;
    overflow: hidden;
    border-radius: 20px;
}

.chat-head {
    display: flex;
    width: 100%;
    min-width: 0;
    min-height: 74px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 13px 22px;
    border-bottom: 1px solid var(--line);
}

.chat-person {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.chat-person img {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border: 2px solid var(--surface);
    border-radius: 50%;
    object-fit: cover;
    box-shadow: var(--raised-small);
}

.chat-person > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.chat-person strong {
    font-size: 15px;
}

.chat-person small {
    margin-top: 3px;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.online {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
}

.connection-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 20px 0;
    padding: 13px 15px;
    border: 1px solid rgba(255, 127, 135, 0.25);
    border-radius: 12px;
    background: rgba(255, 127, 135, 0.08);
    color: var(--danger);
}

.connection-notice > i {
    flex: 0 0 auto;
    font-size: 22px;
}

.connection-notice > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.connection-notice span {
    color: var(--muted);
    font-size: 12px;
}

.messages {
    position: relative;
    flex: 1 1 340px;
    min-height: 300px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 19px 24px 22px;
    overscroll-behavior: contain;
    scrollbar-color: rgba(109, 93, 252, 0.3) transparent;
    scrollbar-width: thin;
}

.messages::-webkit-scrollbar {
    width: 6px;
}

.messages::-webkit-scrollbar-thumb {
    border-radius: 6px;
    background: rgba(109, 93, 252, 0.25);
}

.day {
    margin: 1px 0 22px;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.chat-empty {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    width: min(86%, 390px);
    align-items: center;
    flex-direction: column;
    transform: translate(-50%, -45%);
    color: var(--muted);
    text-align: center;
}

.chat-empty > i {
    display: inline-flex;
    width: 58px;
    height: 58px;
    align-items: center;
    justify-content: center;
    margin-bottom: 17px;
    border-radius: 50%;
    color: var(--primary);
    font-size: 25px;
    box-shadow: var(--raised-small);
}

.chat-empty strong {
    color: var(--text);
    font-size: 15px;
}

.chat-empty span {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.65;
}

.message {
    display: flex;
    width: 100%;
    align-items: flex-start;
    gap: 11px;
    margin: 0 0 20px;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    display: flex;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--surface);
    border-radius: 50%;
    background: var(--surface);
    object-fit: cover;
    box-shadow: var(--raised-small);
}

span.message-avatar {
    background: var(--primary);
    color: #fff;
}

.message-body {
    display: flex;
    max-width: min(76%, 680px);
    min-width: 0;
    flex-direction: column;
}

.message.user .message-body {
    align-items: flex-end;
}

.bubble {
    max-width: 100%;
    padding: 12px 15px;
    border-radius: 5px 14px 14px 14px;
    background: var(--surface);
    box-shadow: var(--raised-small);
    line-height: 1.75;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.bubble.streaming::after {
    display: inline-block;
    width: 2px;
    height: 1.05em;
    margin-left: 3px;
    vertical-align: -0.16em;
    background: currentColor;
    content: "";
    animation: stream-cursor 900ms steps(1, end) infinite;
}

.message-interrupted .bubble {
    opacity: 0.76;
}

.message-interrupted .bubble::after {
    content: "（已停止，未保存）";
    color: var(--muted);
    font-size: 11px;
}

.message.user .bubble {
    border-radius: 14px 5px 14px 14px;
    background: var(--primary);
    box-shadow: 4px 4px 9px rgba(84, 72, 190, 0.22), -3px -3px 8px var(--shadow-light);
    color: #fff;
}

.message-time {
    margin-top: 7px;
    color: var(--muted);
    font-size: 10px;
}

.typing {
    display: flex;
    min-width: 64px;
    align-items: center;
    gap: 5px;
    padding-top: 16px;
    padding-bottom: 16px;
}

.typing i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    animation: typing 1.1s infinite ease-in-out;
}

.typing i:nth-child(2) {
    animation-delay: 140ms;
}

.typing i:nth-child(3) {
    animation-delay: 280ms;
}

@keyframes typing {
    0%,
    60%,
    100% {
        opacity: 0.35;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

@keyframes stream-cursor {
    0%,
    48% {
        opacity: 1;
    }
    49%,
    100% {
        opacity: 0;
    }
}

.chat-error {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin: 0 20px 13px;
    padding: 12px 14px;
    border: 1px solid rgba(216, 79, 97, 0.25);
    border-radius: 12px;
    background: rgba(216, 79, 97, 0.08);
    color: var(--danger);
}

.chat-error > i {
    margin-top: 2px;
    flex: 0 0 auto;
    font-size: 18px;
}

.chat-error > div {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 3px;
}

.chat-error span,
.chat-error small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.chat-error small:empty {
    display: none;
}

.chat-error button {
    min-width: 58px;
    flex: 0 0 auto;
    padding: 7px 10px;
    border-radius: 9px;
    background: var(--surface);
    box-shadow: var(--raised-small);
    color: var(--danger);
    cursor: pointer;
    font-size: 12px;
}

.chat-error button:active {
    box-shadow: var(--inset);
}

.composer {
    display: flex;
    min-width: 0;
    min-height: 62px;
    align-items: flex-end;
    gap: 12px;
    margin: 0 20px 20px;
    padding: 10px 10px 10px 17px;
    border-radius: 17px;
}

.composer textarea {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    max-height: 132px;
    flex: 1;
    resize: none;
    overflow-y: auto;
    border: 0;
    outline: 0;
    background: transparent;
    line-height: 1.65;
}

.composer textarea::placeholder {
    color: var(--muted);
}

.send {
    display: inline-flex;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: var(--primary);
    box-shadow: 4px 4px 9px rgba(84, 72, 190, 0.24), -3px -3px 7px var(--shadow-light);
    color: #fff;
    cursor: pointer;
    transition: background-color 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.send:not(:disabled):hover {
    background: var(--primary-strong);
    transform: translateY(-1px);
}

.send:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.footer-note {
    padding: 14px 8px 0;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.right {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 18px;
}

.profile,
.panel {
    border-radius: 18px;
}

.profile {
    padding: 24px 18px 20px;
    text-align: center;
}

.profile > img {
    width: 82px;
    height: 82px;
    border: 4px solid var(--surface);
    border-radius: 50%;
    object-fit: cover;
    box-shadow: var(--raised-small);
}

.profile h2 {
    margin: 13px 0 4px;
    font-size: 19px;
}

.profile p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.profile .tag {
    display: inline-block;
    margin-top: 14px;
    padding: 7px 11px;
    border-radius: 10px;
    color: var(--primary-strong);
    font-size: 11px;
    box-shadow: var(--inset);
}

.panel {
    padding: 18px;
}

.panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 15px;
}

.panel-title strong {
    font-size: 14px;
}

.panel-title span {
    color: var(--primary);
    font-size: 11px;
}

.mood {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
}

.mood button {
    display: flex;
    min-width: 0;
    min-height: 58px;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    border-radius: 11px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
}

.mood button:hover,
.mood button.selected {
    color: var(--primary);
}

.mood button.selected {
    box-shadow: var(--inset);
}

.mood button > span {
    font-size: 20px;
    line-height: 1;
}

.mood button small {
    margin-top: 5px;
    font-size: 9px;
}

.preference-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 38px;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.preference-row:nth-child(2) {
    border-top: 0;
    padding-top: 2px;
}

.feature-icon {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--primary);
    box-shadow: var(--raised-small);
}

.preference-row > div:nth-child(2) {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.preference-row strong {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preference-row small {
    margin-top: 3px;
    overflow: hidden;
    color: var(--muted);
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toggle {
    position: relative;
    width: 38px;
    height: 22px;
    padding: 0;
    border-radius: 11px;
    background: var(--surface);
    box-shadow: var(--inset);
    cursor: pointer;
}

.toggle span {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--muted);
    transition: left 160ms ease, background-color 160ms ease;
}

.toggle.on span {
    left: 20px;
    background: var(--primary);
}

.safety-panel {
    border-left: 3px solid var(--coral);
}

.safety-panel p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.75;
}

.safety-panel b {
    color: var(--danger);
}

.mobile-only,
.sidebar-backdrop {
    display: none;
}

.auth-modal {
    position: fixed;
    z-index: 100;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
}

.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(40, 45, 55, 0.42);
    cursor: default;
}

.auth-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 430px);
    max-height: calc(100dvh - 36px);
    overflow-y: auto;
    padding: 24px;
    border-radius: 18px;
}

.auth-dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.auth-dialog-head h2 {
    margin: 0;
    font-size: 21px;
}

.auth-dialog-head p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.auth-dialog-head .icon-btn {
    width: 34px;
    height: 34px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 23px 0 20px;
    padding: 5px;
    border-radius: 12px;
    box-shadow: var(--inset);
}

.auth-tabs button {
    min-height: 38px;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-weight: 700;
}

.auth-tabs button.selected {
    background: var(--surface);
    box-shadow: var(--raised-small);
    color: var(--primary-strong);
}

.auth-form {
    display: flex;
    flex-direction: column;
}

.auth-form label {
    margin: 0 0 7px;
    font-size: 12px;
    font-weight: 700;
}

.auth-form input {
    width: 100%;
    min-height: 44px;
    margin: 0 0 15px;
    padding: 0 13px;
    border: 0;
    border-radius: 11px;
    outline: 0;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--inset);
    font: inherit;
}

.auth-form input::placeholder {
    color: var(--muted);
}

.auth-form input:focus {
    outline: 3px solid rgba(109, 93, 252, 0.22);
    outline-offset: 2px;
}

.auth-submit {
    min-height: 45px;
    margin-top: 3px;
    border-radius: 11px;
    background: var(--primary);
    box-shadow: 4px 4px 9px rgba(84, 72, 190, 0.22), -3px -3px 8px var(--shadow-light);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}

.auth-submit:disabled {
    cursor: wait;
    opacity: 0.58;
}

.auth-error {
    margin-top: 15px;
    padding: 10px 12px;
    border: 1px solid rgba(216, 79, 97, 0.25);
    border-radius: 10px;
    background: rgba(216, 79, 97, 0.08);
    color: var(--danger);
    font-size: 12px;
    line-height: 1.55;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(109, 93, 252, 0.28);
    outline-offset: 3px;
}

.companion-modal {
    position: fixed;
    z-index: 90;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
}

.companion-modal-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(40, 45, 55, 0.42);
    cursor: default;
}

.companion-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 620px);
    max-height: calc(100dvh - 36px);
    overflow-y: auto;
    padding: 25px;
    border-radius: 19px;
}

.companion-dialog.workflow-dialog {
    width: min(100%, 920px);
}

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

.companion-dialog-head h2 {
    margin: 3px 0 0;
    font-size: 22px;
}

.companion-dialog-head p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.companion-dialog-head .icon-btn {
    width: 34px;
    height: 34px;
}

.eyebrow {
    color: var(--primary-strong);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
}

.companion-note {
    margin-bottom: 16px;
    padding: 11px 13px;
    border-radius: 11px;
    background: rgba(109, 93, 252, .08);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}

.growth-chart {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    align-items: end;
    gap: 8px;
    min-height: 145px;
    margin: 8px 0 21px;
    padding: 13px 8px 7px;
    border-radius: 13px;
    box-shadow: var(--inset);
}

.growth-bar {
    display: flex;
    min-width: 0;
    height: 116px;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    color: var(--muted);
    font-size: 10px;
}

.growth-bar > i {
    display: block;
    width: min(25px, 75%);
    min-height: 8px;
    border-radius: 9px 9px 3px 3px;
    background: linear-gradient(180deg, var(--primary), var(--mint));
}

.growth-bar > b {
    color: var(--text);
    font-size: 11px;
}

.companion-list {
    display: flex;
    max-height: 170px;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    margin-bottom: 17px;
}

.companion-list-empty {
    padding: 16px 10px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.companion-list-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 11px;
    background: var(--surface-soft);
}

.companion-list-item > div {
    min-width: 0;
}

.companion-list-item strong {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
}

.companion-list-item p,
.companion-list-item small {
    display: block;
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.companion-list-item button,
.text-button {
    flex: 0 0 auto;
    padding: 3px 5px;
    border-radius: 6px;
    background: transparent;
    color: var(--danger);
    cursor: pointer;
    font-size: 11px;
}

.companion-form {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.companion-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.companion-form textarea,
.companion-form select {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 0;
    border-radius: 10px;
    outline: 0;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--inset);
    resize: vertical;
}

.companion-form textarea:focus,
.companion-form select:focus {
    outline: 3px solid rgba(109, 93, 252, .22);
    outline-offset: 2px;
}

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

.companion-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.companion-form-actions .auth-submit {
    min-height: 39px;
    padding: 0 16px;
}

.form-status {
    flex: 1;
    color: var(--muted);
    font-size: 11px;
}

.memory-setting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 17px;
    padding: 12px;
    border-radius: 11px;
    background: var(--surface-soft);
}

.memory-setting strong,
.memory-setting small {
    display: block;
}

.memory-setting strong {
    font-size: 12px;
}

.memory-setting small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.memory-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 18px 0 9px;
    font-size: 12px;
}

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

.plugin-card {
    display: flex;
    min-height: 122px;
    flex-direction: column;
    padding: 14px;
    border-radius: 13px;
    background: var(--surface-soft);
}

.plugin-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
}

.plugin-card-head i {
    color: var(--primary-strong);
    font-size: 19px;
}

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

.plugin-card p {
    flex: 1;
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.55;
}

.plugin-card small {
    margin-top: 8px;
    color: var(--mint);
    font-size: 10px;
}

.plugin-toggle {
    min-height: 34px;
    margin-top: 10px;
    padding: 0 10px;
    font-size: 11px;
}

.workflow-safety strong {
    margin-right: 7px;
    color: var(--primary-strong);
}

.workflow-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 14px;
}

.workflow-tabs button {
    display: flex;
    min-width: 0;
    min-height: 58px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 4px;
    border-radius: 11px;
    background: var(--surface-soft);
    color: var(--muted);
    cursor: pointer;
    font-size: 10px;
    transition: color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.workflow-tabs button:hover {
    color: var(--primary-strong);
    transform: translateY(-1px);
}

.workflow-tabs button.selected {
    color: var(--primary-strong);
    box-shadow: var(--inset);
    font-weight: 700;
}

.workflow-tabs i {
    font-size: 19px;
}

.workflow-layout {
    display: grid;
    grid-template-columns: minmax(210px, .82fr) minmax(260px, 1.18fr);
    gap: 14px;
}

.workflow-input,
.workflow-output {
    min-width: 0;
    min-height: 310px;
    padding: 15px;
    border-radius: 14px;
    background: var(--surface-soft);
}

.workflow-form input:not([type="checkbox"]):not([type="hidden"]),
.workflow-form textarea,
.workflow-form select {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 0;
    border-radius: 10px;
    outline: 0;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--inset);
    font: inherit;
}

.workflow-form input:focus,
.workflow-form textarea:focus,
.workflow-form select:focus {
    outline: 3px solid rgba(109, 93, 252, .22);
    outline-offset: 2px;
}

.workflow-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.workflow-options label {
    display: inline-flex;
    min-height: 34px;
    flex-direction: row;
    align-items: center;
    gap: 7px;
    padding: 6px 9px;
    border-radius: 9px;
    background: var(--surface);
    color: var(--muted);
    box-shadow: var(--raised-small);
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
}

.workflow-options input {
    accent-color: var(--primary);
}

.workflow-hint {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.55;
}

.workflow-output {
    max-height: 440px;
    overflow: auto;
    box-shadow: var(--inset);
}

.workflow-empty {
    display: flex;
    min-height: 276px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: var(--muted);
    text-align: center;
}

.workflow-empty i {
    color: var(--primary);
    font-size: 30px;
}

.workflow-empty strong {
    color: var(--text);
}

.workflow-empty span {
    font-size: 11px;
}

.workflow-result-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 13px;
}

.workflow-result-head h3 {
    margin: 0;
    font-size: 17px;
}

.workflow-result-head span,
.workflow-meta {
    color: var(--muted);
    font-size: 10px;
}

.workflow-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.workflow-stat {
    min-width: 0;
    padding: 10px;
    border-radius: 10px;
    background: var(--surface);
}

.workflow-stat small,
.workflow-stat strong {
    display: block;
}

.workflow-stat small {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 9px;
}

.workflow-stat strong {
    overflow-wrap: anywhere;
    font-size: 13px;
}

.workflow-section {
    margin-top: 13px;
}

.workflow-section > strong {
    display: block;
    margin-bottom: 7px;
    font-size: 11px;
}

.workflow-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.workflow-chip {
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(109, 93, 252, .1);
    color: var(--primary-strong);
    font-size: 10px;
}

.workflow-record {
    margin-top: 8px;
    padding: 10px 11px;
    border-radius: 10px;
    background: var(--surface);
}

.workflow-record strong,
.workflow-record span,
.workflow-record small {
    display: block;
    overflow-wrap: anywhere;
}

.workflow-record strong {
    font-size: 12px;
}

.workflow-record span {
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.55;
}

.workflow-record small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
}

.workflow-result-pass {
    color: var(--mint);
}

.workflow-result-block {
    color: var(--danger);
}

.workflow-answer-toggle {
    margin-top: 8px;
    padding: 6px 9px;
    border-radius: 8px;
    background: rgba(109, 93, 252, .1);
    color: var(--primary-strong);
    cursor: pointer;
    font-size: 10px;
}

.workflow-meta {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

@media (max-width: 1180px) {
    .app {
        grid-template-columns: 240px minmax(0, 1fr);
    }

    .right {
        display: none;
    }
}

@media (max-width: 760px) {
    body.sidebar-open {
        overflow: hidden;
    }

    .app {
        display: block;
        padding: 12px;
    }

    .mobile-only {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        z-index: 30;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(84vw, 310px);
        min-height: 100vh;
        min-height: 100dvh;
        padding: 20px 18px;
        overflow-y: auto;
        border-right: 1px solid var(--line);
        background: var(--surface);
        box-shadow: 16px 0 35px rgba(48, 55, 66, 0.22);
        transform: translateX(-110%);
        transition: transform 200ms ease;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .close-sidebar {
        width: 34px;
        height: 34px;
        margin-left: auto;
    }

    .sidebar-backdrop {
        position: fixed;
        z-index: 20;
        inset: 0;
        background: rgba(35, 39, 47, 0.38);
        opacity: 0;
        pointer-events: none;
        transition: opacity 200ms ease;
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .topbar {
        margin-bottom: 12px;
    }

    .auth-button {
        min-height: 36px;
        padding: 0 12px;
    }

    .user-chip {
        max-width: 120px;
        min-height: 36px;
    }

    .welcome {
        min-height: 144px;
        grid-template-columns: minmax(0, 1fr) 92px;
        padding: 22px 23px;
        border-radius: 16px;
    }

    .welcome h1 {
        max-width: 78%;
        font-size: 21px;
    }

    .welcome p {
        max-width: 78%;
        font-size: 12px;
    }

    .welcome img {
        right: 14px;
        bottom: -39px;
        width: 94px;
        height: 148px;
    }

    .chat-card {
        min-height: calc(100dvh - 240px);
        margin-top: 13px;
        border-radius: 16px;
    }

    .chat-head {
        min-height: 68px;
        padding: 11px 15px;
    }

    .messages {
        padding: 17px 15px 18px;
    }

    .message-body {
        max-width: 82%;
    }

    .connection-notice,
    .chat-error {
        margin-right: 14px;
        margin-left: 14px;
    }

    .composer {
        margin: 0 14px 14px;
    }

    .footer-note {
        padding-bottom: 4px;
    }
}

@media (max-width: 430px) {
    .app {
        padding: 9px;
    }

    .crumb,
    #clearButton {
        display: none;
    }

    .top-actions {
        width: auto;
        flex: 1;
        justify-content: flex-end;
    }

    .auth-actions {
        gap: 7px;
    }

    .auth-button {
        padding: 0 11px;
        font-size: 12px;
    }

    .user-chip {
        max-width: 105px;
        padding: 0 9px;
        font-size: 12px;
    }

    .auth-dialog {
        padding: 20px 17px;
    }

    .welcome h1,
    .welcome p {
        max-width: 72%;
    }

    .welcome h1 {
        font-size: 19px;
    }

    .chat-person small {
        max-width: 175px;
    }

    .chat-head .online {
        font-size: 0;
    }

    .chat-head .online .dot {
        margin-right: 1px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
    }

    .message-body {
        max-width: 84%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .bubble.streaming::after {
        animation: none;
    }
}

@media (max-width: 560px) {
    .companion-dialog {
        max-height: calc(100dvh - 20px);
        padding: 18px;
    }

    .companion-form-row,
    .plugin-list {
        grid-template-columns: 1fr;
    }

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

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

    .workflow-input,
    .workflow-output {
        min-height: auto;
    }

    .growth-chart {
        gap: 4px;
    }
}

/* Feature center */
.composer-tool {
    display: inline-grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.composer-tool:hover,
.composer-tool.listening {
    background: rgba(109, 93, 252, .1);
    color: var(--primary-strong);
}

.feature-center-modal {
    position: fixed;
    z-index: 92;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 16px;
}

.feature-center-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(34, 39, 49, .48);
    cursor: default;
}

.feature-center-shell {
    position: relative;
    z-index: 1;
    display: flex;
    width: min(1120px, 100%);
    height: min(820px, calc(100dvh - 32px));
    flex-direction: column;
    overflow: hidden;
    border-radius: 18px;
    background: var(--surface);
}

.feature-center-head {
    display: flex;
    min-height: 94px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 25px 17px;
    border-bottom: 1px solid var(--line);
}

.feature-center-head h2 {
    margin: 3px 0 0;
    font-size: 22px;
}

.feature-center-head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.feature-center-head .icon-btn {
    width: 34px;
    height: 34px;
}

.feature-center-layout {
    display: grid;
    min-height: 0;
    flex: 1;
    grid-template-columns: 190px minmax(0, 1fr);
}

.feature-tabs {
    display: flex;
    min-height: 0;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    padding: 17px 12px;
    border-right: 1px solid var(--line);
}

.feature-tabs button {
    display: flex;
    min-height: 42px;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 13px;
    text-align: left;
}

.feature-tabs button i {
    width: 20px;
    font-size: 17px;
    text-align: center;
}

.feature-tabs button:hover,
.feature-tabs button.selected {
    background: rgba(109, 93, 252, .1);
    color: var(--primary-strong);
}

.feature-stage {
    min-height: 0;
    overflow-y: auto;
    padding: 24px 28px 34px;
}

.feature-panel {
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
}

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

.feature-section-head h3 {
    margin: 0;
    font-size: 17px;
}

.feature-section-head p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.65;
}

.feature-divider {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.status-badge {
    flex: 0 0 auto;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-style: normal;
    font-weight: 700;
}

.status-badge.available {
    background: rgba(85, 189, 178, .12);
    color: var(--mint);
}

.status-badge.pending {
    background: rgba(123, 132, 149, .12);
    color: var(--muted);
}

.segmented-control {
    display: flex;
    gap: 3px;
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
    padding: 4px;
    border-radius: 8px;
    background: var(--surface-soft);
}

.segmented-control button {
    min-width: 66px;
    min-height: 32px;
    padding: 0 11px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 11px;
    white-space: nowrap;
}

.segmented-control button.selected {
    background: var(--surface);
    color: var(--primary-strong);
    box-shadow: var(--raised-small);
}

.feature-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 55px;
    margin-top: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
}

.feature-switch-row strong,
.feature-switch-row small {
    display: block;
}

.feature-switch-row strong { font-size: 12px; }
.feature-switch-row small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.5; }

.inline-status {
    margin: 9px 2px 0;
    color: var(--muted);
    font-size: 10px;
}

.feature-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.feature-form label,
.appearance-editor label {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
}

.feature-form input:not([type="range"]),
.feature-form textarea,
.feature-form select,
.feature-panel > .feature-form-grid select,
.data-actions select,
.appearance-editor select {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    outline: 0;
    background: var(--surface-soft);
    color: var(--text);
    resize: vertical;
}

.feature-form input:focus,
.feature-form textarea:focus,
.feature-form select:focus,
.appearance-editor select:focus {
    border-color: var(--primary);
    outline: 2px solid rgba(109, 93, 252, .14);
}

.feature-form input[type="range"],
.appearance-editor input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

.feature-form output,
.appearance-editor output {
    color: var(--muted);
    font-size: 10px;
    font-weight: 400;
}

.feature-form-actions,
.data-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.feature-primary,
.feature-secondary,
.feature-danger {
    min-height: 37px;
    padding: 0 14px;
    border: 0;
    border-radius: 7px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
}

.feature-primary { background: var(--primary); color: #fff; }
.feature-secondary { background: var(--surface-soft); color: var(--text); box-shadow: var(--raised-small); }
.feature-danger { background: rgba(216, 79, 97, .1); color: var(--danger); }
.feature-primary:disabled,
.feature-secondary:disabled { opacity: .55; cursor: not-allowed; }

.feature-data-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-top: 16px;
}

.feature-data-item {
    display: flex;
    min-height: 54px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 11px;
    border-bottom: 1px solid var(--line);
}

.feature-data-item > div { min-width: 0; }
.feature-data-item strong,
.feature-data-item small { display: block; }
.feature-data-item strong { font-size: 12px; }
.feature-data-item p,
.feature-data-item small { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.feature-item-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.feature-item-actions button { min-height: 28px; padding: 0 7px; border: 0; border-radius: 6px; background: var(--surface-soft); color: var(--muted); cursor: pointer; font-size: 10px; }
.feature-item-actions button[data-danger] { color: var(--danger); }

.capability-list {
    display: flex;
    flex-direction: column;
}

.capability-row,
.capability-action {
    display: grid;
    min-height: 64px;
    align-items: center;
    gap: 12px;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    padding: 10px 4px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    text-align: left;
}

.capability-action { width: 100%; cursor: pointer; }
.capability-row > i,
.capability-action > i { color: var(--primary-strong); font-size: 21px; text-align: center; }
.capability-row strong,
.capability-row small,
.capability-action strong,
.capability-action small { display: block; }
.capability-row strong,
.capability-action strong { font-size: 12px; }
.capability-row small,
.capability-action small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.5; }

.data-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
}

.data-actions select { width: auto; min-width: 160px; }

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

.content-item {
    display: grid;
    min-height: 105px;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 13px;
    border-bottom: 1px solid var(--line);
}

.content-item > i { color: var(--primary-strong); font-size: 23px; }
.content-item strong,
.content-item small { display: block; }
.content-item strong { font-size: 12px; }
.content-item p,
.content-item small { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.content-item > button { align-self: start; padding: 4px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.content-item > button.is-favorite { color: var(--coral); }
.content-item .feature-secondary { min-height: 30px; margin-top: 8px; padding: 0 10px; }

.insight-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    margin-bottom: 18px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.insight-metrics > div { padding: 16px 10px; text-align: center; }
.insight-metrics strong,
.insight-metrics small { display: block; }
.insight-metrics strong { color: var(--primary-strong); font-size: 22px; }
.insight-metrics small { margin-top: 4px; color: var(--muted); font-size: 10px; }

.trend-chart {
    display: flex;
    min-height: 130px;
    align-items: flex-end;
    justify-content: space-around;
    gap: 7px;
    margin-bottom: 20px;
    padding: 12px 7px;
    border-bottom: 1px solid var(--line);
}

.trend-chart > div { display: flex; min-width: 26px; height: 105px; flex: 1; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px; color: var(--muted); font-size: 9px; }
.trend-chart i { display: block; width: min(24px, 75%); min-height: 5px; border-radius: 4px 4px 1px 1px; background: var(--mint); }

.device-status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.device-status-grid > div { min-width: 0; padding: 15px 9px; text-align: center; }
.device-status-grid i,
.device-status-grid strong,
.device-status-grid small { display: block; }
.device-status-grid i { margin-bottom: 8px; color: var(--primary-strong); font-size: 22px; }
.device-status-grid strong { font-size: 11px; }
.device-status-grid small { margin-top: 5px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.device-status-grid small.is-ready { color: var(--mint); }

.appearance-editor {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 13px 16px;
}

.appearance-unavailable {
    grid-column: 1 / -1;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}
.appearance-unavailable strong,
.appearance-unavailable small { display: block; }
.appearance-unavailable strong { font-size: 11px; }
.appearance-unavailable small { margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.55; }

.service-table { display: flex; flex-direction: column; }
.service-table > div { display: grid; min-height: 78px; align-items: center; gap: 14px; grid-template-columns: 38px minmax(0, 1fr) auto; border-bottom: 1px solid var(--line); }
.service-table i { color: var(--primary-strong); font-size: 23px; text-align: center; }
.service-table strong,
.service-table small { display: block; }
.service-table strong { font-size: 13px; }
.service-table small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.service-table em { color: var(--muted); font-size: 10px; font-style: normal; }

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

.service-offer {
    display: grid;
    min-height: 112px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 13px 4px;
    border-bottom: 1px solid var(--line);
}

.service-offer strong,
.service-offer small { display: block; }
.service-offer strong { font-size: 13px; }
.service-offer p,
.service-offer small { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.service-offer .price { color: var(--primary-strong); font-size: 13px; font-weight: 700; }
.service-offer .feature-secondary { align-self: end; grid-column: 1 / -1; justify-self: start; }

html[data-contrast="high"] {
    --text: #111827;
    --muted: #4b5563;
    --line: rgba(17, 24, 39, .28);
}

html[data-theme="dark"][data-contrast="high"] {
    --text: #fff;
    --muted: #d1d5db;
    --line: rgba(255, 255, 255, .26);
}

html { font-size: calc(16px * var(--font-scale, 1)); }
body { font-size: calc(14px * var(--font-scale, 1)); }

/* Most of the original theme uses pixel-sized type. These targeted rules make
   the accessibility selector visibly affect the actual reading surfaces. */
.message-content,
.composer textarea,
.sidebar,
.topbar,
.feature-panel,
.feature-panel input,
.feature-panel textarea,
.feature-panel select,
.feature-panel button,
.companion-modal,
.auth-modal {
    font-size: calc(1em * var(--font-scale, 1));
}

.feature-panel p,
.feature-panel small,
.feature-panel label,
.sidebar p,
.sidebar small {
    font-size: calc(11px * var(--font-scale, 1));
}

.feature-panel strong,
.feature-panel input,
.feature-panel textarea,
.feature-panel select,
.feature-panel button,
.message-content {
    font-size: calc(13px * var(--font-scale, 1));
}

.feature-panel h3 {
    font-size: calc(16px * var(--font-scale, 1));
}

.welcome img.yuan-customized {
    filter: var(--yuan-filter, none);
    opacity: var(--yuan-opacity, 1);
    transform: var(--yuan-transform, none);
    filter: var(--yuan-filter, none) drop-shadow(0 0 var(--yuan-shadow-size, 0) var(--yuan-rim-color, transparent));
}

@media (max-width: 820px) {
    .feature-center-modal { padding: 0; }
    .feature-center-shell { width: 100%; height: 100dvh; border-radius: 0; }
    .feature-center-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
    .feature-tabs { flex-direction: row; overflow-x: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
    .feature-tabs button { min-width: 96px; justify-content: center; padding: 0 9px; }
    .feature-stage { padding: 20px 18px 28px; }
    .appearance-editor { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .feature-center-head { min-height: 82px; padding: 16px; }
    .feature-center-head p { display: none; }
    .feature-stage { padding: 17px 14px 25px; }
    .feature-form-grid,
    .content-grid,
    .service-catalog,
    .appearance-editor { grid-template-columns: 1fr; }
    .device-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .insight-metrics { grid-template-columns: repeat(3, minmax(70px, 1fr)); overflow-x: auto; }
    .feature-section-head { align-items: center; }
    .data-actions { align-items: stretch; flex-direction: column; }
    .data-actions select { width: 100%; }
}

.chat-history-section {
    display: flex;
    min-height: 0;
    max-height: 300px;
    flex-direction: column;
    margin-top: 13px;
}

.chat-history-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 10px 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.history-refresh {
    display: inline-grid;
    width: 25px;
    height: 25px;
    place-items: center;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.history-refresh:hover { background: var(--surface-soft); color: var(--primary-strong); }

.chat-history-list {
    min-height: 42px;
    max-height: 260px;
    overflow-y: auto;
    padding: 2px 3px 6px;
}

.chat-history-empty {
    padding: 12px 8px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
    text-align: center;
}

.chat-history-item {
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
    margin: 2px 0;
    padding: 3px;
    border-radius: 9px;
}

.chat-history-item.active,
.chat-history-item:hover { background: var(--surface-soft); }

.chat-history-load {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    padding: 6px 7px;
    overflow: hidden;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.chat-history-load strong,
.chat-history-load span,
.chat-history-load small {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-history-load strong { font-size: 10px; }
.chat-history-load span,
.chat-history-load small { color: var(--muted); font-size: 9px; }

.chat-history-delete {
    flex: 0 0 auto;
    padding: 5px 6px;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 9px;
}

.chat-history-delete:hover { background: rgba(216, 79, 97, .1); color: var(--danger); }

.persona-market-toolbar { margin-bottom: 14px; }
.persona-tabs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.persona-tabs > button:not(.feature-primary) {
    min-height: 35px;
    padding: 0 13px;
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--muted);
    cursor: pointer;
    font-size: 11px;
}
.persona-tabs > button.selected:not(.feature-primary) { background: var(--primary); color: #fff; }
.persona-tabs .feature-primary { min-height: 35px; margin-left: auto; }
.persona-login-notice { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.persona-active-section { margin-bottom: 18px; padding: 14px; border-radius: 12px; background: var(--surface-soft); }
.persona-section-heading { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.persona-section-heading h3 { margin: 0; font-size: 13px; }
.persona-section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.persona-form input {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 0;
    border-radius: 10px;
    outline: 0;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--inset);
}
.persona-form input:focus { outline: 3px solid rgba(109, 93, 252, .22); outline-offset: 2px; }
.persona-form .feature-primary,
.persona-form .feature-secondary { min-height: 36px; }
.persona-voice-note { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.persona-editor { margin-bottom: 17px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.persona-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.persona-card { display: flex; min-width: 0; flex-direction: column; gap: 10px; padding: 14px; border-radius: 12px; background: var(--surface-soft); }
.persona-card-head { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 8px; }
.persona-card-head > div { min-width: 0; }
.persona-card-head strong { display: block; overflow-wrap: anywhere; font-size: 13px; }
.persona-card-head p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; overflow-wrap: anywhere; }
.persona-visibility { flex: 0 0 auto; padding: 3px 7px; border-radius: 6px; background: rgba(109, 93, 252, .1); color: var(--primary-strong); font-size: 9px; }
.persona-card-meta { color: var(--muted); font-size: 9px; line-height: 1.5; overflow-wrap: anywhere; }
.persona-card-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: auto; }
.persona-card-actions button { min-height: 31px; padding: 0 10px; font-size: 10px; }
.persona-card-actions small { color: var(--muted); font-size: 10px; }

@media (max-width: 560px) {
    .persona-list { grid-template-columns: 1fr; }
    .chat-history-section { max-height: 250px; }
    .chat-history-list { max-height: 210px; }
}

/* AI workbench shell */
:root {
    --workbench-cyan: #2aa8bd;
    --workbench-cyan-soft: #e8f7fa;
    --workbench-indigo: #5969d9;
    --workbench-panel: rgba(255, 255, 255, .72);
}

html[data-theme="dark"] {
    --workbench-cyan: #61c9d7;
    --workbench-cyan-soft: rgba(97, 201, 215, .12);
    --workbench-indigo: #8e9aff;
    --workbench-panel: rgba(39, 47, 58, .82);
}

.app {
    width: 100%;
    max-width: none;
    grid-template-columns: 332px minmax(520px, 1fr) 278px;
    gap: 18px;
    margin: 0;
    padding: 0 20px 20px 0;
}

.sidebar {
    position: sticky;
    top: 0;
    display: grid;
    min-height: 100vh;
    min-height: 100dvh;
    grid-template-columns: 72px 260px;
    padding: 0;
    overflow: hidden;
    border-right: 1px solid var(--line);
    background: var(--workbench-panel);
    box-shadow: none;
    backdrop-filter: blur(16px);
}

.module-rail {
    display: flex;
    min-width: 0;
    align-items: center;
    flex-direction: column;
    gap: 8px;
    padding: 16px 8px;
    border-right: 1px solid var(--line);
    background: rgba(89, 105, 217, .045);
}

.rail-brand {
    display: inline-flex;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    margin-bottom: 13px;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.rail-brand img {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
}

.module-nav {
    display: flex;
    width: 58px;
    min-height: 62px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 11px;
    transition: background-color 160ms ease, color 160ms ease;
}

.module-nav i { font-size: 23px; }
.module-nav:hover { background: var(--workbench-cyan-soft); color: var(--workbench-cyan); }
.module-nav.active { background: var(--workbench-cyan-soft); color: var(--workbench-cyan); font-weight: 700; }
.module-nav:disabled { cursor: not-allowed; opacity: .38; }

.secondary-sidebar {
    display: flex;
    min-width: 0;
    min-height: 100dvh;
    max-height: 100dvh;
    flex-direction: column;
    padding: 16px 14px 14px;
    overflow-y: auto;
}

.secondary-sidebar .brand {
    min-height: 54px;
    padding: 4px 8px 14px;
}

.secondary-sidebar .brand > span { margin-left: 0; }
.secondary-sidebar .brand strong { font-size: 18px; }
.secondary-sidebar .brand small { font-size: 11px; }

.secondary-panel {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
}

.secondary-panel[hidden] { display: none; }

.secondary-sidebar .new-chat {
    min-height: 46px;
    border-radius: 6px;
    background: var(--workbench-cyan);
    box-shadow: none;
    color: #fff;
}

.secondary-sidebar .new-chat:hover { background: #218fa2; color: #fff; }

.secondary-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.secondary-section.no-border { margin-top: 3px; padding-top: 0; border-top: 0; }
.secondary-label { display: block; margin: 0 7px 9px; color: var(--muted); font-size: 11px; font-weight: 700; }

.secondary-action,
.template-action,
.secondary-primary {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    gap: 10px;
    margin: 3px 0;
    padding: 8px 10px;
    border-radius: 7px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.secondary-action:hover,
.template-action:hover,
.template-action.selected { background: var(--surface-soft); color: var(--workbench-cyan); }
.secondary-action i,
.template-action i,
.secondary-primary i { width: 22px; flex: 0 0 auto; font-size: 19px; text-align: center; }
.template-action > span { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.template-action strong { font-size: 12px; }
.template-action small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.secondary-primary {
    justify-content: center;
    margin-top: 14px;
    background: var(--workbench-cyan);
    color: #fff;
    font-weight: 700;
}

.active-role-summary {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-top: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.active-role-summary img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; }
.active-role-summary > div { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.active-role-summary strong,
.active-role-summary small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.active-role-summary small,
.secondary-note { color: var(--muted); font-size: 10px; line-height: 1.6; }
.secondary-note { margin: 12px 3px 0; }

.side-capability-status {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 15px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: 11px;
}
.side-capability-status[data-state="offline"] .dot { background: var(--coral); }

.secondary-sidebar .side-card {
    margin-top: auto;
    padding: 13px 10px 2px;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.secondary-sidebar .side-card h2 { margin-bottom: 10px; font-size: 12px; }
.secondary-sidebar .side-card p { margin-top: 9px; font-size: 10px; line-height: 1.55; }

.secondary-sidebar .chat-history-section {
    max-height: none;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
.secondary-sidebar .chat-history-list { max-height: 36vh; }
.secondary-sidebar .chat-history-item { border-radius: 6px; }
.secondary-sidebar .chat-history-load strong { font-size: 11px; }

.main { min-height: 100dvh; padding: 18px 0 0; }
.topbar { min-height: 42px; margin-bottom: 10px; }

.channel-bar {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.channel-bar-label { flex: 0 0 auto; color: var(--muted); font-size: 11px; font-weight: 700; }
.channel-strip {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 2px;
    overflow-x: auto;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--workbench-panel);
    scrollbar-width: none;
}
.channel-strip::-webkit-scrollbar { display: none; }
.channel-strip button {
    min-height: 34px;
    flex: 0 0 auto;
    padding: 0 15px;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}
.channel-strip button:hover { background: var(--surface-soft); color: var(--text); }
.channel-strip button.selected { background: var(--workbench-cyan-soft); color: var(--workbench-cyan); font-weight: 700; }
.channel-strip button:disabled { cursor: not-allowed; opacity: .46; }
.channel-loading { padding: 8px 12px; color: var(--muted); font-size: 11px; white-space: nowrap; }

.workspace-view { min-width: 0; }
.workspace-chat-shell { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; }
.workspace-chat-shell[hidden] { display: none; }
.workspace-chat-shell .welcome { display: none; }

.workspace-chat-shell .chat-card {
    min-height: calc(100dvh - 126px);
    margin-top: 0;
    border-radius: 8px;
    background: var(--workbench-panel);
    box-shadow: none;
}
.workspace-chat-shell .chat-head { min-height: 62px; }
.workspace-chat-shell .composer { border: 1px solid rgba(42, 168, 189, .52); border-radius: 8px; background: var(--surface); box-shadow: 0 9px 26px rgba(54, 72, 92, .09); }
.workspace-chat-shell .send { border-radius: 7px; background: var(--workbench-cyan); box-shadow: none; }
.workspace-chat-shell .message.user .bubble { background: var(--workbench-cyan); box-shadow: none; }

.chat-empty { width: min(88%, 650px); transform: translate(-50%, -52%); }
.chat-empty > i { box-shadow: none; background: var(--workbench-cyan-soft); color: var(--workbench-cyan); }
.chat-empty strong { font-size: 18px; }
.prompt-suggestions { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 20px; }
.prompt-suggestions button {
    min-height: 44px;
    padding: 9px 12px;
    overflow-wrap: anywhere;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface-soft);
    color: var(--text);
    cursor: pointer;
    font-size: 11px;
    text-align: left;
}
.prompt-suggestions button:hover { border-color: rgba(42, 168, 189, .45); color: var(--workbench-cyan); }
.footer-note { padding-top: 9px; }

.drawing-workspace,
.plugin-workspace {
    min-height: calc(100dvh - 126px);
    padding: 24px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--workbench-panel);
}

.workspace-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.workspace-section-head .eyebrow { color: var(--workbench-cyan); font-size: 11px; font-weight: 700; }
.workspace-section-head h1 { margin: 5px 0 4px; font-size: 21px; }
.workspace-section-head p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

.drawing-layout { display: grid; min-width: 0; grid-template-columns: minmax(390px, .86fr) minmax(360px, 1.14fr); gap: 22px; }
.drawing-controls,
.drawing-result { min-width: 0; }
.drawing-controls fieldset { min-width: 0; margin: 0 0 20px; padding: 0; border: 0; }
.drawing-controls legend,
.drawing-prompt-label { display: block; margin-bottom: 10px; font-size: 12px; font-weight: 700; }

.image-style-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.image-style-grid button {
    min-width: 0;
    padding: 5px 5px 8px;
    border: 2px solid transparent;
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text);
    cursor: pointer;
}
.image-style-grid button.selected { border-color: var(--workbench-cyan); }
.image-style-grid strong { display: block; margin-top: 6px; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.style-preview { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 5px; background: #d9e3ea; }
.style-preview img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; transform: scale(1.35); }
.style-anime img { filter: saturate(1.35) contrast(1.08) brightness(1.08); }
.style-sketch img { filter: grayscale(1) contrast(1.4) brightness(1.12); }
.style-poster img { filter: hue-rotate(182deg) saturate(1.55) brightness(.7) contrast(1.2); }
.style-watercolor img { filter: saturate(.8) brightness(1.14) contrast(.86); }
.style-pixel img { filter: saturate(1.7) contrast(1.3); image-rendering: pixelated; }

.ratio-control { display: flex; min-width: 0; gap: 8px; overflow-x: auto; }
.ratio-control button { display: flex; min-width: 64px; height: 62px; align-items: center; justify-content: center; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); color: var(--muted); cursor: pointer; font-size: 10px; }
.ratio-control button.selected { border-color: var(--workbench-cyan); color: var(--workbench-cyan); }
.ratio-shape { display: block; border-radius: 2px; background: currentColor; opacity: .5; }
.ratio-square { width: 24px; height: 24px; }
.ratio-landscape { width: 31px; height: 23px; }
.ratio-portrait { width: 23px; height: 31px; }
.ratio-wide { width: 35px; height: 20px; }
.ratio-tall { width: 19px; height: 34px; }

#imagePrompt { width: 100%; min-height: 114px; resize: vertical; padding: 12px; border: 1px solid var(--line); border-radius: 8px; outline: 0; background: var(--surface); color: var(--text); line-height: 1.65; }
#imagePrompt:focus { border-color: var(--workbench-cyan); box-shadow: 0 0 0 3px rgba(42, 168, 189, .12); }
.drawing-submit-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.drawing-submit-row .form-status { min-width: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.drawing-submit-row .feature-primary { display: inline-flex; min-width: 112px; align-items: center; justify-content: center; gap: 7px; }

.drawing-result { display: flex; min-height: 480px; align-items: center; justify-content: center; overflow: hidden; border: 1px dashed rgba(42, 168, 189, .4); border-radius: 8px; background: var(--surface-soft); }
.drawing-result-empty { display: flex; max-width: 280px; align-items: center; flex-direction: column; color: var(--muted); text-align: center; }
.drawing-result-empty i { margin-bottom: 13px; color: var(--workbench-cyan); font-size: 40px; }
.drawing-result-empty strong { color: var(--text); font-size: 13px; }
.drawing-result-empty span { margin-top: 7px; font-size: 10px; line-height: 1.6; }
.drawing-result > img { display: block; max-width: 100%; max-height: calc(100dvh - 230px); object-fit: contain; }

.plugin-workspace-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.plugin-workspace-grid button { display: flex; min-width: 0; min-height: 104px; align-items: center; gap: 14px; padding: 17px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); color: var(--text); cursor: pointer; text-align: left; }
.plugin-workspace-grid button:hover { border-color: rgba(42, 168, 189, .42); color: var(--workbench-cyan); }
.plugin-workspace-grid button > i { width: 42px; flex: 0 0 auto; color: var(--workbench-cyan); font-size: 32px; text-align: center; }
.plugin-workspace-grid button > span { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.plugin-workspace-grid strong { font-size: 13px; }
.plugin-workspace-grid small { color: var(--muted); font-size: 10px; line-height: 1.55; }

@media (max-width: 1440px) {
    .app { grid-template-columns: 332px minmax(0, 1fr); }
    .right { display: none; }
}

@media (max-width: 1080px) {
    .drawing-layout { grid-template-columns: 1fr; }
    .drawing-result { min-height: 380px; }
    .plugin-workspace-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .app { display: block; min-height: 100dvh; padding: 0 0 calc(68px + env(safe-area-inset-bottom)); }
    .main { min-height: calc(100dvh - 68px); padding: 10px; }
    .sidebar { position: static; display: block; width: auto; min-height: 0; padding: 0; overflow: visible; border: 0; background: transparent; box-shadow: none; transform: none; }
    .module-rail { position: fixed; z-index: 40; right: 0; bottom: 0; left: 0; display: flex; width: auto; height: calc(64px + env(safe-area-inset-bottom)); align-items: flex-start; justify-content: space-around; flex-direction: row; gap: 0; padding: 4px 6px env(safe-area-inset-bottom); border-top: 1px solid var(--line); border-right: 0; background: var(--surface); box-shadow: 0 -8px 24px rgba(45, 57, 75, .1); }
    .rail-brand { display: none; }
    .module-nav { width: 20%; min-height: 55px; border-radius: 7px; }
    .module-nav i { font-size: 21px; }
    .secondary-sidebar { position: fixed; z-index: 35; top: 0; bottom: calc(64px + env(safe-area-inset-bottom)); left: 0; width: min(86vw, 320px); min-height: 0; max-height: none; padding: 16px 14px; border-right: 1px solid var(--line); background: var(--surface); box-shadow: 15px 0 34px rgba(40, 50, 66, .2); transform: translateX(-110%); transition: transform 200ms ease; }
    body.sidebar-open .secondary-sidebar { transform: translateX(0); }
    .channel-bar { margin-bottom: 9px; }
    .channel-bar-label { display: none; }
    .channel-strip { width: 100%; }
    .workspace-chat-shell .chat-card { min-height: calc(100dvh - 142px); }
    .drawing-workspace,
    .plugin-workspace { min-height: calc(100dvh - 142px); padding: 17px; }
    .drawing-result { min-height: 310px; }
}

@media (max-width: 560px) {
    .topbar { margin-bottom: 8px; }
    .crumb { display: none; }
    .channel-strip button { padding: 0 12px; font-size: 11px; }
    .chat-empty { width: 92%; transform: translate(-50%, -50%); }
    .chat-empty strong { font-size: 15px; }
    .prompt-suggestions { grid-template-columns: 1fr; gap: 6px; margin-top: 14px; }
    .prompt-suggestions button { min-height: 38px; padding: 7px 10px; }
    .image-style-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .workspace-section-head { margin-bottom: 17px; }
    .workspace-section-head h1 { font-size: 18px; }
    .drawing-layout { display: block; }
    .drawing-result { min-height: 270px; margin-top: 18px; }
    .drawing-submit-row { align-items: stretch; flex-direction: column; }
    .plugin-workspace-grid { grid-template-columns: 1fr; }
    .plugin-workspace-grid button { min-height: 84px; }
}
