:root {
    color-scheme: dark;
    --background: #0b0c10;
    --surface: #111318;
    --surface-raised: #181b22;
    --surface-hover: #20242d;
    --border: #292e39;
    --border-strong: #3a4250;
    --text: #f3f4f6;
    --muted: #949baa;
    --accent: #7c5cff;
    --accent-hover: #9278ff;
    --danger: #ff6b78;
    --success: #55d59a;
    --warning: #f0bd63;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
    color: var(--text);
    background: var(--background);
}

button,
input,
select,
textarea {
    color: inherit;
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

[hidden] {
    display: none !important;
}

.shell {
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    width: 100%;
    height: 100dvh;
}

.sidebar {
    z-index: 20;
    display: flex;
    min-height: 0;
    flex-direction: column;
    gap: 18px;
    padding: 20px 16px;
    overflow: hidden;
    background: var(--surface);
    border-right: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 2px 4px;
}

.brand-mark {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    font-weight: 800;
    background: linear-gradient(140deg, var(--accent), #38bdf8);
    border-radius: 11px;
}

.brand strong,
.brand span {
    display: block;
}

.brand span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.primary,
.secondary,
.stop-button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 15px;
    font-weight: 650;
    border-radius: 10px;
}

.primary {
    color: white;
    background: var(--accent);
}

.primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.secondary {
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
}

.secondary:hover:not(:disabled) {
    background: var(--surface-hover);
}

.wide {
    width: 100%;
}

.section-label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.chat-navigation {
    display: flex;
    min-height: 100px;
    flex: 1;
    flex-direction: column;
    gap: 8px;
}

.chat-list {
    min-height: 0;
    overflow-y: auto;
}

.chat-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 32px;
    gap: 3px;
    margin: 3px 0;
    border-radius: 9px;
}

.chat-row.active,
.chat-row:hover {
    background: var(--surface-hover);
}

.chat-open,
.chat-delete {
    min-width: 0;
    color: var(--muted);
    background: transparent;
}

.chat-open {
    padding: 10px;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-row.active .chat-open {
    color: var(--text);
}

.chat-delete {
    border-radius: 8px;
    opacity: 0;
}

.chat-row:hover .chat-delete,
.chat-row.active .chat-delete,
.chat-delete:focus-visible {
    opacity: 1;
}

.chat-delete:hover {
    color: var(--danger);
    background: #ff6b7818;
}

.credentials {
    display: grid;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.credentials label,
.model-control label,
.reasoning-control label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.text-input {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    background: var(--background);
    border: 1px solid var(--border-strong);
    border-radius: 9px;
}

.privacy-note {
    margin: 3px 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.danger-link {
    justify-self: start;
    padding: 3px 0;
    color: var(--danger);
    font-size: 12px;
    background: transparent;
}

.workspace {
    display: grid;
    min-width: 0;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.topbar {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) 150px minmax(180px, 0.7fr);
    gap: 14px;
    align-items: end;
    padding: 14px 22px;
    background: #0b0c10e8;
    border-bottom: 1px solid var(--border);
}

.model-control,
.reasoning-control {
    display: grid;
    gap: 6px;
}

.topbar-information {
    display: grid;
    gap: 3px;
    align-self: center;
    color: var(--muted);
    font-size: 12px;
}

.status[data-tone="ok"] {
    color: var(--success);
}

.status[data-tone="error"],
.model-hint[data-tone="warning"] {
    color: var(--warning);
}

.icon-button {
    display: none;
    width: 40px;
    height: 40px;
    color: var(--text);
    background: var(--surface-raised);
    border-radius: 9px;
}

.backdrop {
    display: none;
}