:root {
    color-scheme: light;
    --navy-950: #03172b;
    --navy-900: #041d36;
    --navy-850: #082641;
    --navy-800: #0c2d49;
    --cyan-600: #009ab1;
    --cyan-500: #0eb5c9;
    --cyan-400: #31cee0;
    --ink-950: #071b33;
    --ink-800: #20334a;
    --ink-600: #55677d;
    --ink-500: #728197;
    --surface: #ffffff;
    --canvas: #fafbfd;
    --surface-muted: #f3f6f9;
    --border: #d8e0e8;
    --border-strong: #c8d2dd;
    --success: #2eb875;
    --danger: #ce4560;
    --shadow-sm: 0 4px 14px rgba(6, 28, 50, 0.07);
    --shadow-md: 0 18px 55px rgba(6, 28, 50, 0.14);
    --sidebar-width: 306px;
    --topbar-height: 92px;
    --radius-sm: 9px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --ease: cubic-bezier(.2, .75, .25, 1);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-width: 320px;
    min-height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
    color: var(--ink-950);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
}

button,
input,
textarea {
    font: inherit;
}

button {
    color: inherit;
}

button,
[role="button"] {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(14, 181, 201, 0.25);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

.svg-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.boot-screen,
.auth-screen {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    background: var(--navy-950);
}

.boot-screen {
    gap: 16px;
    align-content: center;
    color: #c7d4df;
    font-size: 14px;
    letter-spacing: .02em;
}

.boot-screen img {
    animation: breathe 1.7s ease-in-out infinite;
}

@keyframes breathe {
    50% { opacity: .58; transform: scale(.96); }
}

.auth-screen {
    padding: 24px;
    background: var(--navy-950);
}

.auth-card {
    width: min(100%, 440px);
    padding: 38px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .28);
}

.auth-brand,
.brand {
    display: flex;
    align-items: center;
}

.auth-brand {
    gap: 12px;
    margin-bottom: 34px;
    color: var(--ink-950);
    font-size: 17px;
    font-weight: 800;
    letter-spacing: .1em;
}

.auth-card h1 {
    margin: 0 0 10px;
    font-size: clamp(28px, 5vw, 36px);
    line-height: 1.15;
    letter-spacing: -.035em;
}

.auth-card > p {
    margin: 0 0 26px;
    color: var(--ink-600);
    line-height: 1.55;
}

.auth-card form,
.modal form {
    display: grid;
    gap: 10px;
}

.auth-card label,
.modal label {
    color: var(--ink-800);
    font-size: 13px;
    font-weight: 700;
}

.auth-card input,
.modal input,
.drawer-search {
    width: 100%;
    min-height: 46px;
    padding: 0 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--ink-950);
    background: #fff;
    font-size: 15px;
}

.primary-button,
.secondary-button {
    min-height: 46px;
    padding: 0 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.primary-button {
    border: 1px solid var(--cyan-600);
    color: #fff;
    background: var(--cyan-600);
}

.primary-button:hover {
    background: #00869c;
}

.primary-button:active,
.secondary-button:active {
    transform: translateY(1px);
}

.secondary-button {
    border: 1px solid var(--border-strong);
    color: var(--ink-800);
    background: #fff;
}

.setup-help {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #f0c8a5;
    border-radius: var(--radius-sm);
    color: #6f3d17;
    background: #fff8f1;
    font-size: 13px;
    line-height: 1.55;
}

.setup-help p {
    margin: 7px 0 0;
}

.setup-help code {
    font-size: 12px;
}

.form-error {
    min-height: 20px;
    margin: 14px 0 0 !important;
    color: var(--danger) !important;
    font-size: 13px;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.sidebar {
    position: relative;
    z-index: 30;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 24px 18px 18px;
    color: #fff;
    background: var(--navy-950);
}

.brand {
    gap: 13px;
    height: 58px;
    padding: 0 10px;
    font-size: 26px;
    font-weight: 850;
    letter-spacing: .055em;
}

.brand img {
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
}

.nav-list {
    display: grid;
    gap: 7px;
    margin-top: 28px;
}

.nav-item {
    position: relative;
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 13px;
    width: 100%;
    min-height: 72px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #d6e0e9;
    background: transparent;
    font-size: 16px;
    font-weight: 620;
    text-align: left;
    cursor: pointer;
    transition: color .18s ease, background .18s ease, border-color .18s ease;
}

.nav-item svg {
    width: 25px;
    height: 25px;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, .065);
}

.nav-item.is-active {
    color: var(--cyan-400);
    background: rgba(51, 121, 162, .18);
    border-color: rgba(104, 181, 214, .07);
}

.nav-count {
    min-width: 25px;
    padding: 3px 6px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 7px;
    color: #9fb2c3;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.sidebar-spacer {
    flex: 1;
    min-height: 24px;
}

.moderator-button {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 22px;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 72px;
    padding: 14px 10px 5px;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, .16);
    color: #fff;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.avatar {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 2px solid var(--cyan-400);
    border-radius: 50%;
    color: var(--cyan-400);
}

.avatar svg {
    width: 22px;
    height: 22px;
}

.moderator-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.moderator-copy small {
    color: #8fa4b7;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.moderator-copy strong {
    overflow: hidden;
    font-size: 14px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chevron {
    width: 18px;
    height: 18px;
    color: #a8b8c7;
}

.moderator-menu {
    position: absolute;
    right: 18px;
    bottom: 88px;
    left: 18px;
    z-index: 5;
    display: grid;
    gap: 4px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: var(--radius-md);
    background: var(--navy-850);
    box-shadow: 0 16px 42px rgba(0, 0, 0, .3);
}

.moderator-menu button {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    padding: 0 11px;
    border: 0;
    border-radius: 8px;
    color: #dce5ed;
    background: transparent;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.moderator-menu button:hover {
    background: rgba(255, 255, 255, .08);
}

.moderator-menu svg {
    width: 18px;
    height: 18px;
}

.workspace {
    display: grid;
    grid-template-rows: var(--topbar-height) minmax(0, 1fr) auto;
    min-width: 0;
    min-height: 0;
    background: var(--canvas);
}

.topbar {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 32px 0 36px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, .96);
}

.topbar-title {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.topbar-title strong {
    font-size: 28px;
    font-weight: 780;
    letter-spacing: -.025em;
}

.topbar-title span {
    color: var(--ink-500);
    font-size: 12px;
}

.model-status {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-left: auto;
    color: var(--ink-600);
    font-size: 16px;
    font-weight: 600;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(46, 184, 117, .1);
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 10px;
    color: var(--ink-600);
    background: transparent;
    cursor: pointer;
    transition: color .18s ease, border-color .18s ease, background .18s ease;
}

.icon-button:hover {
    color: var(--ink-950);
    border-color: var(--border);
    background: var(--surface-muted);
}

.mobile-menu-button {
    display: none;
}

.chat-main {
    position: relative;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.empty-state {
    display: grid;
    justify-items: center;
    align-content: center;
    min-height: 100%;
    padding: 44px 28px 256px;
    text-align: center;
}

.empty-icon {
    display: grid;
    place-items: center;
    width: 150px;
    height: 150px;
    margin-bottom: 18px;
    border-radius: 50%;
    color: #8b9cb0;
    background: #f0f3f7;
}

.empty-icon svg {
    width: 72px;
    height: 72px;
    stroke-width: 1.6;
}

.empty-state h1 {
    margin: 0;
    color: var(--ink-950);
    font-size: clamp(30px, 3vw, 38px);
    line-height: 1.15;
    letter-spacing: -.04em;
}

.empty-state > p {
    max-width: 610px;
    margin: 14px auto 0;
    color: var(--ink-600);
    font-size: 17px;
    line-height: 1.65;
}

.starter-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-top: 40px;
}

.starter-actions button {
    display: grid;
    grid-template-columns: 32px auto;
    align-items: center;
    gap: 12px;
    min-width: 224px;
    min-height: 90px;
    padding: 14px 20px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    color: var(--ink-950);
    background: #fff;
    font-size: 15px;
    font-weight: 650;
    line-height: 1.45;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 1px 0 rgba(8, 30, 52, .02);
    transition: border-color .2s ease, color .2s ease, transform .2s var(--ease), box-shadow .2s ease;
}

.starter-actions button:hover {
    border-color: var(--cyan-500);
    color: var(--cyan-600);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.starter-actions svg {
    width: 30px;
    height: 30px;
    color: var(--cyan-600);
}

.message-list {
    width: min(100%, 900px);
    min-height: 100%;
    margin: 0 auto;
    padding: 34px 32px 28px;
}

.message {
    display: grid;
    gap: 10px;
    margin-bottom: 28px;
    animation: message-in .3s var(--ease) both;
}

@keyframes message-in {
    from { opacity: 0; transform: translateY(6px); }
}

.message-header {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--ink-500);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .025em;
    text-transform: uppercase;
}

.message-header-icon {
    display: grid;
    place-items: center;
    width: 27px;
    height: 27px;
    border-radius: 8px;
    color: var(--ink-600);
    background: var(--surface-muted);
}

.message-header-icon svg {
    width: 16px;
    height: 16px;
}

.message.assistant .message-header-icon {
    color: #fff;
    background: var(--cyan-600);
}

.message-bubble {
    position: relative;
    max-width: 780px;
    padding: 17px 19px;
    border: 1px solid var(--border);
    border-radius: 5px 14px 14px 14px;
    color: var(--ink-800);
    background: #fff;
    font-size: 15px;
    line-height: 1.68;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.message.user {
    justify-items: end;
}

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

.message.user .message-bubble {
    border-color: #b9e2e8;
    border-radius: 14px 5px 14px 14px;
    background: #effaFB;
}

.token-usage {
    margin-top: 13px;
    padding-top: 9px;
    border-top: 1px solid var(--border);
    color: var(--ink-500);
    font-size: 11px;
    line-height: 1.45;
    white-space: normal;
}

.message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.message-attachments button {
    width: 90px;
    height: 66px;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: zoom-in;
}

.message-attachments img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-attachment-summary {
    color: var(--ink-500);
    font-size: 12px;
}

.message-actions {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
    margin-top: -3px;
}

.copy-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--ink-500);
    background: transparent;
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
}

.copy-button:hover {
    border-color: var(--border);
    color: var(--ink-800);
    background: #fff;
}

.copy-button svg {
    width: 15px;
    height: 15px;
}

.typing {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 68px;
}

.typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ink-500);
    animation: typing 1.1s infinite ease-in-out;
}

.typing span:nth-child(2) { animation-delay: .14s; }
.typing span:nth-child(3) { animation-delay: .28s; }

@keyframes typing {
    0%, 65%, 100% { opacity: .35; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

.composer-region {
    position: relative;
    z-index: 9;
    padding: 12px 30px 15px;
    border-top: 1px solid rgba(216, 224, 232, .7);
    background: rgba(250, 251, 253, .96);
}

.composer {
    width: min(100%, 1080px);
    margin: 0 auto;
    padding: 13px 15px 11px 18px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: #fff;
    box-shadow: 0 7px 28px rgba(6, 28, 50, .055);
    transition: border-color .18s ease, box-shadow .18s ease;
}

.composer:focus-within,
.composer.is-dragging {
    border-color: var(--cyan-500);
    box-shadow: 0 0 0 3px rgba(14, 181, 201, .1), 0 8px 32px rgba(6, 28, 50, .07);
}

.composer textarea {
    display: block;
    width: 100%;
    max-height: 180px;
    min-height: 38px;
    padding: 7px 4px;
    resize: none;
    overflow-y: auto;
    border: 0;
    outline: 0;
    color: var(--ink-950);
    background: transparent;
    font-size: 15px;
    line-height: 1.55;
}

.composer textarea::placeholder {
    color: #8996a8;
}

.composer-actions {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
}

.composer-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.attach-button {
    width: 38px;
    height: 38px;
}

.attachment-hint {
    color: var(--ink-500);
    font-size: 11px;
}

.send-options {
    display: flex;
    align-items: center;
    gap: 8px;
}

.batch-send-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 13px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    color: var(--ink-700);
    background: #fff;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, opacity .18s ease;
}

.batch-send-button:hover {
    border-color: #8fcfd8;
    background: #f2fbfc;
}

.batch-send-button:disabled {
    cursor: not-allowed;
    opacity: .48;
}

.batch-send-button svg {
    width: 17px;
    height: 17px;
}

.send-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-width: 108px;
    height: 42px;
    padding: 0 15px;
    border: 1px solid var(--cyan-600);
    border-radius: 10px;
    color: #fff;
    background: var(--cyan-600);
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
    transition: background .18s ease, transform .18s ease, opacity .18s ease;
}

.send-button:hover {
    background: #00899f;
}

.send-button:active {
    transform: translateY(1px);
}

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

.send-button svg {
    width: 18px;
    height: 18px;
}

.attachment-list {
    display: flex;
    gap: 10px;
    padding: 3px 0 12px;
    overflow-x: auto;
}

.attachment-card {
    position: relative;
    flex: 0 0 160px;
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    height: 64px;
    padding: 5px 30px 5px 5px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-muted);
}

.attachment-card img {
    width: 54px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    cursor: zoom-in;
}

.attachment-copy {
    min-width: 0;
}

.attachment-copy strong,
.attachment-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-copy strong {
    font-size: 11px;
    font-weight: 700;
}

.attachment-copy small {
    margin-top: 4px;
    color: var(--ink-500);
    font-size: 10px;
}

.remove-attachment {
    position: absolute;
    top: 5px;
    right: 5px;
    display: grid;
    place-items: center;
    width: 23px;
    height: 23px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    color: var(--ink-600);
    background: #fff;
    cursor: pointer;
}

.remove-attachment svg {
    width: 14px;
    height: 14px;
}

.review-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 9px 0 0;
    color: var(--ink-500);
    font-size: 11px;
}

.review-notice svg {
    width: 15px;
    height: 15px;
}

.utility-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    width: min(390px, calc(100vw - 24px));
    border-left: 1px solid var(--border);
    background: #fff;
    box-shadow: -24px 0 70px rgba(6, 28, 50, .12);
    animation: drawer-in .25s var(--ease) both;
}

@keyframes drawer-in {
    from { transform: translateX(18px); opacity: 0; }
}

.drawer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    min-height: 92px;
    padding: 24px 20px 18px 24px;
    border-bottom: 1px solid var(--border);
}

.drawer-header h2 {
    margin: 0;
    font-size: 21px;
    letter-spacing: -.025em;
}

.drawer-header p {
    margin: 5px 0 0;
    color: var(--ink-500);
    font-size: 12px;
}

.drawer-content {
    min-height: 0;
    padding: 17px;
    overflow-y: auto;
}

.drawer-search {
    position: sticky;
    top: 0;
    z-index: 2;
    margin-bottom: 13px;
    background: #fff;
}

.history-list,
.knowledge-list,
.batch-list {
    display: grid;
    gap: 8px;
}

.batch-toolbar {
    display: grid;
    gap: 10px;
    margin-bottom: 13px;
    padding: 12px;
    border: 1px solid #c9e8ec;
    border-radius: 10px;
    background: #f5fbfc;
}

.batch-toolbar p {
    margin: 0;
    color: var(--ink-600);
    font-size: 11px;
    line-height: 1.5;
}

.batch-queue-panel {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
    padding: 13px;
    border: 1px solid #9fdce4;
    border-radius: 12px;
    background: #eef9fb;
}

.batch-queue-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.batch-queue-header h3,
.batch-history-title {
    margin: 0;
    color: var(--ink-800);
    font-size: 12px;
}

.batch-queue-header p,
.batch-queue-empty,
.batch-history-empty {
    margin: 4px 0 0;
    color: var(--ink-500);
    font-size: 10px;
    line-height: 1.45;
}

.batch-queue-header > strong {
    flex: 0 0 auto;
    padding: 4px 8px;
    border-radius: 999px;
    color: #08788a;
    background: #d5f2f6;
    font-size: 10px;
}

.batch-queue-list {
    max-height: 390px;
    overflow-y: auto;
}

.batch-submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: var(--cyan-600);
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.batch-submit-button:hover:not(:disabled) {
    background: var(--navy-800);
}

.batch-submit-button:disabled {
    cursor: not-allowed;
    opacity: .5;
}

.batch-submit-button svg {
    width: 14px;
    height: 14px;
}

.batch-history-title {
    margin: 0 0 9px;
}

.batch-history-empty {
    margin: 0 0 12px;
    padding: 13px;
    border: 1px dashed var(--border);
    border-radius: 10px;
    text-align: center;
}

.batch-refresh-button,
.batch-copy-button,
.batch-open-button,
.batch-remove-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 34px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--ink-700);
    background: #fff;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.batch-refresh-button:disabled,
.batch-remove-button:disabled {
    cursor: wait;
    opacity: .55;
}

.batch-refresh-button svg,
.batch-copy-button svg,
.batch-open-button svg,
.batch-remove-button svg {
    width: 14px;
    height: 14px;
}

.batch-job {
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #fff;
}

.batch-job-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.batch-job-header strong {
    min-width: 0;
    color: var(--ink-850);
    font-size: 12px;
    line-height: 1.4;
}

.batch-job > small {
    display: block;
    margin-top: 6px;
    color: var(--ink-500);
    font-size: 10px;
}

.batch-status {
    flex: 0 0 auto;
    padding: 3px 7px;
    border-radius: 999px;
    color: #5e4b13;
    background: #fff3c4;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.batch-status.status-completed {
    color: #14603b;
    background: #dcf7e9;
}

.batch-status.status-queued {
    color: #08788a;
    background: #d5f2f6;
}

.batch-status.status-failed,
.batch-status.status-expired,
.batch-status.status-cancelled {
    color: #8a2b2b;
    background: #fde7e7;
}

.batch-answer {
    max-height: 330px;
    margin-top: 12px;
    padding: 11px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--ink-800);
    background: var(--surface-muted);
    font-size: 12px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.batch-job .token-usage {
    margin-top: 9px;
}

.batch-result-actions {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    gap: 8px;
    margin-top: 9px;
}

.batch-copy-button,
.batch-open-button {
    width: 100%;
}

.batch-open-button {
    color: #fff;
    border-color: var(--cyan-600);
    background: var(--cyan-600);
}

.batch-remove-button {
    width: 100%;
    margin-top: 9px;
    color: #8a2b2b;
    border-color: #efcaca;
}

.batch-clear-button {
    margin-top: 14px;
}

.batch-clear-button:disabled {
    cursor: wait;
    opacity: .55;
}

.batch-waiting,
.batch-error {
    margin: 10px 0 0;
    font-size: 11px;
    line-height: 1.45;
}

.batch-waiting { color: var(--ink-500); }
.batch-error { color: #9b3434; }

.history-item,
.knowledge-item {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--ink-800);
    background: #fff;
    text-align: left;
}

button.history-item,
button.knowledge-item {
    cursor: pointer;
}

button.history-item:hover,
button.knowledge-item:hover {
    border-color: #acdbe1;
    background: #f5fbfc;
}

.history-item strong,
.knowledge-item strong {
    display: block;
    overflow: hidden;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item small,
.knowledge-item small {
    display: block;
    margin-top: 5px;
    color: var(--ink-500);
    font-size: 11px;
}

.empty-drawer {
    display: grid;
    justify-items: center;
    padding: 50px 18px;
    color: var(--ink-500);
    text-align: center;
}

.empty-drawer svg {
    width: 34px;
    height: 34px;
    margin-bottom: 13px;
}

.empty-drawer p {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
}

.drawer-footer-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 42px;
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--ink-600);
    background: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.drawer-footer-action svg {
    width: 16px;
    height: 16px;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    border: 0;
    background: rgba(2, 18, 34, .48);
    backdrop-filter: blur(2px);
}

.modal,
.image-dialog {
    width: min(calc(100% - 32px), 480px);
    padding: 0;
    overflow: visible;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--ink-950);
    background: #fff;
    box-shadow: var(--shadow-md);
}

.modal::backdrop,
.image-dialog::backdrop {
    background: rgba(3, 23, 43, .54);
    backdrop-filter: blur(3px);
}

.modal form {
    gap: 11px;
    padding: 24px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 10px;
}

.modal-header h2 {
    margin: 0;
    font-size: 22px;
    letter-spacing: -.025em;
}

.modal-header p {
    margin: 5px 0 0;
    color: var(--ink-500);
    font-size: 12px;
}

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

.info-modal ul {
    display: grid;
    gap: 10px;
    margin: 2px 0 12px;
    padding-left: 20px;
    color: var(--ink-600);
    font-size: 13px;
    line-height: 1.55;
}

.dialog-full-button {
    width: 100%;
}

.image-dialog {
    width: min(calc(100% - 32px), 1100px);
    max-height: calc(100vh - 42px);
    background: #0b1a2a;
}

.image-dialog img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 42px);
    margin: auto;
    border-radius: var(--radius-lg);
    object-fit: contain;
}

.image-dialog-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    color: #fff;
    background: rgba(3, 23, 43, .82);
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    z-index: 150;
    max-width: min(430px, calc(100% - 28px));
    padding: 11px 15px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 9px;
    color: #fff;
    background: var(--navy-850);
    box-shadow: var(--shadow-md);
    font-size: 13px;
    text-align: center;
    transform: translateX(-50%);
    animation: toast-in .22s var(--ease) both;
}

@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 8px); }
}

@media (max-height: 790px) and (min-width: 901px) {
    .empty-state {
        padding: 28px 24px 32px;
    }

    .empty-icon {
        width: 82px;
        height: 82px;
        margin-bottom: 12px;
    }

    .empty-icon svg {
        width: 42px;
        height: 42px;
    }

    .starter-actions {
        margin-top: 28px;
    }

    .starter-actions button {
        min-height: 68px;
    }
}

@media (max-width: 900px) {
    :root {
        --topbar-height: 72px;
    }

    .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(var(--sidebar-width), calc(100vw - 48px));
        transform: translateX(-104%);
        transition: transform .25s var(--ease);
    }

    .sidebar.is-open {
        transform: translateX(0);
        box-shadow: 24px 0 70px rgba(0, 0, 0, .25);
    }

    .workspace {
        width: 100%;
        height: 100vh;
        height: 100dvh;
    }

    .mobile-menu-button {
        display: inline-grid;
        flex: 0 0 auto;
    }

    .topbar {
        padding: 0 16px;
        gap: 10px;
        color: #fff;
        border-bottom-color: rgba(255, 255, 255, .12);
        background: var(--navy-950);
    }

    .topbar-title strong {
        font-size: 17px;
    }

    .topbar-title span {
        display: none;
    }

    .model-status {
        color: var(--cyan-400);
        font-size: 12px;
    }

    .topbar .icon-button {
        color: #d7e4ed;
    }

    .topbar .icon-button:hover {
        color: #fff;
        border-color: rgba(255, 255, 255, .15);
        background: rgba(255, 255, 255, .07);
    }

    .message-list {
        padding: 26px 22px;
    }

    .composer-region {
        padding: 10px 18px 12px;
    }
}

@media (max-width: 620px) {
    .auth-screen {
        padding: 14px;
    }

    .auth-card {
        padding: 28px 22px;
    }

    .topbar {
        padding: 0 10px;
    }

    .topbar .icon-button {
        width: 39px;
        height: 39px;
    }

    .topbar-title {
        flex: 1;
    }

    .topbar-title strong {
        font-size: 15px;
    }

    .model-status {
        gap: 6px;
    }

    .status-dot {
        width: 7px;
        height: 7px;
        box-shadow: none;
    }

    #infoButton {
        display: none;
    }

    .empty-state {
        align-content: start;
        padding: clamp(42px, 10vh, 80px) 20px 30px;
    }

    .empty-icon {
        width: 78px;
        height: 78px;
        margin-bottom: 22px;
    }

    .empty-icon svg {
        width: 40px;
        height: 40px;
    }

    .empty-state h1 {
        font-size: 28px;
    }

    .empty-state > p {
        max-width: 420px;
        margin-top: 13px;
        font-size: 14px;
        line-height: 1.58;
    }

    .starter-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        max-width: 410px;
        gap: 9px;
        margin-top: 28px;
    }

    .starter-actions button {
        grid-template-columns: 25px auto;
        gap: 9px;
        min-width: 0;
        min-height: 58px;
        padding: 9px 12px;
        font-size: 12px;
        line-height: 1.3;
    }

    .starter-actions button:last-child {
        grid-column: 1 / -1;
        width: calc(50% - 5px);
    }

    .starter-actions svg {
        width: 24px;
        height: 24px;
    }

    .message-list {
        padding: 20px 13px 14px;
    }

    .message {
        margin-bottom: 22px;
    }

    .message-bubble {
        max-width: 94%;
        padding: 14px;
        font-size: 14px;
        line-height: 1.62;
    }

    .composer-region {
        padding: 8px 9px calc(8px + env(safe-area-inset-bottom));
    }

    .composer {
        padding: 10px 10px 9px 12px;
        border-radius: 12px;
    }

    .composer textarea {
        max-height: 130px;
        min-height: 36px;
        font-size: 14px;
    }

    .attachment-hint,
    .send-button span,
    .batch-send-button span {
        display: none;
    }

    .send-button,
    .batch-send-button {
        min-width: 43px;
        width: 43px;
        height: 40px;
        padding: 0;
    }

    .attach-button {
        width: 40px;
        height: 40px;
        border-color: var(--border);
    }

    .review-notice {
        margin-top: 7px;
        font-size: 10px;
    }

    .attachment-card {
        flex-basis: 145px;
    }

    .utility-drawer {
        width: 100%;
    }

    .drawer-header {
        min-height: 72px;
        padding: 16px 14px 13px 18px;
    }

    .modal form {
        padding: 20px;
    }
}

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