:root {
    --bg: #f6f8fc;
    --panel: rgba(255, 255, 255, .92);
    --panel-solid: #ffffff;
    --ink: #111827;
    --muted: #6b7280;
    --subtle: #9ca3af;
    --line: #e5e7eb;
    --line-strong: #d1d5db;
    --accent: #0052d9;
    --accent-dark: #003ea8;
    --accent-soft: #edf4ff;
    --danger: #dc2626;
    --danger-soft: #fff1f2;
    --assistant: #ffffff;
    --surface-soft: rgba(248, 250, 252, .86);
    --ring: rgba(0, 82, 217, .12);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, .05), 0 8px 10px -6px rgba(0, 0, 0, .04);
    --shadow-lg: 0 24px 64px -32px rgba(15, 23, 42, .28);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
    height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% -10%, rgba(0, 82, 217, .1), transparent 30%),
        radial-gradient(circle at 88% 0%, rgba(20, 184, 166, .08), transparent 28%),
        linear-gradient(180deg, #ffffff 0%, var(--bg) 46%, #eef3fb 100%);
    font-size: 14px;
    letter-spacing: 0;
}

body.authenticated {
    height: 100vh;
    overflow: hidden;
}

body.tool-page {
    min-height: 100vh;
}

body.modal-open {
    overflow: hidden;
}

body:not(.authenticated) .app-shell {
    display: none;
}

body:not(.authenticated) .admin-drawer {
    display: none;
}

body.authenticated .login-view {
    display: none;
}

body:not(.is-admin) #adminConsoleLink {
    display: none !important;
}

.login-view {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    display: grid;
    gap: 14px;
    width: min(420px, 100%);
    padding: 32px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--panel);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

.login-card h1 {
    font-size: 28px;
}

.login-card p,
.login-hint {
    margin: 0 0 8px;
    color: var(--muted);
    line-height: 1.6;
}

.login-hint {
    font-size: 12px;
}

.auth-error {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(220, 38, 38, .18);
    border-radius: 12px;
    color: #b91c1c;
    background: var(--danger-soft);
    box-shadow: var(--shadow-sm);
    font-size: 13px;
    line-height: 1.5;
    font-weight: 650;
}

.auth-error::before {
    content: "!";
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    border-radius: 999px;
    color: #fff;
    background: var(--danger);
    font-size: 12px;
    font-weight: 800;
}

.auth-error[hidden] {
    display: none;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f9fafb;
}

.auth-tab {
    min-height: 36px;
    border-radius: 10px;
    color: var(--muted);
    background: transparent;
    font-weight: 750;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.auth-tab.active {
    color: var(--accent);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.registration-key-field {
    display: grid;
    gap: 8px;
}

.tool-shell {
    display: grid;
    gap: 24px;
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 40px;
}

.tool-header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-top: 8px;
}

.tool-brand {
    border: 1px solid rgba(226, 232, 240, .92);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
}

.tool-grid {
    display: grid;
    grid-template-columns: minmax(320px, .86fr) minmax(0, 1.14fr);
    gap: 24px;
    align-items: start;
}

.tool-panel {
    display: grid;
    gap: 20px;
    min-width: 0;
    padding: 24px;
    border: 1px solid rgba(226, 232, 240, .92);
    border-radius: 20px;
    background: var(--panel);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

.tool-section-head h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.3;
}

.tool-section-head p {
    margin: 6px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.drop-zone {
    position: relative;
    display: grid;
    place-items: center;
    gap: 10px;
    min-height: 220px;
    padding: 28px;
    border: 1px dashed rgba(0, 82, 217, .32);
    border-radius: 18px;
    color: var(--ink);
    background: linear-gradient(180deg, rgba(237, 244, 255, .7), rgba(255, 255, 255, .9));
    text-align: center;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background .18s ease;
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.dragging {
    border-color: rgba(0, 82, 217, .7);
    box-shadow: 0 18px 48px -28px rgba(0, 82, 217, .5);
    transform: translateY(-1px);
}

.drop-zone input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.drop-zone strong {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: 16px;
}

.drop-zone small {
    color: var(--muted);
    line-height: 1.5;
}

.drop-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #4f8cff);
    box-shadow: 0 16px 32px -18px rgba(0, 82, 217, .8);
    font-size: 12px;
    font-weight: 800;
}

.tool-controls {
    display: grid;
    grid-template-columns: 1fr 160px;
    gap: 16px;
}

.progress-track {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #e5e7eb;
}

.progress-track div {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), #14b8a6);
    transition: width .28s ease;
}

.result-panel textarea {
    min-height: 360px;
    resize: vertical;
}

.log-panel pre {
    min-height: 160px;
    max-height: 300px;
    margin: 0;
    overflow: auto;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    color: #334155;
    background: rgba(248, 250, 252, .92);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.55;
    white-space: pre-wrap;
}

.media-doc-shell {
    width: min(1360px, calc(100% - 32px));
}

.tool-nav-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    margin-left: auto;
}

.media-workbench {
    display: grid;
    grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.media-flow-panel,
.media-main-panel {
    min-width: 0;
}

.media-flow-panel {
    position: sticky;
    top: 112px;
}

.media-main-panel {
    display: grid;
    gap: 24px;
}

.media-doc-form {
    display: grid;
    gap: 18px;
}

.compact-drop-zone {
    min-height: 180px;
    padding: 22px;
}

.media-status-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(248, 250, 252, .92);
}

.media-status-card span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.media-status-card strong {
    overflow-wrap: anywhere;
}

.split-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

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

.transcript-panel textarea,
.doc-output-panel textarea,
.qa-panel textarea {
    width: 100%;
    resize: vertical;
}

.doc-output-panel textarea {
    min-height: 420px;
}

.qa-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
}

.knowledge-save-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    margin-bottom: 12px;
}

.knowledge-layout {
    display: grid;
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.knowledge-list,
.knowledge-documents {
    display: grid;
    gap: 12px;
}

.knowledge-item {
    width: 100%;
    display: grid;
    gap: 4px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: .2s ease;
}

.knowledge-item:hover,
.knowledge-item.active {
    border-color: rgba(0, 82, 217, .35);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, .05);
    transform: translateY(-1px);
}

.knowledge-item span,
.knowledge-document-item span {
    color: var(--muted);
    font-size: 12px;
}

.knowledge-document-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(248, 250, 252, .92);
}

.loading-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-weight: 700;
}

.loading-row[hidden] {
    display: none;
}

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

button {
    border: 0;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: .5;
    transform: none !important;
}

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

.file-picker-input {
    position: absolute;
    inset: 0;
    width: 100%;
    max-width: none;
    min-width: 0;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 12px;
    color: transparent;
    background: transparent;
    box-shadow: none;
    opacity: 0;
    cursor: pointer;
}

.app-shell {
    display: grid;
    grid-template-columns: 336px minmax(0, 1fr);
    height: 100vh;
    min-height: 0;
    padding: 24px;
    gap: 24px;
    overflow: hidden;
}

.sidebar,
.chat-pane {
    min-width: 0;
    border: 1px solid rgba(226, 232, 240, .92);
    background: var(--panel);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

.sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-radius: 20px;
    overflow: hidden;
}

.brand-row,
.chat-header,
.composer-actions,
.toolbar,
.history-head,
.key-actions {
    display: flex;
    align-items: center;
}

.account-card {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.account-card strong {
    font-size: 15px;
}

.account-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.brand-row {
    gap: 12px;
    padding: 24px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(248, 250, 252, .72));
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #4f8cff);
    box-shadow: 0 12px 28px -14px rgba(0, 82, 217, .8);
    font-weight: 750;
    letter-spacing: 0;
}

.brand-copy {
    min-width: 0;
    flex: 1;
}

h1 {
    margin: 0;
    font-size: 20px;
    line-height: 1.2;
    font-weight: 760;
}

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

.key-panel {
    display: grid;
    gap: 12px;
    padding: 24px;
    border-bottom: 1px solid var(--line);
}

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

.key-actions .secondary-button {
    min-width: 0;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 13px;
    white-space: nowrap;
}

.key-actions #adminConsoleLink {
    grid-column: 1 / -1;
}

label,
.history-head {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink);
    background: rgba(255, 255, 255, .92);
    outline: none;
    box-shadow: var(--shadow-sm);
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input,
select {
    height: 44px;
    padding: 0 14px;
}

textarea {
    resize: vertical;
    padding: 12px 14px;
    line-height: 1.55;
}

input::placeholder,
textarea::placeholder {
    color: var(--subtle);
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(0, 82, 217, .55);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0, 82, 217, .1);
}

.check-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    white-space: nowrap;
}

.check-row input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    box-shadow: none;
}

.check-row.slim {
    height: 44px;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button {
    border-radius: 12px;
    transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.primary-button {
    min-height: 44px;
    padding: 0 18px;
    color: #fff;
    background: linear-gradient(180deg, #1266f1 0%, var(--accent) 100%);
    box-shadow: 0 14px 28px -16px rgba(0, 82, 217, .9);
    font-weight: 700;
}

.primary-button:hover {
    transform: translateY(-1px);
    background: linear-gradient(180deg, #1b73ff 0%, var(--accent-dark) 100%);
    box-shadow: 0 18px 34px -18px rgba(0, 82, 217, .95);
}

.primary-button.danger-button {
    background: linear-gradient(180deg, #ef4444 0%, var(--danger) 100%);
    box-shadow: 0 14px 28px -16px rgba(220, 38, 38, .9);
}

.primary-button.danger-button:hover {
    background: linear-gradient(180deg, #f87171 0%, #b91c1c 100%);
    box-shadow: 0 18px 34px -18px rgba(220, 38, 38, .92);
}

.secondary-button {
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--line);
    color: var(--ink);
    background: #fff;
    box-shadow: var(--shadow-sm);
    font-weight: 650;
}

.link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.secondary-button:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-md);
}

.secondary-button.danger {
    color: var(--danger);
}

.secondary-button.danger:hover {
    border-color: #fecdd3;
    background: var(--danger-soft);
}

.text-button {
    padding: 6px 10px;
    color: var(--accent);
    background: transparent;
    font-weight: 700;
}

.text-button:hover {
    background: var(--accent-soft);
}

.icon-button {
    display: inline-grid;
    place-items: center;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    color: var(--accent);
    background: #fff;
    box-shadow: var(--shadow-sm);
    font-size: 22px;
    line-height: 1;
    font-weight: 500;
}

.icon-button:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 82, 217, .26);
    background: var(--accent-soft);
    box-shadow: var(--shadow-md);
}

.history-head {
    justify-content: space-between;
    padding: 20px 24px 8px;
}

.conversation-list {
    display: grid;
    gap: 8px;
    min-height: 0;
    padding: 0 16px 24px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.conversation-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 34px;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 64px;
    padding: 8px 8px 8px 12px;
    border: 1px solid transparent;
    border-radius: 14px;
    color: var(--ink);
    background: transparent;
    transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.conversation-item:hover {
    transform: translateY(-1px);
    border-color: var(--line);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.conversation-item.active {
    border-color: rgba(0, 82, 217, .18);
    background: linear-gradient(180deg, #f5f9ff 0%, var(--accent-soft) 100%);
    box-shadow: inset 3px 0 0 var(--accent), 0 12px 24px -22px rgba(0, 82, 217, .7);
}

.conversation-open {
    display: grid;
    gap: 4px;
    min-width: 0;
    min-height: 48px;
    padding: 6px 4px;
    color: inherit;
    background: transparent;
    text-align: left;
}

.conversation-item strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 700;
}

.conversation-item span {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-delete {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    color: var(--danger);
    background: transparent;
    font-size: 18px;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity .16s ease, background .16s ease, transform .16s ease;
}

.conversation-item:hover .conversation-delete,
.conversation-item:focus-within .conversation-delete {
    opacity: 1;
    pointer-events: auto;
}

.conversation-delete:hover {
    background: var(--danger-soft);
    transform: translateY(-1px);
}

.chat-pane {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    height: calc(100vh - 48px);
    min-height: 0;
    border-radius: 24px;
    overflow: hidden;
}

.chat-header {
    justify-content: space-between;
    gap: 24px;
    padding: 24px 28px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(248, 250, 252, .78));
    position: relative;
    z-index: 2;
}

.title-block {
    display: grid;
    gap: 6px;
    min-width: 200px;
    max-width: 560px;
    flex: 1;
}

.title-input {
    height: 40px;
    padding: 0;
    border-color: transparent;
    border-radius: 0;
    font-size: 24px;
    font-weight: 780;
    background: transparent;
    box-shadow: none;
}

.title-input:focus {
    box-shadow: none;
    background: transparent;
}

.status-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
}

.status-text::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, .12);
}

body.is-streaming .status-text::before {
    background: var(--accent);
    animation: pulseDot 1.1s ease-in-out infinite;
}

.toolbar {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
}

.compact-field {
    display: grid;
    grid-template-columns: auto minmax(240px, 340px);
    align-items: center;
    gap: 10px;
}

.system-strip {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    padding: 16px 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(248, 250, 252, .72);
}

.system-strip label {
    padding-top: 12px;
}

.messages-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    padding: 32px;
    overflow: auto;
    background:
        linear-gradient(180deg, rgba(248, 250, 252, .72), rgba(255, 255, 255, .52)),
        radial-gradient(circle at 50% 0%, rgba(0, 82, 217, .05), transparent 34%);
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.empty-state {
    margin: auto;
    max-width: 440px;
    padding: 32px;
    border: 1px solid rgba(226, 232, 240, .95);
    border-radius: 18px;
    color: var(--muted);
    text-align: center;
    background: rgba(255, 255, 255, .86);
    box-shadow: var(--shadow-md);
}

.message {
    max-width: min(840px, 88%);
    padding: 16px 18px;
    border: 1px solid rgba(226, 232, 240, .94);
    border-radius: 18px;
    white-space: pre-wrap;
    line-height: 1.65;
    overflow-wrap: anywhere;
    box-shadow: var(--shadow-sm);
    animation: messageIn .2s ease both;
}

.message.user {
    align-self: flex-end;
    border-color: rgba(0, 82, 217, .28);
    color: #fff;
    background: linear-gradient(180deg, #176bff 0%, var(--accent) 100%);
    box-shadow: 0 18px 40px -24px rgba(0, 82, 217, .9);
    border-bottom-right-radius: 8px;
}

.message.user .message-meta {
    color: rgba(255, 255, 255, .72);
}

.message.assistant {
    align-self: flex-start;
    background: var(--assistant);
    border-bottom-left-radius: 8px;
}

.message.assistant.loading {
    border-color: rgba(0, 82, 217, .16);
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 18px 36px -28px rgba(0, 82, 217, .48);
}

.message.error {
    align-self: flex-start;
    border-color: #fecdd3;
    color: var(--danger);
    background: var(--danger-soft);
}

.message-meta {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

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

.message-attachment {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: min(360px, 100%);
    padding: 9px 10px;
    border: 1px solid rgba(226, 232, 240, .95);
    border-radius: 12px;
    color: var(--ink);
    background: rgba(248, 250, 252, .92);
    text-decoration: none;
}

.message.user .message-attachment {
    border-color: rgba(255, 255, 255, .24);
    color: #fff;
    background: rgba(255, 255, 255, .12);
}

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

.message-attachment small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.message.user .message-attachment small {
    color: rgba(255, 255, 255, .7);
}

.message-attachment.image-preview {
    display: grid;
    gap: 10px;
    width: min(360px, 100%);
    max-width: 100%;
    padding: 10px;
}

.message-attachment.image-preview img {
    display: block;
    width: 100%;
    max-height: 320px;
    object-fit: cover;
    border-radius: 10px;
    background: #f8fafc;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .06);
}

.message.user .message-attachment.image-preview img {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
}

.typing-loader {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 28px;
    color: var(--muted);
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(0, 82, 217, .16);
    border-top-color: var(--accent);
    border-radius: 999px;
    animation: spin .8s linear infinite;
}

.typing-text {
    font-weight: 650;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
}

.typing-dots i {
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: var(--accent);
    opacity: .38;
    animation: typingDot 1.1s ease-in-out infinite;
}

.typing-dots i:nth-child(2) {
    animation-delay: .16s;
}

.typing-dots i:nth-child(3) {
    animation-delay: .32s;
}

.composer {
    display: grid;
    flex: 0 0 auto;
    gap: 16px;
    padding: 20px 28px 24px;
    border-top: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, .88), rgba(255, 255, 255, .98));
    z-index: 1;
    transition: background .18s ease, box-shadow .18s ease;
}

.composer.dragging {
    background: linear-gradient(180deg, #f3f8ff 0%, #ffffff 100%);
    box-shadow: inset 0 0 0 2px rgba(0, 82, 217, .18);
}

.attachment-bar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 12px;
}

.attach-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 38px;
    padding: 0 14px;
    user-select: none;
    cursor: pointer;
}

.attach-button span {
    pointer-events: none;
}

.attach-button.disabled {
    cursor: not-allowed;
    opacity: .5;
    transform: none !important;
}

.attach-button.disabled .file-picker-input {
    pointer-events: none;
}

.attachment-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-height: 38px;
}

.attachment-list:empty::before {
    content: "选择附件后会随下一条消息发送，也可以拖拽或粘贴图片";
    color: var(--subtle);
    font-size: 12px;
}

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 320px;
    min-height: 38px;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.attachment-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 30px;
    height: 24px;
    border-radius: 8px;
    color: var(--accent);
    background: var(--accent-soft);
    font-size: 10px;
    font-weight: 800;
}

.attachment-chip.video .attachment-icon,
.message-attachment.video .attachment-icon {
    color: #7c3aed;
    background: #f3e8ff;
}

.attachment-chip.file .attachment-icon,
.message-attachment.file .attachment-icon {
    color: #475569;
    background: #f1f5f9;
}

.attachment-name {
    overflow: hidden;
    max-width: 150px;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 650;
}

.attachment-size {
    color: var(--muted);
    font-size: 11px;
}

.attachment-chip button {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    color: var(--danger);
    background: transparent;
    font-size: 16px;
}

.attachment-chip button:hover {
    background: var(--danger-soft);
}

.composer textarea {
    min-height: 92px;
    border-radius: 16px;
    background: #fff;
}

.composer textarea:disabled {
    color: var(--muted);
    background: #f8fafc;
}

.composer-actions {
    justify-content: flex-end;
    gap: 12px;
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    max-width: 420px;
    padding: 14px 16px;
    border: 1px solid #bfdbfe;
    border-radius: 14px;
    color: #1e3a8a;
    background: #eff6ff;
    box-shadow: var(--shadow-md);
    animation: toastIn .18s ease both;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes typingDot {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: .32;
    }
    40% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

@keyframes pulseDot {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(0, 82, 217, .12);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(0, 82, 217, .04);
    }
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.console-page {
    min-height: 100vh;
}

.console-page.console-locked .console-topbar,
.console-page.console-locked .console-layout {
    display: none;
}

.console-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 24px 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    z-index: 5;
}

.console-brand {
    padding: 0;
    border-bottom: 0;
}

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

.status-pill,
.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
}

.status-badge.muted {
    background: #f3f4f6;
    color: var(--muted);
}

.status-badge.ok {
    background: #ecfdf3;
    color: #027a48;
}

.status-badge.danger {
    background: #fff1f2;
    color: #b91c1c;
}

.mini-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mini-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    color: #155e75;
    background: #ecfeff;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.mini-badge.ok {
    color: #027a48;
    background: #ecfdf3;
}

.mini-badge.muted {
    color: var(--muted);
    background: #f3f4f6;
}

.image-panel {
    gap: 12px;
}

.image-options-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

#imagePromptInput {
    min-height: 86px;
    resize: vertical;
}

.console-shell {
    display: grid;
    gap: 24px;
    width: min(1280px, calc(100% - 48px));
    margin: 24px auto 40px;
}

.console-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 24px;
    width: min(1320px, calc(100% - 48px));
    margin: 24px auto 40px;
}

.console-nav {
    display: grid;
    align-content: start;
    gap: 8px;
    padding: 12px;
    border: 1px solid rgba(229, 231, 235, .9);
    border-radius: 20px;
    background: var(--panel);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 112px;
}

.console-nav-item {
    min-height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    color: var(--muted);
    background: transparent;
    text-align: left;
    font-weight: 750;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.console-nav-item:hover,
.console-nav-item.active {
    color: var(--accent);
    background: var(--accent-soft);
}

.console-nav-item:hover {
    transform: translateY(-1px);
}

.console-content {
    min-width: 0;
}

.console-page-section {
    display: none;
    gap: 16px;
    padding: 24px;
    border: 1px solid rgba(229, 231, 235, .9);
    border-radius: 22px;
    background: var(--panel);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(18px);
}

.console-page-section.active {
    display: grid;
}

.console-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 24px;
}

.console-section {
    display: grid;
    gap: 16px;
    padding: 24px;
    border: 1px solid rgba(229, 231, 235, .9);
    border-radius: 22px;
    background: var(--panel);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(18px);
}

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

.section-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.section-head h2 {
    margin: 0;
    font-size: 20px;
}

.section-head p {
    margin: 6px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.api-management-page {
    gap: 18px;
}

.api-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--line);
}

.api-stat {
    display: grid;
    gap: 6px;
    min-height: 76px;
    padding: 16px;
    background: rgba(255, 255, 255, .92);
}

.api-stat span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.api-stat strong {
    font-size: 24px;
    line-height: 1;
}

.api-panel-tabs {
    display: inline-grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    width: min(540px, 100%);
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f8fafc;
}

.api-panel-tab {
    min-height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    color: var(--muted);
    background: transparent;
    font-weight: 750;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.api-panel-tab:hover,
.api-panel-tab.active {
    color: var(--accent);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.api-panel {
    display: none;
    gap: 12px;
}

.api-panel.active {
    display: grid;
}

.api-platform-wrap {
    overflow: auto;
}

.api-platform-table {
    min-width: 980px;
}

.api-platform-cell,
.api-protocol-cell,
.api-key-cell,
.api-model-cell {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.api-platform-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.api-platform-name strong,
.api-model-cell strong {
    color: var(--ink);
    font-size: 15px;
}

.api-platform-id,
.api-key-cell small,
.api-model-cell small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.api-protocol-cell span:last-child,
.api-key-cell span:not(.status-badge) {
    overflow-wrap: anywhere;
    color: #475569;
}

.console-form {
    display: grid;
    gap: 12px;
}

.table-form {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: center;
}

.table-form input:nth-child(2) {
    min-width: 190px;
}

.table-wrap {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    overflow: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    color: var(--muted);
    background: #f9fafb;
    font-size: 12px;
    font-weight: 750;
}

.data-table tr:last-child td {
    border-bottom: 0;
}

.table-action {
    min-height: 32px;
    padding: 0 12px;
    border-radius: 10px;
    color: var(--accent);
    background: var(--accent-soft);
    font-weight: 700;
    transition: transform .18s ease, background .18s ease;
}

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

.table-action.danger {
    color: var(--danger);
    background: var(--danger-soft);
}

.table-action.muted {
    color: var(--muted);
    background: #f3f4f6;
}

.table-action:hover {
    transform: translateY(-1px);
    background: #dceaff;
}

.admin-list {
    display: grid;
    gap: 8px;
    max-height: 240px;
    overflow: auto;
}

.admin-list.compact {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    max-height: 160px;
}

.admin-item {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f9fafb;
}

.admin-item strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-item span {
    color: var(--muted);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.admin-item button {
    justify-self: start;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    color: var(--accent);
    background: var(--accent-soft);
}

.modal {
    width: min(520px, calc(100% - 32px));
    max-height: calc(100dvh - 32px);
    overflow: auto;
    padding: 0;
    border: 0;
    border-radius: 22px;
    background: transparent;
}

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

.modal::backdrop {
    background: rgba(15, 23, 42, .34);
    backdrop-filter: blur(10px);
}

.modal-card {
    display: grid;
    gap: 20px;
    overflow: visible;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 22px;
    background: rgba(255, 255, 255, .98);
    box-shadow: var(--shadow-lg);
}

.confirm-card {
    gap: 24px;
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.modal-head h2 {
    margin: 0;
    font-size: 22px;
}

.modal-head p {
    margin: 6px 0 0;
    color: var(--muted);
    line-height: 1.6;
}

.modal-fields {
    display: grid;
    gap: 14px;
}

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

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

.modal-field {
    display: grid;
    gap: 8px;
}

.modal-field span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.field-hint {
    display: block;
    color: var(--subtle);
    font-size: 12px;
    line-height: 1.45;
    white-space: normal;
}

.api-helper-strip {
    min-height: 42px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: #334155;
    background: rgba(248, 250, 252, .92);
    font-size: 13px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.modal-field-group {
    display: grid;
    gap: 12px;
    min-width: 0;
    margin: 0;
    padding: 14px 16px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(248, 250, 252, .66);
}

.modal-field-group legend {
    padding: 0 4px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 760;
}

.modal-field-group-body {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.modal-field-group-body .check-row {
    min-height: 36px;
}

.modal-detail-section {
    display: grid;
    gap: 12px;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(248, 250, 252, .72);
}

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

.modal-detail-head h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
}

.api-detail-list {
    display: grid;
    gap: 10px;
    max-height: 360px;
    overflow: auto;
    padding-right: 2px;
}

.api-detail-item,
.api-detail-empty {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.api-detail-empty {
    grid-template-columns: 1fr;
}

.api-detail-item strong,
.api-detail-empty strong {
    display: block;
    overflow-wrap: anywhere;
}

.api-detail-item span,
.api-detail-empty span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.model-detail-item {
    grid-template-columns: minmax(0, 1fr) auto auto;
}

.model-detail-state {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.api-detail-footer-button {
    justify-self: start;
    min-height: 38px;
    border-radius: 10px;
}

.compact-tool-button {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 10px;
}

.modal-check {
    min-height: 36px;
}

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

@media (max-width: 1024px) {
    .app-shell {
        grid-template-columns: 300px minmax(0, 1fr);
        padding: 16px;
        gap: 16px;
    }

    .chat-pane {
        height: calc(100vh - 32px);
    }

    .tool-grid {
        grid-template-columns: 1fr;
    }

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

    .media-flow-panel {
        position: static;
    }
}

@media (max-width: 768px) {
    .tool-shell {
        width: min(100% - 24px, 1180px);
        padding-top: 12px;
    }

    .tool-brand {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .tool-controls {
        grid-template-columns: 1fr;
    }

    .tool-nav-actions,
    .split-head,
    .inline-actions,
    .qa-input-row {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .drop-zone {
        min-height: 180px;
        padding: 22px;
    }

    .app-shell {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(180px, 36vh) minmax(0, 1fr);
        height: 100vh;
        padding: 12px;
        overflow: hidden;
    }

    .sidebar {
        max-height: none;
        min-height: 0;
        border-radius: 18px;
    }

    .brand-row,
    .key-panel {
        padding: 16px;
    }

    .key-actions,
    .chat-header,
    .toolbar,
    .compact-field,
    .system-strip {
        display: grid;
        grid-template-columns: 1fr;
    }

    .chat-pane {
        height: auto;
        min-height: 0;
        border-radius: 18px;
    }

    .chat-header,
    .system-strip,
    .composer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .messages-view {
        padding: 20px 16px;
    }

    .message {
        max-width: 100%;
    }

    .composer-actions {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
    }

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

    .console-topbar {
        display: grid;
        padding: 16px;
    }

    .console-shell {
        width: calc(100% - 24px);
        margin: 12px auto 24px;
        gap: 16px;
    }

    .console-layout {
        grid-template-columns: 1fr;
        width: calc(100% - 24px);
        margin: 12px auto 24px;
        gap: 16px;
    }

    .console-nav {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .console-grid,
    .api-stats,
    .modal-form-grid,
    .api-toggle-grid,
    .table-form {
        grid-template-columns: 1fr;
    }

    .api-panel-tabs {
        grid-template-columns: 1fr;
    }

    .api-detail-item,
    .model-detail-item {
        grid-template-columns: 1fr;
    }

    .model-detail-state,
    .detail-actions {
        justify-content: flex-start;
    }

    .console-section {
        padding: 16px;
    }

    .console-page-section {
        padding: 16px;
    }

    .section-head,
    .modal-actions {
        display: grid;
    }
}

body:not(.authenticated) .gemini-shell {
    display: none;
}

.gemini-shell {
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    width: 100vw;
    height: 100dvh;
    background: #ffffff;
}

.gemini-sidebar {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-width: 0;
    border-right: 1px solid #e5e7eb;
    background: #f7f9fc;
}

.gemini-sidebar-top {
    display: grid;
    gap: 14px;
    padding: 18px 16px 14px;
}

.gemini-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
}

.gemini-brand strong,
.gemini-account strong,
.gemini-title-block strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gemini-brand span,
.gemini-account span,
.gemini-title-block span {
    display: block;
    margin-top: 2px;
    color: #64748b;
    font-size: 12px;
}

.gemini-new-button {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 999px;
    color: #0f172a;
    background: #e9f1ff;
    font-weight: 750;
}

.gemini-new-button:hover {
    background: #dceaff;
}

.gemini-new-button span {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    color: #ffffff;
    background: #1a73e8;
    font-size: 20px;
    line-height: 1;
}

.gemini-search-label {
    display: grid;
    gap: 6px;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.gemini-search-label input {
    width: 100%;
    min-height: 42px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #ffffff;
}

.gemini-history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
    padding: 4px 10px 14px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.gemini-history-empty {
    margin: 12px 8px;
    color: #94a3b8;
    font-size: 13px;
}

.gemini-history-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 32px;
    align-items: center;
    border-radius: 16px;
}

.gemini-history-item:hover,
.gemini-history-item.active {
    background: #eef4ff;
}

.gemini-history-open {
    display: grid;
    gap: 2px;
    min-width: 0;
    min-height: 48px;
    padding: 8px 8px 8px 14px;
    color: #1f2937;
    text-align: left;
    background: transparent;
}

.gemini-history-open strong,
.gemini-history-open span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gemini-history-open span {
    color: #64748b;
    font-size: 11px;
}

.gemini-history-delete {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    color: #94a3b8;
    background: transparent;
    font-size: 18px;
}

.gemini-history-delete:hover {
    color: #dc2626;
    background: #fee2e2;
}

.gemini-account-panel {
    display: grid;
    gap: 12px;
    padding: 14px 16px 18px;
    border-top: 1px solid #e5e7eb;
    background: rgba(255, 255, 255, .7);
}

.gemini-account {
    min-width: 0;
}

.gemini-account-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gemini-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    color: #334155;
    background: #ffffff;
    text-decoration: none;
    font-weight: 700;
}

.gemini-link-button:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.gemini-main {
    position: relative;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-width: 0;
    height: 100dvh;
    overflow: hidden;
    background:
        linear-gradient(180deg, #ffffff 0%, #fbfcff 56%, #f4f8ff 100%),
        radial-gradient(circle at 76% 12%, rgba(26, 115, 232, .09), transparent 34%),
        radial-gradient(circle at 26% 92%, rgba(16, 185, 129, .08), transparent 28%);
}

.gemini-main.empty {
    grid-template-rows: auto minmax(0, 1fr);
}

.gemini-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 10px 22px;
    border-bottom: 1px solid rgba(226, 232, 240, .8);
    background: rgba(255, 255, 255, .82);
}

.gemini-title-block {
    min-width: 0;
    flex: 1;
}

.gemini-title-block strong {
    max-width: 46vw;
    color: #111827;
    font-size: 16px;
}

.gemini-icon-button {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border: 1px solid transparent;
    border-radius: 999px;
    color: #334155;
    background: transparent;
    font-size: 18px;
    font-weight: 750;
}

.gemini-icon-button:hover {
    border-color: #e2e8f0;
    background: #f8fafc;
}

.gemini-icon-button:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.mobile-only {
    display: none;
}

.gemini-messages {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 0;
    padding: 28px max(24px, calc((100vw - 1120px) / 2)) 156px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.gemini-welcome {
    align-self: center;
    justify-self: center;
    width: min(760px, calc(100% - 40px));
    margin-bottom: 150px;
    text-align: left;
}

.gemini-welcome h1 {
    margin: 0;
    color: #1f2937;
    font-size: clamp(34px, 6vw, 56px);
    font-weight: 760;
    line-height: 1.08;
}

.gemini-welcome p {
    max-width: 560px;
    margin: 14px 0 0;
    color: #64748b;
    font-size: 17px;
    line-height: 1.7;
}

.gemini-composer {
    position: absolute;
    left: 50%;
    bottom: 22px;
    z-index: 4;
    display: grid;
    gap: 10px;
    width: min(820px, calc(100% - 44px));
    max-height: min(70dvh, 520px);
    padding: 12px;
    border: 1px solid #dbe3ef;
    border-radius: 28px;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 22px 80px -48px rgba(15, 23, 42, .38), 0 2px 8px rgba(15, 23, 42, .04);
    transform: translateX(-50%);
}

.gemini-main.empty .gemini-composer {
    bottom: 50%;
    transform: translate(-50%, 170px);
}

.gemini-main.dragging .gemini-composer,
.gemini-composer:focus-within {
    border-color: #9cc3ff;
    box-shadow: 0 26px 88px -48px rgba(26, 115, 232, .58), 0 0 0 4px rgba(26, 115, 232, .09);
}

.gemini-drop-hint {
    display: none;
    place-items: center;
    min-height: 66px;
    border: 1px dashed #8ab4f8;
    border-radius: 20px;
    color: #1a73e8;
    background: #eef5ff;
    font-weight: 760;
}

.gemini-main.dragging .gemini-drop-hint {
    display: grid;
}

.gemini-composer textarea {
    width: 100%;
    min-height: 48px;
    max-height: 180px;
    padding: 12px 14px;
    border: 0;
    border-radius: 18px;
    outline: 0;
    resize: none;
    background: transparent;
    color: #111827;
    font-size: 16px;
    line-height: 1.55;
}

.gemini-composer textarea:disabled {
    color: #64748b;
}

.gemini-composer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 46px;
}

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

.gemini-attach-button {
    position: relative;
    overflow: hidden;
    color: #1a73e8;
    background: #eef5ff;
}

.gemini-attach-button.disabled {
    pointer-events: none;
    opacity: .45;
}

.gemini-model-field {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #ffffff;
}

.gemini-model-field span {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}

.gemini-model-field select {
    width: min(260px, 42vw);
    min-height: 32px;
    padding: 0 20px 0 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #0f172a;
    font-weight: 750;
}

.gemini-send-button {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    color: #ffffff;
    background: #1a73e8;
    font-size: 20px;
    font-weight: 900;
}

.gemini-send-button:hover {
    background: #155fc1;
}

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

.gemini-attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 180px;
    overflow: auto;
    padding: 2px;
}

.gemini-attachment-list[hidden] {
    display: none;
}

.gemini-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: min(340px, 100%);
    min-height: 56px;
    padding: 7px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #f8fafc;
}

.gemini-attachment-info {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.gemini-attachment-info strong,
.gemini-attachment-info span,
.gemini-message-attachment strong,
.gemini-message-attachment small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gemini-attachment-info strong {
    max-width: 176px;
    color: #111827;
    font-size: 13px;
}

.gemini-attachment-info span {
    max-width: 176px;
    color: #64748b;
    font-size: 11px;
}

.gemini-attachment-chip button {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    color: #64748b;
    background: transparent;
    font-size: 18px;
}

.gemini-attachment-chip button:hover {
    color: #dc2626;
    background: #fee2e2;
}

.gemini-chip-preview,
.gemini-file-icon {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 12px;
}

.gemini-chip-preview {
    object-fit: cover;
    background: #e2e8f0;
}

.gemini-file-icon {
    display: grid;
    place-items: center;
    color: #1a73e8;
    background: #e9f1ff;
    font-size: 10px;
    font-weight: 850;
}

.gemini-message {
    width: min(840px, 100%);
    color: #172033;
    animation: messageIn .18s ease both;
}

.gemini-message.user {
    align-self: flex-end;
    width: fit-content;
    max-width: min(760px, 92%);
    padding: 14px 16px;
    border-radius: 24px 24px 6px 24px;
    background: #edf4ff;
}

.gemini-message.assistant {
    align-self: flex-start;
}

.gemini-message.error {
    padding: 14px 16px;
    border: 1px solid #fecdd3;
    border-radius: 18px;
    color: #b91c1c;
    background: #fff1f2;
}

.gemini-message.loading .gemini-message-body {
    color: #64748b;
}

.gemini-message-meta {
    margin-bottom: 8px;
    color: #64748b;
    font-size: 12px;
    font-weight: 780;
}

.gemini-message-body {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: inherit;
    font-size: 15px;
    line-height: 1.75;
}

.gemini-message-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 10px;
}

.gemini-message-attachment {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: min(360px, 100%);
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    color: #0f172a;
    background: #ffffff;
    text-decoration: none;
}

.gemini-message-attachment:hover {
    border-color: #bfdbfe;
    background: #f8fbff;
}

.gemini-message-attachment span {
    min-width: 0;
}

.gemini-message-attachment strong {
    max-width: 220px;
    font-size: 13px;
}

.gemini-message-attachment small {
    max-width: 220px;
    margin-top: 2px;
    color: #64748b;
    font-size: 11px;
}

.gemini-file-preview {
    display: block;
    width: min(300px, 64vw);
    max-height: 280px;
    border-radius: 12px;
    object-fit: cover;
    background: #e2e8f0;
}

.gemini-message-attachment.image .gemini-file-preview,
.gemini-message-attachment.video .gemini-file-preview {
    width: min(320px, 70vw);
}

.gemini-message-attachment.audio {
    align-items: flex-start;
}

.gemini-message-attachment.audio .gemini-file-preview {
    width: min(320px, 70vw);
    max-height: none;
    background: transparent;
}

.gemini-attachment-chip.audio .gemini-file-icon,
.gemini-message-attachment.audio .gemini-file-icon {
    color: #047857;
    background: #dcfce7;
}

.toast.error {
    border-color: #fecdd3;
    color: #b91c1c;
    background: #fff1f2;
}

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

    .gemini-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 20;
        width: min(320px, 88vw);
        transform: translateX(-105%);
        transition: transform .2s ease;
        box-shadow: 22px 0 60px -36px rgba(15, 23, 42, .55);
    }

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

    body.sidebar-open::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 19;
        background: rgba(15, 23, 42, .22);
    }

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

    .gemini-title-block strong {
        max-width: 58vw;
    }

    .gemini-messages {
        padding: 22px 18px 156px;
    }

    .gemini-welcome {
        width: calc(100% - 32px);
        margin-bottom: 170px;
    }
}

@media (max-width: 640px) {
    .gemini-chat-header {
        min-height: 58px;
        padding: 8px 12px;
    }

    .gemini-welcome h1 {
        font-size: 34px;
    }

    .gemini-welcome p {
        font-size: 15px;
    }

    .gemini-composer {
        bottom: 10px;
        width: calc(100% - 20px);
        border-radius: 24px;
    }

    .gemini-main.empty .gemini-composer {
        bottom: 44%;
        transform: translate(-50%, 180px);
    }

    .gemini-composer-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .gemini-composer-tools {
        width: 100%;
    }

    .gemini-model-field {
        flex: 1;
        min-width: 0;
    }

    .gemini-model-field select {
        width: 100%;
    }

    .gemini-send-actions {
        justify-content: flex-end;
    }

    .gemini-message.user {
        max-width: 96%;
    }
}

/* Gemini-inspired user chat polish. Scoped to the user chat shell only. */
.svg-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.ui-icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

body.authenticated {
    background: #ffffff;
}

.gemini-shell {
    grid-template-columns: 276px minmax(0, 1fr);
    background: #ffffff;
}

.gemini-sidebar {
    border-right: 0;
    background: #f7f9fc;
}

.gemini-sidebar-top {
    gap: 18px;
    padding: 16px 14px 12px;
}

.gemini-brand {
    padding: 2px 2px 0;
}

.gemini-brand .brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    color: #1967d2;
    background: #e8f0fe;
    box-shadow: none;
    font-size: 13px;
}

.gemini-brand strong {
    color: #1f2937;
    font-size: 15px;
    font-weight: 650;
}

.gemini-brand span,
.gemini-account span,
.gemini-title-block span {
    color: #6b7280;
}

.gemini-new-button {
    width: fit-content;
    min-width: 132px;
    min-height: 46px;
    padding: 0 18px 0 14px;
    border-radius: 999px;
    color: #233142;
    background: #e8eef9;
    box-shadow: none;
    font-weight: 650;
}

.gemini-new-button:hover {
    background: #dde8f7;
}

.gemini-new-button span {
    width: 24px;
    height: 24px;
    color: #37537a;
    background: transparent;
}

.gemini-search-label {
    gap: 8px;
    padding: 0 2px;
    color: #6b7280;
    font-weight: 650;
}

.gemini-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 999px;
    color: #7b8794;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px #e6ebf2;
}

.gemini-search-box:focus-within {
    box-shadow: inset 0 0 0 1px #8ab4f8, 0 0 0 3px rgba(138, 180, 248, .18);
}

.gemini-search-box input {
    min-height: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.gemini-history-list {
    gap: 2px;
    padding: 8px 10px 14px;
}

.gemini-history-item {
    grid-template-columns: minmax(0, 1fr) 34px;
    border-radius: 20px;
    transition: background .16s ease;
}

.gemini-history-item:hover,
.gemini-history-item.active {
    background: #e9eef6;
}

.gemini-history-open {
    min-height: 44px;
    padding: 8px 8px 8px 14px;
}

.gemini-history-open strong {
    color: #2b3340;
    font-size: 13px;
    font-weight: 550;
}

.gemini-history-delete {
    opacity: 0;
    color: #6b7280;
    transition: opacity .16s ease, background .16s ease, color .16s ease;
}

.gemini-history-item:hover .gemini-history-delete,
.gemini-history-item:focus-within .gemini-history-delete {
    opacity: 1;
}

.gemini-history-delete .ui-icon,
.gemini-attachment-chip button .ui-icon {
    width: 18px;
    height: 18px;
}

.gemini-account-panel {
    padding: 12px 14px 16px;
    border-top: 0;
    background: transparent;
}

.gemini-account {
    padding: 10px 12px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px #e6ebf2;
}

.gemini-account-actions {
    gap: 8px;
}

.gemini-link-button {
    min-height: 38px;
    border: 0;
    background: transparent;
    color: #475569;
    font-weight: 650;
}

.gemini-link-button:hover {
    background: #e9eef6;
}

.gemini-main {
    background: #ffffff;
}

.gemini-chat-header {
    min-height: 64px;
    padding: 10px 20px 8px;
    border-bottom: 0;
    background: #ffffff;
}

.gemini-title-block {
    display: grid;
    gap: 2px;
}

.gemini-product-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    min-width: 0;
}

.gemini-product-name {
    color: #1f2937;
    font-size: 21px;
    font-weight: 500;
    line-height: 1.2;
}

.gemini-current-title {
    max-width: min(280px, 28vw);
    overflow: hidden;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gemini-model-field {
    height: 34px;
    max-width: min(330px, 44vw);
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: #f1f4f9;
}

.gemini-model-field:hover,
.gemini-model-field:focus-within {
    background: #e9eef6;
}

.gemini-model-field select {
    width: auto;
    max-width: min(260px, 38vw);
    min-height: 34px;
    height: 34px;
    padding: 0 18px 0 0;
    color: #405066;
    font-size: 13px;
    font-weight: 650;
}

.gemini-icon-button {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    color: #3f4b5f;
    background: transparent;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}

.gemini-icon-button:hover {
    border-color: transparent;
    background: #f1f4f9;
}

.gemini-messages {
    gap: 26px;
    padding: 26px max(24px, calc((100vw - 1040px) / 2)) 156px;
}

.gemini-welcome {
    align-self: center;
    justify-self: center;
    width: min(820px, calc(100% - 48px));
    margin-bottom: 156px;
}

.gemini-welcome h1 {
    display: grid;
    gap: 2px;
    margin: 0;
    font-size: 56px;
    line-height: 1.05;
    font-weight: 650;
}

.gemini-welcome h1 span {
    color: #4b5563;
}

.gemini-welcome h1 strong {
    width: fit-content;
    max-width: 100%;
    overflow-wrap: anywhere;
    background: linear-gradient(90deg, #4285f4 0%, #7c3aed 36%, #db4437 70%, #f4b400 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font: inherit;
}

.gemini-welcome p {
    max-width: 560px;
    margin: 16px 0 0;
    color: #6b7280;
    font-size: 18px;
    line-height: 1.6;
}

.gemini-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}

.gemini-suggestion-chip {
    min-height: 44px;
    padding: 0 15px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    color: #334155;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    font-weight: 650;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.gemini-suggestion-chip:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    transform: translateY(-1px);
}

.gemini-composer {
    width: min(792px, calc(100% - 48px));
    gap: 6px;
    padding: 10px 12px 10px;
    border: 0;
    border-radius: 30px;
    background: #f1f4f9;
    box-shadow: 0 18px 50px -42px rgba(15, 23, 42, .6);
}

.gemini-main.empty .gemini-composer {
    bottom: 50%;
    transform: translate(-50%, 178px);
}

.gemini-main.dragging .gemini-composer,
.gemini-composer:focus-within {
    border-color: transparent;
    background: #eef4ff;
    box-shadow: 0 20px 58px -42px rgba(26, 115, 232, .72), 0 0 0 3px rgba(138, 180, 248, .18);
}

.gemini-drop-hint {
    min-height: 62px;
    border-radius: 22px;
    color: #1967d2;
    background: #e8f0fe;
}

.gemini-composer textarea {
    min-height: 52px;
    padding: 12px 14px 8px;
    color: #1f2937;
    font-size: 16px;
}

.gemini-composer textarea::placeholder {
    color: #7b8794;
}

.gemini-composer-bar {
    min-height: 42px;
}

.gemini-attach-button {
    color: #405066;
    background: transparent;
}

.gemini-attach-button:hover {
    background: #e4eaf3;
}

.gemini-send-actions {
    margin-left: auto;
}

#stopButton .ui-icon {
    fill: currentColor;
    stroke: currentColor;
}

.gemini-send-button {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    color: #ffffff;
    background: #1a73e8;
    transition: background .16s ease, transform .16s ease;
}

.gemini-send-button:hover {
    background: #1765cc;
    transform: translateY(-1px);
}

.gemini-send-button:disabled,
.gemini-send-button:disabled:hover {
    color: #94a3b8;
    background: #e5e7eb;
    cursor: not-allowed;
    opacity: 1;
    transform: none;
}

.gemini-attachment-list {
    gap: 8px;
    padding: 2px 2px 4px;
}

.gemini-attachment-chip {
    min-height: 56px;
    border: 0;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px #e2e8f0;
}

.gemini-attachment-chip button {
    color: #64748b;
}

.gemini-message {
    width: min(860px, 100%);
}

.gemini-message.user {
    align-self: flex-end;
}

.gemini-message.assistant {
    align-self: flex-start;
}

.gemini-message-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.gemini-message-version-switcher {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-right: 4px;
    color: #6b7280;
    font-size: 13px;
    font-weight: 650;
}

.gemini-message-version-switcher span {
    min-width: 36px;
    text-align: center;
}

.gemini-message-version-switcher .gemini-message-action {
    width: 28px;
    height: 28px;
    color: #7b8493;
}

.gemini-message-version-switcher .ui-icon {
    width: 18px;
    height: 18px;
}

.gemini-message-actions[hidden],
.gemini-message-body[hidden] {
    display: none !important;
}

.gemini-message.user .gemini-message-actions {
    justify-content: flex-end;
}

.gemini-message-action {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    color: #3f4856;
    background: transparent;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}

.gemini-message-action:hover {
    color: #111827;
    background: #e7ecf3;
    transform: translateY(-1px);
}

.gemini-message-action:disabled {
    cursor: not-allowed;
    opacity: .45;
    transform: none;
}

.gemini-message-edit {
    display: grid;
    gap: 10px;
    width: min(680px, 100%);
}

.gemini-message.user .gemini-message-edit {
    margin-left: auto;
}

.gemini-message-edit textarea {
    width: 100%;
    min-height: 72px;
    max-height: 220px;
    padding: 12px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 16px;
    outline: 0;
    resize: none;
    color: #111827;
    background: #ffffff;
    font: inherit;
    line-height: 1.55;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, .08);
}

.gemini-message-edit textarea:focus {
    border-color: #8ab4f8;
    box-shadow: 0 0 0 4px rgba(26, 115, 232, .12);
}

.gemini-message-edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.gemini-message.user {
    max-width: min(720px, 86%);
    padding: 12px 16px;
    border-radius: 22px 22px 6px 22px;
    background: #e9eef6;
}

.gemini-message.assistant {
    padding: 0 4px;
}

.gemini-message-meta {
    color: #6b7280;
    font-size: 12px;
    font-weight: 650;
}

.gemini-message-body {
    color: #1f2937;
    font-size: 15.5px;
    line-height: 1.75;
}

.gemini-message.loading .gemini-message-body {
    color: #6b7280;
}

.gemini-message-attachment {
    border: 0;
    border-radius: 18px;
    background: #f8fafc;
    box-shadow: inset 0 0 0 1px #e2e8f0;
}

.gemini-file-preview {
    border-radius: 14px;
}

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

    .gemini-sidebar {
        width: min(304px, 86vw);
    }

    .gemini-chat-header {
        padding: 8px 12px;
    }

    .gemini-current-title {
        display: none;
    }

    .gemini-welcome {
        width: calc(100% - 36px);
        margin-bottom: 170px;
    }

    .gemini-welcome h1 {
        font-size: 44px;
    }
}

@media (max-width: 640px) {
    .gemini-product-line {
        gap: 6px;
    }

    .gemini-product-name {
        font-size: 19px;
    }

    .gemini-model-field {
        max-width: 62vw;
    }

    .gemini-model-field select {
        max-width: 56vw;
        font-size: 12px;
    }

    .gemini-welcome {
        margin-bottom: 190px;
    }

    .gemini-welcome h1 {
        font-size: 36px;
    }

    .gemini-welcome p {
        font-size: 16px;
    }

    .gemini-suggestions {
        gap: 8px;
        margin-top: 22px;
    }

    .gemini-suggestion-chip {
        min-height: 40px;
        padding: 0 12px;
        font-size: 13px;
    }

    .gemini-composer {
        bottom: 10px;
        width: calc(100% - 20px);
        border-radius: 26px;
    }

    .gemini-main.empty .gemini-composer {
        bottom: 44%;
        transform: translate(-50%, 190px);
    }

    .gemini-composer-bar {
        flex-direction: row;
        align-items: center;
    }

    .gemini-composer-tools {
        width: auto;
    }

    .gemini-message.user {
        max-width: 94%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gemini-message,
    .gemini-sidebar,
    .gemini-suggestion-chip,
    .gemini-send-button,
    .gemini-icon-button {
        animation: none !important;
        transition: none !important;
    }
}

.gemini-main.empty .gemini-welcome {
    transform: translateY(-88px);
}

.gemini-main.empty .gemini-composer {
    bottom: 64px;
    transform: translateX(-50%);
}

@media (max-width: 900px) {
    .gemini-main.empty .gemini-welcome {
        transform: translateY(-72px);
    }

    .gemini-main.empty .gemini-composer {
        bottom: 42px;
        transform: translateX(-50%);
    }
}

@media (max-width: 640px) {
    .gemini-main.empty .gemini-welcome {
        transform: translateY(-48px);
    }

    .gemini-main.empty .gemini-composer {
        bottom: 10px;
        transform: translateX(-50%);
    }
}

.gemini-history-item {
    grid-template-columns: minmax(0, 1fr) 34px 34px;
}

.gemini-history-item.editing {
    grid-template-columns: minmax(0, 1fr);
    background: #e9eef6;
}

.gemini-history-edit,
.gemini-history-action {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    color: #6b7280;
    background: transparent;
    transition: opacity .16s ease, background .16s ease, color .16s ease;
}

.gemini-history-edit {
    opacity: 0;
}

.gemini-history-item:hover .gemini-history-edit,
.gemini-history-item:focus-within .gemini-history-edit,
.gemini-history-item:hover .gemini-history-delete,
.gemini-history-item:focus-within .gemini-history-delete {
    opacity: 1;
}

.gemini-history-edit:hover,
.gemini-history-action:hover {
    color: #1a73e8;
    background: #dbeafe;
}

.gemini-history-action.save {
    color: #1a73e8;
}

.gemini-history-rename {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 30px 30px;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 6px;
}

.gemini-history-rename input {
    width: 100%;
    height: 34px;
    min-width: 0;
    padding: 0 10px;
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    color: #1f2937;
    background: #ffffff;
    font-size: 13px;
    font-weight: 600;
    outline: none;
}

.gemini-history-rename input:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, .14);
}

.gemini-history-edit .ui-icon,
.gemini-history-action .ui-icon {
    width: 17px;
    height: 17px;
}
