* {
    box-sizing: border-box;
}

:root {
    --bg: #202123;
    --bg-soft: #171717;
    --panel: #2b2d31;
    --panel-soft: #111214;
    --panel-border: rgba(255, 255, 255, 0.08);
    --text: #ececf1;
    --muted: #a9acb5;
    --green: #19c37d;
    --green-strong: #12a56a;
    --danger: #ef4444;
    --warning: #f59e0b;
    --admin: #7c3aed;
    --shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    overflow: hidden;
}

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

button,
input,
textarea {
    font: inherit;
}

textarea {
    resize: none;
}

.app-shell {
    display: grid;
    grid-template-columns: 290px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--bg-soft);
    border-right: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 14px;
    gap: 14px;
    position: relative;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2f81f7, #19c37d);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
}

.brand-text strong {
    display: block;
    font-size: 15px;
}

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

.sidebar-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--panel-border);
    border-radius: 18px;
    padding: 10px;
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.button,
.ghost-button,
.auth-tab,
.agent-item,
.chat-row,
.icon-button {
    transition: all 0.18s ease;
}

.button {
    border: 0;
    border-radius: 14px;
    background: var(--green);
    color: #03160f;
    padding: 12px 16px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.button:hover {
    background: var(--green-strong);
}

.button.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.button.secondary:hover {
    background: rgba(255, 255, 255, 0.14);
}

.button.danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fecaca;
}

.button.small {
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 13px;
}

.ghost-button {
    display: flex;
    width: 100%;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    padding: 12px 14px;
    cursor: pointer;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.ghost-button:hover,
.chat-row:hover,
.agent-item:hover,
.icon-button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-section-title {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0 6px 8px;
}

.agent-list,
.chat-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    background: transparent;
    border: 0;
    color: var(--text);
    padding: 11px 12px;
    border-radius: 14px;
    cursor: pointer;
}

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

.sidebar-footer {
    margin-top: auto;
}

.auth-box {
    display: grid;
    gap: 10px;
}

.account-box {
    position: relative;
}

.account-trigger {
    width: 100%;
    display: grid;
    grid-template-columns: 42px 1fr auto;
    gap: 12px;
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
    border-radius: 14px;
}

.account-trigger:hover,
.account-box.open .account-trigger {
    background: rgba(255, 255, 255, 0.06);
}

.account-chevron {
    color: var(--muted);
    font-size: 12px;
}

.account-menu {
    position: absolute;
    left: calc(100% + 12px);
    bottom: 0;
    width: 230px;
    border-radius: 18px;
    background: #1f2023;
    border: 1px solid var(--panel-border);
    box-shadow: var(--shadow);
    padding: 8px;
    z-index: 70;
}

.account-menu button,
.account-menu a {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    border-radius: 12px;
    padding: 11px 12px;
    cursor: pointer;
    font: inherit;
}

.account-menu button:hover,
.account-menu a:hover {
    background: rgba(255, 255, 255, 0.08);
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: white;
}

.user-meta strong,
.user-meta span {
    display: block;
}

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

.user-meta strong {
    font-size: 15px;
}

.chat-list-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    flex: 1;
}

.chat-list-scroll {
    overflow-y: auto;
    min-height: 0;
    padding-right: 2px;
}

.chat-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 12px 12px 12px 14px;
    border-radius: 16px;
    color: inherit;
    border: 1px solid transparent;
    position: relative;
}

.chat-row.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--panel-border);
}

.chat-main {
    min-width: 0;
}

.chat-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-subtitle {
    display: block;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-controls {
    position: relative;
}

.icon-button {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
}

.chat-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 180px;
    border-radius: 16px;
    background: #111214;
    border: 1px solid var(--panel-border);
    box-shadow: var(--shadow);
    padding: 8px;
    z-index: 50;
}

.chat-menu button {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    border-radius: 12px;
    padding: 11px 12px;
    cursor: pointer;
}

.chat-menu button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.chat-menu.open-up {
    top: auto;
    bottom: calc(100% + 8px);
}

.chat-menu .danger-text {
    color: #fca5a5;
}

.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--panel-border);
    background: rgba(32, 33, 35, 0.86);
    backdrop-filter: blur(16px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.mobile-sidebar-toggle {
    display: none;
}

.chat-context strong {
    display: block;
    font-size: 16px;
}

.chat-context span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

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

.admin-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(124, 58, 237, 0.16);
    color: #ddd6fe;
    border: 1px solid rgba(124, 58, 237, 0.35);
    padding: 10px 14px;
    border-radius: 14px;
    font-weight: 700;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
    font-size: 12px;
}

.flash-stack {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 200;
    display: grid;
    gap: 10px;
    width: min(380px, calc(100vw - 24px));
}

.flash {
    border-radius: 16px;
    padding: 14px 16px;
    border: 1px solid var(--panel-border);
    background: rgba(17, 18, 20, 0.96);
    box-shadow: var(--shadow);
}

.flash.success { border-color: rgba(25, 195, 125, 0.35); }
.flash.error { border-color: rgba(239, 68, 68, 0.35); }
.flash.info { border-color: rgba(59, 130, 246, 0.35); }

.content {
    flex: 1;
    min-height: 0;
    display: flex;
}

.content > * {
    width: 100%;
}

.chat-layout {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.message-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 28px 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    width: min(900px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 14px;
    align-items: start;
}

.message-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.message.user .message-avatar {
    background: #2563eb;
}

.message.assistant .message-avatar {
    background: #0f766e;
}

.message-body {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--panel-border);
    border-radius: 18px;
    padding: 18px 18px 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.message.user .message-body {
    background: rgba(37, 99, 235, 0.09);
}

.message-body p {
    margin: 0 0 12px;
    white-space: pre-wrap;
    line-height: 1.65;
}

.message-body p:last-child {
    margin-bottom: 0;
}

.message-content {
    color: var(--text);
}

.message-content > *:first-child {
    margin-top: 0;
}

.message-content > *:last-child {
    margin-bottom: 0;
}

.message-heading {
    margin: 0 0 14px;
    font-size: 20px;
    line-height: 1.3;
}

.message-heading + p,
.message-heading + ul,
.message-heading + ol,
.message-heading + blockquote,
.message-heading + .message-code {
    margin-top: 0;
}

.message-list-block {
    margin: 0 0 14px;
    padding-left: 22px;
    line-height: 1.7;
}

.message-list-block li + li {
    margin-top: 6px;
}

.message-list-block.ordered {
    padding-left: 24px;
}

.message-quote {
    margin: 0 0 14px;
    padding: 14px 16px;
    border-left: 3px solid rgba(125, 211, 252, 0.55);
    background: rgba(255, 255, 255, 0.035);
    border-radius: 0 16px 16px 0;
    color: #d8e7ff;
    line-height: 1.7;
}

.message-code-wrap {
    margin: 0 0 14px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 12, 16, 0.92);
}

.message-code-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.035);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.message-code-language {
    font-size: 12px;
    line-height: 1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(229, 237, 247, 0.72);
}

.message-code-copy {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: #f3f7fd;
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.18s ease;
}

.message-code-copy:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.18);
}

.message-code-copy.is-copied {
    background: rgba(25, 195, 125, 0.16);
    border-color: rgba(25, 195, 125, 0.34);
    color: #dcfff0;
}

.message-code {
    margin: 0;
    padding: 14px 16px;
    overflow-x: auto;
}

.message-code code {
    display: block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    line-height: 1.65;
    color: #e5edf7;
    white-space: pre;
}

.message-inline-code {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.92em;
}

.bridge-thinking-card,
.bridge-thinking-summary {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.bridge-thinking-toggle {
    appearance: none;
    cursor: pointer;
    text-align: left;
}

.bridge-thinking-pill,
.bridge-thinking-summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 18px;
    width: fit-content;
    max-width: 100%;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #eef5ff;
    font-weight: 700;
    letter-spacing: 0.01em;
    backdrop-filter: blur(10px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.bridge-thinking-card.is-live .bridge-thinking-pill {
    background: rgba(125, 211, 252, 0.08);
    border-color: rgba(125, 211, 252, 0.16);
}

.bridge-thinking-summary-pill {
    background: rgba(255, 255, 255, 0.045);
    border-color: rgba(255, 255, 255, 0.07);
    color: rgba(232, 241, 255, 0.92);
}

.bridge-thinking-label-stack {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.bridge-thinking-inline-elapsed {
    font-size: 12px;
    font-weight: 600;
    color: rgba(223, 236, 255, 0.68);
}

.bridge-thinking-caret {
    margin-left: auto;
    color: rgba(255, 255, 255, 0.52);
    transition: transform 0.18s ease;
}

[data-thinking-card][data-thinking-expanded="1"] .bridge-thinking-caret {
    transform: rotate(180deg);
}

.bridge-thinking-panel {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(10px);
}

.bridge-thinking-panel-caption {
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(223, 236, 255, 0.54);
}

.bridge-thinking-timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.bridge-thinking-step {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    color: rgba(223, 236, 255, 0.56);
}

.bridge-thinking-step strong {
    display: block;
    margin-bottom: 3px;
    font-size: 14px;
    color: inherit;
}

.bridge-thinking-step p {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: inherit;
}

.bridge-thinking-step-dot {
    width: 14px;
    height: 14px;
    margin-top: 3px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 0 0 3px transparent;
}

.bridge-thinking-step.is-active {
    color: #eef6ff;
}

.bridge-thinking-step.is-active .bridge-thinking-step-dot {
    border-color: rgba(125, 211, 252, 0.48);
    background: rgba(125, 211, 252, 0.16);
    box-shadow: inset 0 0 0 3px rgba(125, 211, 252, 0.2);
}

.bridge-thinking-step.is-done {
    color: rgba(223, 255, 238, 0.9);
}

.bridge-thinking-step.is-done .bridge-thinking-step-dot {
    border-color: rgba(25, 195, 125, 0.34);
    background: rgba(25, 195, 125, 0.18);
    box-shadow: inset 0 0 0 3px rgba(25, 195, 125, 0.18);
}

.bridge-thinking-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #d9f2ff;
}

.bridge-thinking-dots span {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.35;
    animation: bridgeThinkingPulse 1.2s infinite ease-in-out;
}

.bridge-thinking-dots span:nth-child(2) {
    animation-delay: 0.16s;
}

.bridge-thinking-dots span:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes bridgeThinkingPulse {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.35;
    }
    40% {
        transform: translateY(-2px);
        opacity: 1;
    }
}

.message-meta {
    color: var(--muted);
    font-size: 12px;
    margin-top: 12px;
}

.hero {
    width: min(900px, 100%);
    margin: auto;
    padding: 0 24px 36px;
}

.hero-card {
    border-radius: 28px;
    border: 1px solid var(--panel-border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    padding: 32px;
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0 0 12px;
    color: #7dd3fc;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
}

.hero-card h1,
.install-card h2,
.auth-panel h2,
.empty-state h3,
.admin-header-card h1,
.admin-section h2 {
    margin: 0 0 12px;
}

.hero-card p,
.install-card p,
.auth-panel p,
.empty-state p,
.subtle,
.admin-user-card p {
    color: var(--muted);
    line-height: 1.6;
    margin: 0;
}

.hero-grid {
    margin-top: 26px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.hero-tile {
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 18px;
    padding: 18px;
}

.hero-tile strong {
    display: block;
    margin-bottom: 8px;
}

.input-panel {
    padding: 16px 20px 24px;
    border-top: 1px solid var(--panel-border);
    background: linear-gradient(180deg, rgba(32, 33, 35, 0), rgba(32, 33, 35, 1) 30%);
}

.input-wrap {
    width: min(900px, 100%);
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    padding: 12px;
    box-shadow: var(--shadow);
}

.input-wrap textarea {
    width: 100%;
    min-height: 86px;
    border: 0;
    background: transparent;
    color: var(--text);
    padding: 10px 12px;
    outline: none;
}

.input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 4px 4px 0;
}

.input-hint {
    color: var(--muted);
    font-size: 12px;
}

.install-screen,
.centered-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.install-card,
.auth-panel,
.empty-state,
.admin-header-card,
.admin-section,
.stat-card {
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 26px;
    box-shadow: var(--shadow);
}

.install-card {
    width: min(760px, 100%);
    padding: 30px;
}

.install-card ul {
    color: var(--muted);
    line-height: 1.8;
}

.error-card {
    border-color: rgba(239, 68, 68, 0.35);
}

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 180;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-modal.visible {
    display: flex;
}

.auth-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(8px);
}

.auth-dialog {
    position: relative;
    width: min(560px, 100%);
    background: #141517;
    border: 1px solid var(--panel-border);
    border-radius: 28px;
    padding: 16px;
    box-shadow: var(--shadow);
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.auth-tab {
    flex: 1;
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    padding: 12px;
    cursor: pointer;
    font-weight: 700;
}

.auth-tab.active {
    background: rgba(25, 195, 125, 0.14);
    border-color: rgba(25, 195, 125, 0.35);
}

.auth-panel {
    padding: 22px;
}

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

.form-grid label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
}

.form-grid input,
.form-grid textarea,
.select-like {
    width: 100%;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    border-radius: 16px;
    padding: 13px 14px;
    outline: none;
}

.form-grid input:focus,
.form-grid textarea:focus {
    border-color: rgba(25, 195, 125, 0.45);
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
}

.link-button {
    border: 0;
    background: transparent;
    color: #7dd3fc;
    cursor: pointer;
    padding: 0;
}

.close-auth {
    position: absolute;
    top: 18px;
    right: 18px;
}

.empty-state {
    width: min(680px, 100%);
    padding: 30px;
    text-align: center;
}

.empty-state.compact {
    width: 100%;
    text-align: left;
}

.tiny-meta {
    display: inline-block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 6px;
}

.admin-page {
    width: min(1320px, 100%);
    margin: 0 auto;
    padding: 28px;
}

.admin-header-card {
    padding: 28px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: start;
}

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

.inline-form {
    display: inline-flex;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 22px 0;
}

.stat-card {
    padding: 22px;
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 24px;
}

.admin-columns {
    display: grid;
    grid-template-columns: 0.95fr 1.35fr;
    gap: 18px;
}

.admin-section {
    padding: 22px;
}

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

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    font-weight: 700;
}

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

.admin-user-card {
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 18px;
    padding: 18px;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
}

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

.table-wrap {
    overflow-x: auto;
}

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

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 14px 12px;
    border-bottom: 1px solid var(--panel-border);
    color: var(--text);
    font-size: 14px;
}

.admin-table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.role-badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
}

.role-admin { background: rgba(124, 58, 237, 0.18); color: #ddd6fe; }
.role-user { background: rgba(59, 130, 246, 0.15); color: #bfdbfe; }
.status-pending { background: rgba(245, 158, 11, 0.16); color: #fcd34d; }
.status-active { background: rgba(25, 195, 125, 0.16); color: #bbf7d0; }
.status-rejected, .status-blocked { background: rgba(239, 68, 68, 0.14); color: #fecaca; }

[hidden] {
    display: none !important;
}

@media (max-width: 1180px) {
    .admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-columns { grid-template-columns: 1fr; }
    .hero-grid { grid-template-columns: 1fr; }
}

@media (max-width: 920px) {
    body {
        overflow: auto;
    }

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

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(86vw, 320px);
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: var(--shadow);
    }

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

    .sidebar > * {
        width: 100%;
    }

    .mobile-sidebar-toggle {
        display: inline-flex;
    }

    .topbar {
        padding-inline: 16px;
    }

    .message-list,
    .input-panel,
    .hero {
        padding-inline: 16px;
    }

    .message {
        grid-template-columns: 38px 1fr;
    }

    .message-avatar {
        width: 38px;
        height: 38px;
        border-radius: 12px;
    }
}

@media (max-width: 640px) {
    .flash-stack {
        top: auto;
        bottom: 16px;
        right: 12px;
        left: 12px;
        width: auto;
    }

    .topbar {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .topbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .admin-page {
        padding: 16px;
    }

    .admin-header-card,
    .admin-user-card,
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

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

.chat-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.chat-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    flex: 0 0 20px;
    opacity: 0.9;
}

.chat-row.archived {
    opacity: 0.82;
}

.archive-section-label {
    margin-top: 10px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-menu {
    width: 196px;
}

.mode-strip {
    border-bottom: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.02);
}

.mode-strip-inner {
    width: min(900px, 100%);
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.mode-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.mode-form label {
    color: var(--muted);
    font-size: 13px;
}

.mode-form select {
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 14px;
    outline: none;
    min-width: 160px;
}

.mode-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mode-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(25, 195, 125, 0.14);
    border: 1px solid rgba(25, 195, 125, 0.25);
    color: #b7f7d4;
    font-size: 12px;
    font-weight: 700;
}

.subtle-pill {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--muted);
}

@media (max-width: 900px) {
    .mode-strip-inner {
        padding: 12px 16px;
    }

    .mode-form {
        width: 100%;
    }

    .mode-form select {
        width: 100%;
    }
}


@media (max-width: 900px) {
    .account-menu {
        left: auto;
        right: 0;
        bottom: calc(100% + 10px);
        width: min(260px, calc(100vw - 40px));
    }
}

/* --- Pakiet #7: menu, strony konta, powiadomienia --- */
.chat-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 212px;
    max-width: calc(100vw - 24px);
    border-radius: 18px;
    background: rgba(10, 11, 14, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow: 0 24px 44px rgba(0, 0, 0, 0.48);
    z-index: 500;
}

.chat-menu button {
    padding: 12px 13px;
}

.chat-menu .danger-text {
    color: #f87171;
}

.flash-stack {
    top: 18px;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    width: min(560px, calc(100vw - 28px));
}

.flash {
    text-align: center;
    backdrop-filter: blur(18px);
    transition: opacity 0.24s ease, transform 0.24s ease;
}

.flash.is-hiding {
    opacity: 0;
    transform: translateY(-8px);
}

.account-menu {
    width: 236px;
}

.account-menu a,
.account-menu button {
    font-weight: 500;
}

.settings-page {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px;
}

.settings-grid {
    width: min(1060px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.settings-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    padding: 22px;
    box-shadow: var(--shadow);
}

.settings-card.hero-card {
    background: linear-gradient(180deg, rgba(124, 58, 237, 0.10), rgba(255, 255, 255, 0.03));
}

.profile-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.large-avatar {
    width: 62px;
    height: 62px;
    border-radius: 18px;
    font-size: 24px;
}

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

.info-list div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.info-list span,
.preview-card p,
.help-card,
.shortcut-list span,
.settings-form label,
.settings-card .subtle {
    color: var(--muted);
}

.info-list strong {
    text-align: right;
    word-break: break-word;
}

.settings-form {
    display: grid;
    gap: 14px;
}

.settings-form label {
    display: grid;
    gap: 8px;
    font-size: 14px;
}

.settings-form input,
.settings-form select,
.settings-form textarea {
    width: 100%;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 12px 14px;
    outline: none;
}

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

.checkbox-row {
    grid-template-columns: 18px 1fr;
    align-items: center;
    gap: 12px;
    display: grid !important;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.checkbox-row input {
    width: 18px;
    height: 18px;
    margin: 0;
}

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

.shortcut-list div {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
}

kbd {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-width: 2px;
    border-radius: 10px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

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

.help-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.help-card:hover {
    background: rgba(255, 255, 255, 0.07);
}

.preview-card {
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.preview-badge {
    display: inline-flex;
    align-items: center;
    padding: 9px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 14px;
    color: #d1fae5;
    background: rgba(25, 195, 125, 0.14);
    border: 1px solid rgba(25, 195, 125, 0.28);
}

.preview-badge.accent-blue {
    color: #dbeafe;
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(59, 130, 246, 0.28);
}

.preview-badge.accent-violet {
    color: #ede9fe;
    background: rgba(124, 58, 237, 0.14);
    border-color: rgba(124, 58, 237, 0.28);
}

body.accent-blue .button,
body.accent-blue .brand-mark {
    background: linear-gradient(135deg, #2563eb, #60a5fa);
}

body.accent-violet .button,
body.accent-violet .brand-mark {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
}

body.accent-blue .button:hover,
body.accent-violet .button:hover {
    filter: brightness(1.06);
}

body.density-compact .message-list {
    gap: 10px;
}

body.density-compact .message-body {
    padding: 13px 14px;
}

body.sidebar-compact .app-shell {
    grid-template-columns: 268px 1fr;
}

body.sidebar-compact .sidebar {
    padding: 10px;
    gap: 10px;
}

@media (max-width: 900px) {
    .settings-page {
        padding: 16px;
    }

    .settings-grid,
    .help-grid {
        grid-template-columns: 1fr;
    }

    .flash-stack {
        left: 12px;
        right: 12px;
        transform: none;
        width: auto;
    }
}

/* Paczka 8: role, limity, pomoc, menu overlay */
.flash-stack {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(560px, calc(100vw - 28px));
}

.chat-menu {
    position: fixed;
    z-index: 1200;
    width: 196px;
}

.agent-item.is-locked,
.agent-item:disabled {
    opacity: 0.58;
    cursor: not-allowed;
}

.help-page-shell {
    padding-top: 18px;
}

.help-layout {
    width: min(1180px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 18px;
    align-items: start;
}

.help-sidebar-card {
    position: sticky;
    top: 0;
}

.help-nav-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.help-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.05);
    background: rgba(255,255,255,0.03);
    color: var(--muted);
}

.help-nav-item:hover,
.help-nav-item.active {
    background: rgba(255,255,255,0.08);
    color: var(--text);
    border-color: var(--panel-border);
}

.help-content-card {
    min-height: 420px;
}

.help-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 14px;
    margin-top: 18px;
}

.admin-columns-wide {
    grid-template-columns: 1.15fr 0.95fr;
}

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

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

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

.role-edit-card {
    padding: 20px;
}

.role-agent-box {
    display: grid;
    gap: 10px;
}

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

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

.inline-role-form {
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: 240px;
}

.table-select {
    width: 100%;
    border: 1px solid var(--panel-border);
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    color: var(--text);
    padding: 9px 10px;
}

.compact-actions {
    gap: 6px;
}

.info-list strong {
    max-width: 72%;
}

@media (max-width: 1100px) {
    .help-layout,
    .admin-columns-wide,
    .role-card-grid,
    .settings-grid,
    .help-stat-grid {
        grid-template-columns: 1fr;
    }

    .role-form-grid,
    .compact-role-form,
    .agent-checkbox-grid,
    .agent-checkbox-grid.compact {
        grid-template-columns: 1fr;
    }

    .help-sidebar-card {
        position: static;
    }
}


/* Paczka 9: prawa kolumna nawigacji + scroll admina */
.main {
    height: 100vh;
}

.content {
    min-height: 0;
    overflow: hidden;
}

.admin-page,
.settings-page {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
}

.admin-page {
    padding-bottom: 42px;
}

.help-layout {
    width: min(1320px, 100%);
    grid-template-columns: minmax(0, 1fr) 320px;
}

.help-content-card {
    order: 1;
    min-width: 0;
}

.help-sidebar-card {
    order: 2;
    position: sticky;
    top: 0;
    width: 100%;
    max-width: 320px;
    justify-self: end;
}

.admin-shell {
    width: min(1380px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 18px;
    align-items: start;
}

.admin-main-column {
    min-width: 0;
    display: grid;
    gap: 18px;
}

.admin-side-column {
    min-width: 0;
}

.admin-side-card {
    position: sticky;
    top: 0;
    display: grid;
    gap: 18px;
}

.admin-nav-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.05);
    background: rgba(255,255,255,0.03);
    color: var(--muted);
}

.admin-nav-item:hover,
.admin-nav-item.active {
    background: rgba(255,255,255,0.08);
    color: var(--text);
    border-color: var(--panel-border);
}

.admin-nav-item strong {
    display: block;
    font-size: 14px;
}

.admin-nav-item span {
    font-size: 12px;
    color: inherit;
}

.admin-quick-list {
    display: grid;
    gap: 12px;
}

.admin-quick-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 14px;
    border-radius: 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.05);
}

.admin-quick-row span {
    color: var(--muted);
}

.admin-quick-row strong {
    text-align: right;
}

@media (max-width: 1100px) {
    .help-layout,
    .admin-shell,
    .admin-columns-wide,
    .role-card-grid,
    .settings-grid,
    .help-stat-grid {
        grid-template-columns: 1fr;
    }

    .help-sidebar-card,
    .admin-side-card {
        position: static;
        max-width: none;
    }

    .help-sidebar-card {
        order: 1;
        justify-self: stretch;
    }

    .help-content-card {
        order: 2;
    }
}


/* Paczka 10: lewa nawigacja sekcji + stabilny sidebar */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
}

.help-layout {
    width: min(1320px, 100%);
    grid-template-columns: 320px minmax(0, 1fr);
}

.help-sidebar-card {
    order: 1;
    position: sticky;
    top: 0;
    width: 100%;
    max-width: 320px;
    justify-self: start;
}

.help-content-card {
    order: 2;
    min-width: 0;
}

.admin-shell {
    width: min(1380px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.admin-side-column {
    grid-column: 1;
}

.admin-main-column {
    grid-column: 2;
    min-width: 0;
    display: grid;
    gap: 18px;
}

.admin-side-card {
    position: sticky;
    top: 0;
    display: grid;
    gap: 18px;
}

@media (max-width: 1100px) {
    .help-layout,
    .admin-shell {
        grid-template-columns: 1fr;
    }

    .help-sidebar-card,
    .admin-side-card {
        position: static;
        max-width: none;
    }

    .help-sidebar-card,
    .help-content-card,
    .admin-side-column,
    .admin-main-column {
        grid-column: auto;
        order: initial;
    }
}



/* Paczka 11: thinking chip + dropdown usera + stabilna nawigacja admina */
.sidebar-footer,
.account-box {
    overflow: visible;
}

.account-menu {
    left: 0;
    right: 0;
    bottom: calc(100% + 10px);
    width: auto;
    min-width: 100%;
    max-width: 100%;
    z-index: 1400;
}

.account-menu a,
.account-menu button {
    padding: 12px 13px;
}

.mode-form {
    position: relative;
}

.mode-switcher {
    position: relative;
}

.mode-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 999px;
    cursor: pointer;
    min-height: 44px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.mode-chip:hover,
.mode-switcher.open .mode-chip {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--panel-border);
}

.mode-chip-label {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.mode-chip-value {
    font-weight: 700;
}

.mode-chip-chevron {
    color: var(--muted);
    font-size: 12px;
}

.mode-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    min-width: 220px;
    border-radius: 18px;
    background: rgba(17, 18, 20, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow);
    padding: 8px;
    z-index: 1300;
}

.mode-option {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    border: 0;
    background: transparent;
    color: var(--text);
    border-radius: 14px;
    padding: 12px 13px;
    cursor: pointer;
    text-align: left;
}

.mode-option:hover,
.mode-option.active {
    background: rgba(255, 255, 255, 0.07);
}

.mode-option-text {
    display: grid;
    gap: 2px;
}

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

.mode-option-check {
    color: #86efac;
    font-size: 13px;
    padding-top: 2px;
}

.help-layout {
    align-items: start;
}

.help-sidebar-card {
    position: sticky;
    top: 0;
}

.admin-shell {
    grid-template-columns: 300px minmax(0, 1fr);
    align-items: start;
}

.admin-side-column,
.admin-main-column {
    grid-row: 1;
}

.admin-side-column {
    grid-column: 1;
    align-self: start;
    min-width: 0;
}

.admin-main-column {
    grid-column: 2;
    min-width: 0;
}

.admin-side-card {
    position: sticky;
    top: 0;
}

@media (max-width: 1100px) {
    .account-menu {
        left: 0;
        right: 0;
        width: auto;
        min-width: 100%;
        max-width: 100%;
    }

    .mode-dropdown {
        min-width: 100%;
    }

    .admin-shell,
    .help-layout {
        grid-template-columns: 1fr;
    }

    .admin-side-column,
    .admin-main-column {
        grid-column: auto;
        grid-row: auto;
    }

    .admin-side-card,
    .help-sidebar-card {
        position: static;
    }
}

/* Paczka 12: zakładki panelu admina, zgłoszenia i ustawienia gościa */
.admin-shell.admin-shell-tabs {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.admin-side-card-sticky {
    position: sticky;
    top: 16px;
}

.tabbed-admin-nav {
    display: grid;
    gap: 10px;
}

.roles-tab-layout {
    align-items: start;
}

.compact-info-list {
    display: grid;
    gap: 10px;
}

.compact-info-list > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 14px;
    padding: 12px 14px;
}

.ticket-list {
    display: grid;
    gap: 14px;
}

.ticket-card {
    align-items: flex-start;
}

.ticket-card p {
    white-space: pre-wrap;
}

.ticket-closed {
    opacity: 0.82;
}

.admin-search-form {
    margin-bottom: 20px;
}

.admin-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.admin-page-link,
.button.ghostish {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    text-decoration: none;
}

.admin-page-link.active {
    background: rgba(52, 211, 153, 0.18);
    border-color: rgba(52, 211, 153, 0.35);
}

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

    .admin-side-card-sticky {
        position: static;
    }
}

/* Paczka 13: tickety, poprawki ustawień, ciemne dropdowny */
.settings-form input:disabled,
.settings-form textarea:disabled,
.settings-form select:disabled {
    opacity: 0.72;
    cursor: not-allowed;
}

.settings-form select,
.table-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #9ca3af 50%), linear-gradient(135deg, #9ca3af 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 40px;
}

.settings-form select option,
.table-select option {
    background: #111214;
    color: #ececf1;
}

body.density-compact .message-list {
    gap: 8px;
}

body.density-compact .message {
    gap: 10px;
}

body.density-compact .message-avatar {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    font-size: 11px;
}

body.density-compact .message-body {
    padding: 11px 13px;
}

body.density-compact .message-body p,
body.density-compact .chat-subtitle,
body.density-compact .input-hint {
    font-size: 13px;
}

body.density-compact .chat-main {
    padding: 10px 11px;
}

body.density-compact .input-wrap textarea {
    min-height: 84px;
    padding: 14px 15px;
}

body.sidebar-compact .app-shell {
    grid-template-columns: 248px 1fr;
}

body.sidebar-compact .sidebar {
    padding: 10px;
    gap: 10px;
}

body.sidebar-compact .brand {
    padding: 6px 8px;
}

body.sidebar-compact .brand-text span,
body.sidebar-compact .account-meta small,
body.sidebar-compact .chat-subtitle {
    display: none;
}

body.sidebar-compact .chat-main {
    padding: 10px 10px;
}

body.sidebar-compact .sidebar-card {
    padding: 8px;
}

.mode-pill.mode-pill-fast {
    color: #d1fae5;
    background: rgba(22, 163, 74, 0.2);
    border-color: rgba(22, 163, 74, 0.36);
}

.mode-pill.mode-pill-thinking {
    color: #ede9fe;
    background: rgba(124, 58, 237, 0.2);
    border-color: rgba(124, 58, 237, 0.34);
}

.ticket-status-switch {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.ticket-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: var(--muted);
    font-weight: 600;
}

.ticket-status-chip span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    color: var(--text);
    font-size: 12px;
}

.ticket-status-chip.active {
    color: var(--text);
    border-color: rgba(25,195,125,0.34);
    background: rgba(25,195,125,0.14);
}

.ticket-page-grid {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.ticket-list-panel,
.ticket-thread-panel {
    min-width: 0;
}

.ticket-create-form {
    margin-bottom: 16px;
}

.ticket-list-item {
    display: grid;
    gap: 8px;
    padding: 14px 15px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.03);
}

.ticket-list-item:hover,
.ticket-list-item.active {
    background: rgba(255,255,255,0.07);
    border-color: var(--panel-border);
}

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

.ticket-list-item p {
    margin: 0;
    color: var(--muted);
    white-space: pre-wrap;
}

.ticket-list-item small,
.ticket-thread-meta {
    color: var(--muted);
}

.ticket-thread-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
    font-size: 13px;
}

.ticket-thread-list {
    display: grid;
    gap: 12px;
    max-height: 460px;
    overflow: auto;
    padding-right: 6px;
    margin-bottom: 16px;
}

.ticket-message {
    display: grid;
    gap: 8px;
    padding: 14px 15px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.03);
}

.ticket-message.admin {
    background: rgba(124, 58, 237, 0.12);
    border-color: rgba(124, 58, 237, 0.2);
}

.ticket-message.user {
    background: rgba(25, 195, 125, 0.09);
    border-color: rgba(25, 195, 125, 0.18);
}

.ticket-message-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}

.ticket-message p {
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.55;
}

.inner-ticket-card {
    padding: 20px;
}

.admin-overview-tools {
    margin-bottom: 18px;
}

.status-badge.open,
.status-badge.status-open {
    color: #d1fae5;
    background: rgba(22,163,74,0.18);
    border-color: rgba(22,163,74,0.34);
}

.status-badge.closed,
.status-badge.status-closed {
    color: #fde68a;
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(245, 158, 11, 0.3);
}

body.accent-amber .button,
body.accent-amber .brand-mark { background: linear-gradient(135deg, #d97706, #fbbf24); }
body.accent-rose .button,
body.accent-rose .brand-mark { background: linear-gradient(135deg, #e11d48, #fb7185); }
body.accent-teal .button,
body.accent-teal .brand-mark { background: linear-gradient(135deg, #0f766e, #2dd4bf); }
body.accent-cyan .button,
body.accent-cyan .brand-mark { background: linear-gradient(135deg, #0891b2, #67e8f9); }
body.accent-amber .preview-badge { color: #fef3c7; background: rgba(245, 158, 11, 0.16); border-color: rgba(245, 158, 11, 0.28); }
body.accent-rose .preview-badge { color: #ffe4e6; background: rgba(225, 29, 72, 0.14); border-color: rgba(225, 29, 72, 0.28); }
body.accent-teal .preview-badge { color: #ccfbf1; background: rgba(13, 148, 136, 0.14); border-color: rgba(13, 148, 136, 0.28); }
body.accent-cyan .preview-badge { color: #cffafe; background: rgba(8, 145, 178, 0.14); border-color: rgba(8, 145, 178, 0.28); }
.preview-badge.accent-amber { color: #fef3c7; background: rgba(245, 158, 11, 0.16); border-color: rgba(245, 158, 11, 0.28); }
.preview-badge.accent-rose { color: #ffe4e6; background: rgba(225, 29, 72, 0.14); border-color: rgba(225, 29, 72, 0.28); }
.preview-badge.accent-teal { color: #ccfbf1; background: rgba(13, 148, 136, 0.14); border-color: rgba(13, 148, 136, 0.28); }
.preview-badge.accent-cyan { color: #cffafe; background: rgba(8, 145, 178, 0.14); border-color: rgba(8, 145, 178, 0.28); }

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


/* Paczka 14: zgłoszenia full width, osobne zakładki rang, hasła z podglądem */
.ticket-page-grid.ticket-page-grid-single {
    grid-template-columns: minmax(0, 1fr);
}

.ticket-list-panel-full,
.ticket-thread-panel-full {
    width: 100%;
}

.ticket-thread-panel-full {
    margin-top: 18px;
}

.role-card-grid.role-card-grid-stacked {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

.password-field {
    position: relative;
    display: flex;
    align-items: center;
}

.password-field input {
    width: 100%;
    padding-right: 52px;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.password-toggle:hover {
    background: rgba(255,255,255,0.08);
}


.settings-form input:-webkit-autofill,
.settings-form textarea:-webkit-autofill,
.settings-form select:-webkit-autofill,
.password-field input:-webkit-autofill {
    -webkit-text-fill-color: var(--text);
    caret-color: var(--text);
    box-shadow: 0 0 0px 1000px rgba(18, 20, 24, 0.98) inset;
    transition: background-color 9999s ease-in-out 0s;
}

.password-field input,
.password-field input:focus,
.password-field input:active {
    color: var(--text);
    background: rgba(255,255,255,0.04);
}

.admin-ticket-switch,
.help-ticket-switch {
    margin-top: 2px;
    margin-bottom: 22px;
}

.ticket-page-grid.ticket-page-grid-single {
    gap: 20px;
}

.ticket-list-panel-full,
.ticket-thread-panel-full {
    max-width: 100%;
}

.admin-side-card-sticky {
    top: 18px;
}

/* Paczka 18: strona główna, profil, ustawienia, pomoc, admin, motywy */
.brand-mark {
    text-decoration: none;
}

.account-menu {
    left: 0;
    right: 0;
    bottom: calc(100% + 10px);
    width: auto;
    max-width: 100%;
}

.center-actions {
    justify-content: center;
}

.profile-grid-custom {
    grid-template-columns: 340px minmax(0, 1fr);
    align-items: start;
}

.profile-head-compact {
    align-items: center;
    margin-bottom: 18px;
}

.profile-head-compact h2 {
    margin: 0;
    font-size: 30px;
}

.profile-password-head {
    margin-bottom: 10px;
}

.profile-summary-card .info-list > div {
    grid-template-columns: 110px 1fr;
}

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

.settings-main-card {
    max-width: 860px;
}

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

.minimalist-shortcuts {
    margin-top: 10px;
}

.clean-help-card {
    min-height: 720px;
}

.no-pill-head {
    justify-content: flex-start;
}

.no-pill-head .pill {
    display: none;
}

.no-title-help-sidebar {
    padding-top: 20px;
}

.help-layout-leftnav {
    grid-template-columns: 260px minmax(0, 1fr);
    align-items: start;
}

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

.version-feed-list {
    display: grid;
    gap: 14px;
}

.version-entry-card p {
    margin: 10px 0 0;
    color: var(--text);
    line-height: 1.65;
    white-space: pre-wrap;
}

.legal-copy-block {
    display: grid;
    gap: 16px;
    line-height: 1.72;
    color: var(--text);
}

.legal-copy-block p {
    margin: 0;
}

.download-platform-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.download-platform-card {
    border: 1px solid var(--panel-border);
    border-radius: 22px;
    background: rgba(255,255,255,0.03);
    padding: 24px 16px;
    display: grid;
    place-items: center;
    gap: 12px;
    min-height: 170px;
}

.download-platform-icon {
    width: 68px;
    height: 68px;
    border-radius: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    background: rgba(255,255,255,0.08);
}

.download-coming-soon {
    margin-top: 28px;
    text-align: center;
    font-size: 34px;
    font-weight: 800;
}

.ticket-create-wide-full {
    margin-bottom: 20px;
}

.ticket-create-wide-full .form-actions {
    justify-content: flex-start;
}

.centered-switch {
    justify-content: center;
}

.admin-shell-clean {
    align-items: start;
}

.admin-top-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.admin-top-actions.right-only {
    justify-content: flex-end;
}

.compact-admin-grid {
    margin-bottom: 18px;
}

.overview-columns-clean {
    margin-top: 0;
}

.role-accordion {
    display: grid;
    gap: 14px;
}

.role-accordion-item {
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    background: rgba(255,255,255,0.03);
    overflow: hidden;
}

.role-accordion-summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
}

.role-accordion-summary::-webkit-details-marker {
    display: none;
}

.role-accordion-summary span {
    display: grid;
    gap: 4px;
}

.role-accordion-summary strong {
    font-size: 18px;
}

.role-accordion-summary small,
.role-accordion-meta {
    color: var(--muted);
}

.role-accordion-body {
    padding: 0 20px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

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

.ticket-thread-toolbar h2 {
    margin: 0;
    font-size: 19px;
}

.ticket-action-chip {
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    padding: 10px 16px;
    background: rgba(255,255,255,0.06);
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
}

.ticket-action-chip.danger {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(239,68,68,0.28);
}

.ticket-action-chip.secondary {
    color: #d1fae5;
    background: rgba(25,195,125,0.12);
    border-color: rgba(25,195,125,0.28);
}

.version-form-stack {
    margin-bottom: 20px;
}

select,
input,
textarea {
    color-scheme: dark;
}

.settings-form select,
.table-select {
    background: rgba(255,255,255,0.04);
    color: var(--text);
    border: 1px solid var(--panel-border);
}

.settings-form select option,
.table-select option {
    background: #1b1d22;
    color: var(--text);
}

body.theme-light {
    --bg: #eef1f7;
    --bg-soft: #dde3ef;
    --panel: #ffffff;
    --panel-soft: #f6f8fb;
    --panel-border: rgba(15, 23, 42, 0.08);
    --text: #172033;
    --muted: #5f6880;
    --shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

body.theme-light .sidebar,
body.theme-light .main,
body.theme-light .sidebar-card,
body.theme-light .settings-card,
body.theme-light .install-card,
body.theme-light .chat-menu,
body.theme-light .account-menu,
body.theme-light .message-body,
body.theme-light .input-wrap,
body.theme-light .ticket-message,
body.theme-light .ticket-list-item,
body.theme-light .download-platform-card,
body.theme-light .role-accordion-item,
body.theme-light .admin-section,
body.theme-light .stat-card {
    box-shadow: none;
}

body.theme-light .chat-menu,
body.theme-light .account-menu,
body.theme-light .ticket-message.admin,
body.theme-light .ticket-message.user,
body.theme-light .settings-form select option,
body.theme-light .table-select option {
    background: #ffffff;
    color: var(--text);
}

body.theme-light select,
body.theme-light input,
body.theme-light textarea {
    color-scheme: light;
}

body.density-tight .message-list { gap: 8px; }
body.density-tight .message { gap: 10px; }
body.density-tight .message-avatar { width: 34px; height: 34px; border-radius: 12px; font-size: 11px; }
body.density-tight .message-body { padding: 11px 13px; }
body.density-tight .message-body p,
body.density-tight .chat-subtitle,
body.density-tight .input-hint { font-size: 13px; }
body.density-tight .input-wrap textarea { min-height: 84px; padding: 14px 15px; }

body.density-stretch .message-list { gap: 18px; }
body.density-stretch .message { gap: 18px; }
body.density-stretch .message-avatar { width: 46px; height: 46px; border-radius: 16px; }
body.density-stretch .message-body { padding: 20px 22px; }
body.density-stretch .message-body p,
body.density-stretch .chat-subtitle,
body.density-stretch .input-hint { font-size: 16px; }
body.density-stretch .input-wrap textarea { min-height: 138px; padding: 20px; }

body.accent-red .button, body.accent-red .brand-mark { background: linear-gradient(135deg, #dc2626, #f87171); }
body.accent-pink .button, body.accent-pink .brand-mark { background: linear-gradient(135deg, #db2777, #f9a8d4); }
body.accent-yellow .button, body.accent-yellow .brand-mark { background: linear-gradient(135deg, #ca8a04, #fde047); }
body.accent-orange .button, body.accent-orange .brand-mark { background: linear-gradient(135deg, #ea580c, #fb923c); }
body.accent-white .button, body.accent-white .brand-mark { background: linear-gradient(135deg, #d1d5db, #ffffff); color: #111827; }
body.accent-gray .button, body.accent-gray .brand-mark { background: linear-gradient(135deg, #4b5563, #9ca3af); }
body.accent-lime .button, body.accent-lime .brand-mark { background: linear-gradient(135deg, #65a30d, #bef264); }
body.accent-gold .button, body.accent-gold .brand-mark { background: linear-gradient(135deg, #a16207, #fbbf24); }
body.accent-sky .button, body.accent-sky .brand-mark { background: linear-gradient(135deg, #0284c7, #7dd3fc); }
body.accent-green .button, body.accent-green .brand-mark { background: linear-gradient(135deg, #12a56a, #34d399); }
body.accent-blue .button, body.accent-blue .brand-mark { background: linear-gradient(135deg, #2563eb, #60a5fa); }

@media (max-width: 1180px) {
    .profile-grid-custom,
    .help-layout-leftnav,
    .settings-split-grid,
    .download-platform-grid,
    .help-home-grid {
        grid-template-columns: 1fr;
    }
}

/* Paczka 19: home composer, profil, statusy, wersja, mikrofon i załączniki */
.profile-summary-card .info-list > div {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    align-items: center;
}

.profile-summary-card .info-list strong {
    font-size: 17px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.profile-summary-card .info-list span {
    font-size: 15px;
}

.chat-layout.is-home .message-list {
    justify-content: center;
    padding-top: 84px;
    padding-bottom: 8px;
}

.home-hero {
    width: min(860px, 100%);
    margin: 0 auto;
    text-align: center;
}

.home-hero h1 {
    margin: 0;
    font-size: clamp(34px, 5vw, 54px);
    line-height: 1.08;
}

.home-input-panel {
    border-top: 0;
    background: transparent;
    padding-top: 10px;
    padding-bottom: 42px;
}

.home-input-wrap {
    max-width: 820px;
}

.composer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.composer-actions-left,
.composer-actions-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.composer-icon-button,
.composer-send-button {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.composer-icon-button:hover,
.composer-send-button:hover {
    background: rgba(255, 255, 255, 0.09);
}

.composer-send-button {
    background: linear-gradient(135deg, var(--green-strong), var(--green));
    border-color: transparent;
    color: #fff;
    font-size: 16px;
    font-weight: 800;
}

.attachment-preview {
    font-size: 12px;
    color: var(--muted);
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mode-chip-minimal {
    min-height: 42px;
    padding: 9px 14px;
}

.mode-chip-minimal .mode-chip-value {
    font-size: 15px;
    font-weight: 700;
}

.mic-trigger.is-listening {
    border-color: rgba(239, 68, 68, 0.45);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.14);
}

.help-overview-hero {
    margin-bottom: 18px;
    padding: 22px 24px;
    border: 1px solid var(--panel-border);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.025));
}

.help-overview-hero h3 {
    margin: 0 0 10px;
    font-size: 28px;
}

.help-overview-hero p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.download-platform-icon.windows {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    padding: 12px;
}

.download-platform-icon.windows .win-pane {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(96,165,250,0.95), rgba(37,99,235,0.95));
}

.download-platform-icon.mac,
.download-platform-icon.android,
.download-platform-icon.ios {
    font-size: 34px;
    font-weight: 800;
}

.download-platform-icon.mac span,
.download-platform-icon.android span,
.download-platform-icon.ios span {
    transform: translateY(1px);
}

body.theme-light .composer-icon-button,
body.theme-light .composer-send-button,
body.theme-light .mode-chip,
body.theme-light .download-platform-card,
body.theme-light .help-overview-hero {
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.08);
}

body.density-tight .message-list { gap: 6px; }
body.density-tight .message { gap: 8px; }
body.density-tight .message-avatar { width: 30px; height: 30px; border-radius: 10px; font-size: 10px; }
body.density-tight .message-body { padding: 9px 11px; }
body.density-tight .message-body p,
body.density-tight .chat-subtitle,
body.density-tight .input-hint,
body.density-tight .attachment-preview { font-size: 12px; }
body.density-tight .input-wrap textarea { min-height: 64px; padding: 10px 12px; }
body.density-tight .composer-icon-button,
body.density-tight .composer-send-button { width: 36px; min-height: 36px; height: 36px; }
body.density-tight .mode-chip { min-height: 36px; height: 36px; padding-top: 0; padding-bottom: 0; }
body.density-tight .mode-chip-minimal { min-height: 36px; }
body.density-tight .profile-summary-card .info-list strong { font-size: 15px; }

@media (max-width: 920px) {
    .composer-footer {
        align-items: stretch;
    }

    .composer-actions-left,
    .composer-actions-right {
        width: 100%;
        justify-content: space-between;
    }

    .attachment-preview {
        max-width: none;
        flex: 1;
    }

    .help-home-grid,
    .download-platform-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
.composer-brand-tag {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 999px;
    color: var(--text);
    font-weight: 700;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--panel-border);
}

/* Paczka 20: home composer overflow, profil, wersja, gęstość, chowanie sidebara */
.brand {
    justify-content: space-between;
}

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

.brand-sidebar-toggle {
    margin-left: auto;
    width: 34px;
    min-width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--panel-border);
    color: var(--muted);
}

.desktop-sidebar-hidden .sidebar {
    display: none;
}

.desktop-sidebar-hidden .app-shell {
    grid-template-columns: 1fr;
}

.desktop-sidebar-hidden .mobile-sidebar-toggle {
    display: inline-flex;
}

.chat-layout.is-home .message-list,
.home-input-panel,
.home-input-wrap,
.input-panel,
.input-wrap,
.composer-footer,
.composer-actions-left,
.composer-actions-right,
.composer-mode-switcher,
.mode-switcher {
    overflow: visible;
}

.home-input-wrap {
    max-width: 980px;
}

.composer-mode-switcher .mode-dropdown {
    top: auto;
    bottom: calc(100% + 10px);
    left: 0;
}

.chat-layout.is-home .message-list {
    padding-top: 48px;
    padding-bottom: 18px;
}

.home-hero {
    width: min(980px, 100%);
}

.profile-grid-custom {
    grid-template-columns: minmax(430px, 500px) minmax(0, 1fr);
    max-width: 1240px;
    margin: 0 auto;
}

.profile-summary-card .info-list > div {
    grid-template-columns: 112px minmax(0, 1fr);
}

.profile-summary-card .info-list span {
    font-size: 14px;
}

.profile-summary-card .info-list strong {
    font-size: 15px;
    line-height: 1.35;
}

.version-entry-actions {
    margin-top: 14px;
    align-items: flex-start;
}

.version-edit-toggle {
    width: 100%;
}

.version-edit-toggle summary {
    list-style: none;
}

.version-edit-toggle summary::-webkit-details-marker {
    display: none;
}

.version-inline-form {
    margin-top: 14px;
}

body.density-normal .message-list { gap: 12px; }
body.density-normal .message { gap: 12px; }
body.density-normal .message-avatar { width: 40px; height: 40px; border-radius: 13px; }
body.density-normal .message-body { padding: 14px 16px 12px; }
body.density-normal .message-body p,
body.density-normal .chat-subtitle,
body.density-normal .input-hint,
body.density-normal .attachment-preview { font-size: 13px; }
body.density-normal .input-wrap textarea { min-height: 78px; padding: 12px 14px; }
body.density-normal .composer-icon-button,
body.density-normal .composer-send-button { width: 40px; min-height: 40px; height: 40px; }
body.density-normal .mode-chip { min-height: 40px; }

body.density-tight .message-list { gap: 3px; }
body.density-tight .message { gap: 6px; }
body.density-tight .message-avatar { width: 26px; height: 26px; border-radius: 8px; font-size: 9px; }
body.density-tight .message-body { padding: 7px 9px; }
body.density-tight .message-body p,
body.density-tight .chat-subtitle,
body.density-tight .input-hint,
body.density-tight .attachment-preview { font-size: 11px; line-height: 1.4; }
body.density-tight .input-wrap textarea { min-height: 54px; padding: 8px 10px; }
body.density-tight .composer-icon-button,
body.density-tight .composer-send-button { width: 32px; min-height: 32px; height: 32px; }
body.density-tight .mode-chip,
body.density-tight .mode-chip-minimal,
body.density-tight .composer-brand-tag { min-height: 32px; height: 32px; padding-left: 10px; padding-right: 10px; font-size: 12px; }
body.density-tight .profile-summary-card .info-list span { font-size: 13px; }
body.density-tight .profile-summary-card .info-list strong { font-size: 14px; }

@media (max-width: 920px) {
    .brand-sidebar-toggle {
        display: none;
    }

    .profile-grid-custom {
        grid-template-columns: 1fr;
        max-width: none;
    }

    .home-input-wrap,
    .home-hero {
        max-width: none;
    }
}

/* Paczka 21: profil, wersja, gęstość, mniejszy dropdown, TTS */
.profile-grid-custom {
    grid-template-columns: minmax(620px, 760px) minmax(420px, 1fr);
    max-width: 1560px;
    align-items: stretch;
}

.profile-grid-custom > .settings-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.profile-summary-card .info-list {
    flex: 1;
}

.profile-summary-card .info-list > div {
    grid-template-columns: 112px minmax(0, 1fr);
}

.profile-summary-card .info-list strong {
    font-size: 14px;
    line-height: 1.3;
}

.profile-summary-card .info-list span {
    font-size: 14px;
}

.version-entry-topline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.version-entry-title {
    min-width: 0;
    font-size: 18px;
    line-height: 1.25;
}

.version-entry-date {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.inline-version-actions {
    gap: 8px;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
}

.inline-version-actions .button.small,
.inline-version-actions .version-edit-toggle summary {
    padding: 6px 10px;
    font-size: 12px;
    min-height: 32px;
    border-radius: 10px;
}

.version-inline-form {
    margin-top: 10px;
}

.composer-mode-switcher .mode-dropdown {
    min-width: 188px;
    width: 196px;
    padding: 6px;
    border-radius: 16px;
}

.composer-mode-switcher .mode-option {
    padding: 10px 11px;
    gap: 8px;
}

.composer-mode-switcher .mode-option-text {
    display: flex;
    align-items: center;
}

.composer-mode-switcher .mode-option-text small {
    display: none;
}

.composer-mode-switcher .mode-option-text strong {
    font-size: 14px;
    line-height: 1.2;
}

.composer-mode-switcher .mode-option-check {
    padding-top: 0;
}

.message-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
}

.message-artifact-actions {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.message-artifact-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.message-download-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(52, 211, 153, 0.28);
    background: rgba(16, 185, 129, 0.12);
    color: #d1fae5;
    text-decoration: none;
    font-weight: 700;
    line-height: 1;
}

.message-download-link-inline {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #d1fae5;
    line-height: 1.35;
}

.message-download-link:hover {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(52, 211, 153, 0.42);
}

.message-download-link-inline:hover {
    background: transparent;
    border-color: transparent;
    color: #ecfdf5;
    text-decoration: underline;
}

.message-artifact-meta {
    color: var(--muted);
    font-size: 13px;
}

body.theme-light .message-download-link {
    color: #065f46;
    background: rgba(16, 185, 129, 0.14);
}

body.theme-light .message-download-link-inline {
    background: transparent;
    color: #065f46;
}

.message-speak-button {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 999px;
    border: 1px solid var(--panel-border);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.message-speak-button:hover {
    background: rgba(255,255,255,0.1);
}

body.density-tight .sidebar {
    gap: 12px;
}

body.density-tight .sidebar-card {
    padding: 8px;
    border-radius: 16px;
}

body.density-tight .sidebar-actions {
    gap: 8px;
}

body.density-tight .sidebar-section-title {
    padding: 0 4px 5px;
    font-size: 11px;
}

body.density-tight .chat-list,
body.density-tight .agent-list {
    gap: 3px;
}

body.density-tight .chat-list-wrapper {
    gap: 6px;
}

body.density-tight .chat-row {
    gap: 8px;
    padding: 8px 9px 8px 10px;
    border-radius: 13px;
}

body.density-tight .chat-title {
    font-size: 13px;
    margin-bottom: 1px;
}

body.density-tight .chat-subtitle {
    font-size: 11px;
}

body.density-tight .agent-item,
body.density-tight .ghost-button,
body.density-tight .button.secondary,
body.density-tight .button {
    min-height: 38px;
    padding-top: 9px;
    padding-bottom: 9px;
}

body.density-tight .account-trigger {
    grid-template-columns: 38px 1fr auto;
    gap: 10px;
    padding: 3px;
}

body.density-tight .avatar,
body.density-tight .brand-mark,
body.density-tight .message-avatar {
    border-radius: 10px;
}

body.density-tight .content,
body.density-tight .main {
    gap: 14px;
}

body.density-normal .sidebar {
    gap: 14px;
}

body.density-normal .sidebar-card {
    padding: 9px;
}

body.density-normal .chat-list,
body.density-normal .agent-list {
    gap: 5px;
}

body.density-normal .chat-row {
    padding: 10px 11px 10px 12px;
}

@media (max-width: 1200px) {
    .profile-grid-custom {
        grid-template-columns: 1fr;
        max-width: none;
    }

    .version-entry-topline {
        grid-template-columns: 1fr;
        align-items: start;
    }

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

/* Paczka 22: profil align, wersja inline, większa gęstość, mniejszy dropdown, TTS top-right */
.settings-split-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.profile-grid-custom {
    grid-template-columns: minmax(760px, 980px) minmax(400px, 1fr);
    max-width: 1720px;
}

.profile-summary-card .info-list > div {
    grid-template-columns: 120px minmax(0, 1fr);
}

.profile-summary-card .info-list strong {
    justify-self: end;
    text-align: right;
    width: 100%;
    max-width: none;
}

.profile-summary-card .info-list span {
    text-align: left;
}

.version-entry-topline {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 14px;
    align-items: center;
}

.version-entry-actions,
.inline-version-actions,
.compact-actions.version-entry-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 0;
    flex-wrap: nowrap;
}

.version-edit-toggle {
    width: auto;
    flex: 0 0 auto;
}

.version-edit-toggle summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.inline-version-actions .button.small,
.inline-version-actions .version-edit-toggle summary {
    min-height: 28px;
    padding: 5px 10px;
    font-size: 11px;
    line-height: 1;
}

.version-entry-date {
    justify-self: end;
}

.message.assistant .message-body {
    position: relative;
    padding-top: 42px;
}

.message.assistant .message-speak-button {
    position: absolute;
    top: 10px;
    right: 10px;
    margin: 0;
}

body.density-normal .message.assistant .message-body { padding-top: 42px; }
body.density-tight .message.assistant .message-body { padding-top: 34px; }
body.density-stretch .message.assistant .message-body { padding-top: 48px; }
body.density-tight .message.assistant .message-speak-button {
    top: 7px;
    right: 7px;
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 12px;
}
body.density-stretch .message.assistant .message-speak-button {
    top: 12px;
    right: 12px;
}

.composer-mode-switcher .mode-dropdown {
    min-width: 148px;
    width: 156px;
    padding: 4px;
    border-radius: 14px;
}

.composer-mode-switcher .mode-option {
    padding: 9px 10px;
}

body.density-tight .sidebar { gap: 8px; }
body.density-tight .sidebar-card { padding: 6px; border-radius: 14px; }
body.density-tight .sidebar-actions { gap: 5px; }
body.density-tight .chat-list,
body.density-tight .agent-list { gap: 1px; }
body.density-tight .chat-list-wrapper { gap: 4px; }
body.density-tight .chat-row { padding: 5px 7px 5px 8px; border-radius: 11px; gap: 6px; }
body.density-tight .chat-main { gap: 1px; }
body.density-tight .chat-title { font-size: 12px; margin-bottom: 0; }
body.density-tight .chat-subtitle { font-size: 10px; line-height: 1.25; }
body.density-tight .sidebar-section-title { padding: 0 2px 3px; font-size: 10px; }
body.density-tight .content,
body.density-tight .main { gap: 10px; }
body.density-tight .settings-page,
body.density-tight .settings-grid,
body.density-tight .help-layout,
body.density-tight .ticket-page-grid,
body.density-tight .admin-shell,
body.density-tight .admin-content,
body.density-tight .admin-layout { gap: 10px; }
body.density-tight .settings-card,
body.density-tight .admin-section,
body.density-tight .ticket-detail-panel,
body.density-tight .ticket-list-panel,
body.density-tight .preview-card,
body.density-tight .stat-card { padding: 14px 15px; border-radius: 18px; }
body.density-tight .info-list,
body.density-tight .shortcut-list,
body.density-tight .help-nav-list,
body.density-tight .ticket-list,
body.density-tight .account-menu nav { gap: 6px; }
body.density-tight .input-panel { padding-top: 6px; padding-bottom: 18px; }
body.density-tight .home-input-panel { padding-bottom: 26px; }

body.density-normal .sidebar { gap: 12px; }
body.density-normal .sidebar-card { padding: 8px; }
body.density-normal .chat-list,
body.density-normal .agent-list { gap: 3px; }
body.density-normal .chat-row { padding: 8px 10px 8px 11px; }
body.density-normal .content,
body.density-normal .main { gap: 16px; }
body.density-normal .settings-page,
body.density-normal .settings-grid,
body.density-normal .help-layout,
body.density-normal .ticket-page-grid,
body.density-normal .admin-shell,
body.density-normal .admin-content,
body.density-normal .admin-layout { gap: 14px; }
body.density-normal .settings-card,
body.density-normal .admin-section,
body.density-normal .ticket-detail-panel,
body.density-normal .ticket-list-panel,
body.density-normal .preview-card,
body.density-normal .stat-card { padding: 18px; }

@media (max-width: 1200px) {
    .profile-grid-custom {
        grid-template-columns: 1fr;
        max-width: none;
    }

    .version-entry-topline {
        grid-template-columns: 1fr;
        justify-items: start;
    }

    .version-entry-date {
        justify-self: start;
    }
}


/* Paczka 23: pełna responsywność mobile/tablet */
:root {
    --mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
    --mobile-safe-top: env(safe-area-inset-top, 0px);
}

.sidebar,
.main,
.content,
.message-list,
.input-panel,
.chat-list-scroll,
.settings-page,
.admin-page {
    -webkit-overflow-scrolling: touch;
}

.sidebar-toggle-floating {
    display: none;
}

@media (max-width: 1100px) {
    .help-layout,
    .help-layout-leftnav,
    .admin-shell,
    .admin-shell.admin-shell-tabs,
    .settings-grid,
    .settings-split-grid,
    .profile-grid-custom,
    .ticket-page-grid,
    .ticket-page-grid.ticket-page-grid-single,
    .help-home-grid,
    .help-stat-grid,
    .download-platform-grid,
    .admin-grid,
    .admin-columns,
    .admin-columns-wide,
    .role-card-grid,
    .role-form-grid,
    .compact-role-form,
    .agent-checkbox-grid,
    .agent-checkbox-grid.compact {
        grid-template-columns: 1fr !important;
    }

    .help-sidebar-card,
    .admin-side-card,
    .help-content-card,
    .admin-main-column,
    .admin-side-column {
        position: static;
        max-width: none;
        width: 100%;
        justify-self: stretch;
    }

    .admin-side-column,
    .admin-main-column {
        grid-column: auto;
        grid-row: auto;
    }

    .admin-nav-list,
    .help-nav-list {
        grid-auto-flow: column;
        grid-auto-columns: minmax(220px, 1fr);
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 4px;
        margin-top: 0;
        gap: 10px;
        scroll-snap-type: x proximity;
    }

    .admin-nav-item,
    .help-nav-item {
        min-width: 220px;
        scroll-snap-align: start;
    }

    .ticket-list-panel,
    .ticket-thread-panel,
    .ticket-list-panel-full,
    .ticket-thread-panel-full,
    .settings-card,
    .admin-section,
    .admin-header-card,
    .stat-card,
    .help-content-card,
    .help-sidebar-card,
    .admin-side-card {
        width: 100%;
    }
}

@media (max-width: 960px) {
    body {
        overflow: auto;
    }

    body.sidebar-open {
        overflow: hidden;
        touch-action: none;
    }

    body.sidebar-open::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(6, 8, 12, 0.62);
        backdrop-filter: blur(3px);
        z-index: 18;
    }

    .app-shell {
        grid-template-columns: 1fr;
        min-height: 100dvh;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        right: auto;
        bottom: 0;
        width: 100vw;
        max-width: 100vw;
        min-height: 100dvh;
        padding: calc(12px + var(--mobile-safe-top)) 12px calc(12px + var(--mobile-safe-bottom));
        overflow-y: auto;
        transform: translateX(-106%);
        transition: transform 0.22s ease;
        box-shadow: var(--shadow);
        z-index: 25;
    }

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

    .brand-sidebar-toggle {
        display: none;
    }

    .main {
        min-height: 100dvh;
    }

    .topbar {
        position: sticky;
        top: 0;
        z-index: 12;
        padding: calc(10px + var(--mobile-safe-top)) 14px 10px;
        gap: 10px;
    }

    .topbar-left {
        min-width: 0;
        flex: 1;
        gap: 10px;
    }

    .topbar-right {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .mobile-sidebar-toggle {
        display: inline-flex;
        width: 38px;
        height: 38px;
        min-width: 38px;
    }

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

    .chat-context span {
        font-size: 11px;
    }

    .admin-link,
    .badge {
        min-height: 38px;
        padding: 8px 11px;
        border-radius: 12px;
        font-size: 12px;
    }

    .content,
    .chat-layout {
        min-height: 0;
    }

    .message-list {
        padding: 18px 14px 12px;
        gap: 12px;
    }

    .chat-layout.is-home .message-list {
        padding-top: 28px;
        padding-bottom: 14px;
        justify-content: center;
    }

    .message {
        width: 100%;
        grid-template-columns: 34px 1fr;
        gap: 10px;
    }

    .message-avatar {
        width: 34px;
        height: 34px;
        border-radius: 11px;
        font-size: 11px;
    }

    .message-body {
        padding: 14px 14px 12px;
        border-radius: 18px;
    }

    .message.assistant .message-body {
        padding-top: 40px;
    }

    .hero,
    .home-hero {
        width: 100%;
        padding: 0 14px 20px;
        max-width: none;
    }

    .home-hero h1 {
        font-size: clamp(28px, 8vw, 40px);
        line-height: 1.1;
    }

    .input-panel,
    .home-input-panel {
        position: sticky;
        bottom: 0;
        z-index: 11;
        padding: 10px 10px calc(10px + var(--mobile-safe-bottom));
        backdrop-filter: blur(16px);
    }

    .input-wrap,
    .home-input-wrap {
        width: 100%;
        max-width: none;
        border-radius: 22px;
        padding: 10px;
    }

    .input-wrap textarea {
        min-height: 72px;
        padding: 8px 10px;
        font-size: 15px;
    }

    .composer-footer {
        gap: 8px;
        align-items: stretch;
    }

    .composer-actions-left,
    .composer-actions-right {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }

    .composer-actions-left {
        flex-wrap: nowrap;
        min-width: 0;
    }

    .composer-actions-right {
        justify-content: flex-end;
    }

    .attachment-preview {
        max-width: 36vw;
        min-width: 0;
        flex: 1 1 auto;
    }

    .mode-chip,
    .mode-chip-minimal,
    .composer-brand-tag {
        min-height: 38px;
    }

    .composer-mode-switcher .mode-dropdown {
        width: min(176px, calc(100vw - 36px));
        min-width: 0;
    }

    .chat-list-scroll {
        max-height: calc(100dvh - 320px);
    }

    .account-menu {
        left: 0;
        right: 0;
        bottom: calc(100% + 8px);
        width: auto;
    }

    .flash-stack {
        top: auto;
        bottom: calc(12px + var(--mobile-safe-bottom));
        left: 12px;
        right: 12px;
        transform: none;
        width: auto;
    }

    .settings-page,
    .admin-page {
        padding: 14px;
        height: auto;
        min-height: calc(100dvh - 60px);
    }

    .help-page-shell {
        padding-top: 0;
    }

    .settings-page,
    .admin-page,
    .help-content-card,
    .help-sidebar-card,
    .admin-main-column,
    .admin-side-column,
    .admin-side-card,
    .admin-header-card,
    .admin-section,
    .settings-card,
    .ticket-list-panel,
    .ticket-thread-panel,
    .ticket-list-panel-full,
    .ticket-thread-panel-full,
    .hero-card,
    .install-card,
    .empty-state,
    .stat-card {
        border-radius: 22px;
    }

    .admin-top-actions,
    .section-head,
    .ticket-thread-toolbar,
    .profile-head,
    .profile-head-compact {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .settings-form,
    .role-form-grid,
    .compact-role-form,
    .settings-split-grid {
        gap: 12px;
    }

    .settings-form label,
    .settings-form input,
    .settings-form select,
    .settings-form textarea {
        width: 100%;
    }

    .form-actions,
    .admin-actions,
    .inline-role-form,
    .inline-version-actions {
        flex-wrap: wrap;
    }

    .form-actions .button,
    .form-actions a.button,
    .admin-actions .button,
    .inline-role-form .button {
        width: 100%;
        justify-content: center;
    }

    .ticket-status-switch,
    .admin-ticket-switch,
    .help-ticket-switch {
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .ticket-page-grid,
    .ticket-page-grid.ticket-page-grid-single {
        gap: 12px;
    }

    .ticket-list,
    .ticket-thread-list,
    .help-home-grid,
    .download-platform-grid,
    .version-feed-list,
    .admin-list,
    .admin-quick-list {
        gap: 12px;
    }

    .ticket-list-head,
    .ticket-message-head,
    .version-entry-topline {
        gap: 8px;
    }

    .table-wrap {
        margin: 0 -2px;
    }

    .admin-table {
        min-width: 720px;
    }
}

@media (max-width: 720px) {
    .topbar-right .badge {
        display: none;
    }

    .brand {
        padding: 4px 2px;
    }

    .brand-text strong {
        font-size: 14px;
    }

    .brand-text span {
        font-size: 11px;
    }

    .sidebar-card {
        border-radius: 16px;
    }

    .button,
    .ghost-button,
    .agent-item,
    .chat-row,
    .account-trigger {
        min-height: 42px;
    }

    .profile-grid-custom .settings-card,
    .settings-grid-single .settings-card,
    .settings-main-card,
    .help-content-card,
    .help-sidebar-card,
    .ticket-list-panel,
    .ticket-thread-panel,
    .ticket-list-panel-full,
    .ticket-thread-panel-full {
        padding: 16px;
    }

    .profile-summary-card .info-list > div {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .profile-summary-card .info-list span,
    .profile-summary-card .info-list strong {
        text-align: left;
        justify-self: start;
    }

    .profile-head-compact h2 {
        font-size: 30px;
    }

    .version-entry-topline {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .inline-version-actions {
        justify-content: flex-start;
    }

    .version-entry-date {
        justify-self: start;
    }

    .download-platform-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .download-platform-card {
        min-height: 180px;
    }

    .help-nav-list,
    .admin-nav-list {
        grid-auto-columns: minmax(180px, 72vw);
    }
}

@media (max-width: 560px) {
    .sidebar {
        width: min(92vw, 320px);
    }

    .topbar {
        padding-inline: 12px;
    }

    .topbar-left {
        align-items: flex-start;
    }

    .chat-context span {
        display: none;
    }

    .admin-link {
        padding: 8px 10px;
        font-size: 12px;
    }

    .message-list {
        padding: 14px 10px 10px;
    }

    .home-hero h1 {
        font-size: clamp(24px, 10vw, 34px);
    }

    .input-panel,
    .home-input-panel {
        padding-inline: 8px;
    }

    .input-wrap,
    .home-input-wrap {
        padding: 8px;
        border-radius: 20px;
    }

    .composer-footer {
        gap: 6px;
    }

    .composer-actions-left {
        gap: 6px;
        flex-wrap: wrap;
    }

    .composer-actions-right {
        gap: 6px;
    }

    .attachment-preview {
        display: none;
    }

    .composer-icon-button,
    .composer-send-button {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }

    .mode-chip,
    .mode-chip-minimal,
    .composer-brand-tag {
        min-height: 36px;
        padding-left: 11px;
        padding-right: 11px;
        font-size: 13px;
    }

    .composer-mode-switcher .mode-dropdown {
        width: min(168px, calc(100vw - 24px));
    }

    .settings-page,
    .admin-page {
        padding: 10px;
    }

    .help-nav-list,
    .admin-nav-list {
        grid-auto-columns: minmax(165px, 78vw);
    }

    .download-platform-grid {
        grid-template-columns: 1fr !important;
    }

    .ticket-message,
    .ticket-list-item,
    .admin-user-card {
        padding: 14px;
    }

    .ticket-message-head,
    .ticket-thread-meta,
    .ticket-thread-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .message-meta-row {
        gap: 8px;
        align-items: flex-start;
    }

    .message-speak-button {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }

    .account-menu {
        padding: 6px;
        border-radius: 16px;
    }

    .chat-menu {
        width: min(188px, calc(100vw - 20px));
    }
}

@media (max-width: 960px) {
    .admin-nav-list {
        grid-auto-flow: row;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-columns: unset;
        overflow: visible;
        overflow-x: visible;
        padding-bottom: 0;
    }

    .admin-nav-item {
        min-width: 0;
        align-items: flex-start;
    }

    .admin-nav-item > div {
        flex: 1 1 auto;
        min-width: 0;
    }

    .admin-nav-item strong,
    .admin-nav-item span {
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}

@media (max-width: 560px) {
    .admin-nav-list {
        grid-template-columns: 1fr;
    }
}


/* Paczka 26: admin wersja inline edit + czytelniejszy podgląd guest */
.version-entry-primary,
.version-entry-body {
    min-width: 0;
}

.version-entry-body {
    display: grid;
}

.version-entry-card .version-entry-content {
    margin-top: 0;
}

.version-inline-input,
.version-inline-textarea {
    width: 100%;
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    background: rgba(255,255,255,0.04);
    color: var(--text);
    padding: 12px 14px;
    outline: none;
}

.version-inline-input {
    min-height: 46px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
}

.version-inline-textarea {
    min-height: 148px;
    resize: vertical;
    line-height: 1.65;
}

.version-entry-title-edit,
.version-entry-content-edit {
    width: 100%;
}

.version-inline-form-meta {
    display: none;
}

.version-delete-form {
    display: inline-flex;
    margin: 0;
}

.admin-version-entry-card.is-editing {
    border-color: var(--panel-border);
}

.admin-version-entry-card.is-editing .version-entry-topline {
    align-items: start;
}

@media (max-width: 720px) {
    .version-inline-input,
    .version-inline-textarea {
        font-size: 16px;
    }

    .version-inline-textarea {
        min-height: 132px;
    }
}


@media (max-width: 640px) {
    .bridge-thinking-pill,
    .bridge-thinking-summary-pill {
        width: 100%;
    }

    .message-code-toolbar {
        flex-wrap: wrap;
    }
}

/* Hotfix: pojedynczy pasek myslenia w jednej linii + czytelniejsze kopiowanie kodu */
.bridge-thinking-card,
.bridge-thinking-summary {
    display: block;
    width: 100%;
    margin-bottom: 14px;
    max-width: 100%;
}

.bridge-thinking-pill,
.bridge-thinking-summary-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 48px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(244, 248, 255, 0.96);
    font-weight: 700;
    letter-spacing: 0.01em;
    backdrop-filter: blur(10px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.bridge-thinking-card.is-live .bridge-thinking-pill {
    background: rgba(125, 211, 252, 0.08);
    border-color: rgba(125, 211, 252, 0.18);
}

.bridge-thinking-pill.bridge-thinking-pill-done,
.bridge-thinking-card.is-done .bridge-thinking-pill {
    background: rgba(25, 195, 125, 0.08);
    border-color: rgba(25, 195, 125, 0.18);
}

.bridge-thinking-primary {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
}

.bridge-thinking-label {
    min-width: 0;
    white-space: nowrap;
}

.bridge-thinking-inline-status {
    flex: 0 0 auto;
    text-align: right;
    font-size: 13px;
    line-height: 1.3;
    color: rgba(223, 236, 255, 0.68);
    white-space: nowrap;
}

.bridge-thinking-inline-status.is-live {
    color: rgba(223, 236, 255, 0.82);
}

.bridge-thinking-inline-status.is-done {
    color: rgba(223, 255, 238, 0.84);
}

.bridge-thinking-check {
    display: inline-flex;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(25, 195, 125, 0.16);
    border: 1px solid rgba(25, 195, 125, 0.28);
    color: #dcfff0;
    font-size: 12px;
    font-weight: 800;
}

.bridge-thinking-dots {
    flex: 0 0 auto;
}

@media (max-width: 680px) {
    .bridge-thinking-pill,
    .bridge-thinking-summary-pill {
        gap: 10px;
        min-height: 44px;
        padding: 0 12px;
    }

    .bridge-thinking-primary {
        gap: 10px;
    }

    .bridge-thinking-label,
    .bridge-thinking-inline-status {
        font-size: 12px;
    }
}

.message-code-copy {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.message-code-copy:focus-visible {
    outline: 2px solid rgba(125, 211, 252, 0.55);
    outline-offset: 2px;
}

/* === Gemini-inspired glass shell refresh === */
body.theme-dark {
    --shell-bg: #05070d;
    --shell-bg-2: #0a0f18;
    --shell-glow-a: rgba(112, 95, 255, 0.18);
    --shell-glow-b: rgba(250, 95, 155, 0.12);
    --surface-main: rgba(11, 15, 24, 0.74);
    --surface-alt: rgba(16, 20, 31, 0.82);
    --surface-soft: rgba(20, 24, 37, 0.86);
    --surface-border-strong: rgba(255, 255, 255, 0.12);
    --surface-border-soft: rgba(255, 255, 255, 0.08);
    --surface-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
    --text-main: #f5f7fb;
    --text-soft: rgba(228, 233, 245, 0.72);
    --text-muted: rgba(204, 212, 227, 0.5);
    --chip-bg: rgba(255, 255, 255, 0.06);
    --chip-border: rgba(255, 255, 255, 0.08);
    --brand-a: #fe4c8d;
    --brand-b: #8f5cff;
    --cta-bg: linear-gradient(135deg, rgba(86, 29, 40, 0.92), rgba(31, 8, 14, 0.96));
    --cta-text: #fff3f7;
    --input-bg: rgba(13, 18, 28, 0.88);
    --message-user-bg: linear-gradient(135deg, #2759e8, #1b3d97);
    --message-ai-bg: rgba(17, 22, 32, 0.9);
    --scroll-thumb: rgba(255, 255, 255, 0.14);
}

body.theme-light {
    --shell-bg: #f2f3f7;
    --shell-bg-2: #ebeef4;
    --shell-glow-a: rgba(233, 122, 176, 0.15);
    --shell-glow-b: rgba(124, 97, 255, 0.08);
    --surface-main: rgba(255, 255, 255, 0.72);
    --surface-alt: rgba(255, 255, 255, 0.82);
    --surface-soft: rgba(255, 255, 255, 0.92);
    --surface-border-strong: rgba(120, 135, 165, 0.18);
    --surface-border-soft: rgba(120, 135, 165, 0.13);
    --surface-shadow: 0 24px 72px rgba(142, 152, 178, 0.22);
    --text-main: #141824;
    --text-soft: rgba(39, 47, 69, 0.75);
    --text-muted: rgba(63, 74, 101, 0.48);
    --chip-bg: rgba(255, 255, 255, 0.86);
    --chip-border: rgba(138, 150, 181, 0.18);
    --brand-a: #f88bb9;
    --brand-b: #a688ff;
    --cta-bg: linear-gradient(135deg, #ffd6e5, #f4b8d0);
    --cta-text: #52253a;
    --input-bg: rgba(255, 255, 255, 0.85);
    --message-user-bg: linear-gradient(135deg, #3f73ff, #3359cb);
    --message-ai-bg: rgba(255, 255, 255, 0.85);
    --scroll-thumb: rgba(118, 127, 150, 0.26);
}

body {
    background:
        radial-gradient(circle at 18% 15%, var(--shell-glow-a), transparent 28%),
        radial-gradient(circle at 82% 78%, var(--shell-glow-b), transparent 26%),
        linear-gradient(180deg, var(--shell-bg) 0%, var(--shell-bg-2) 100%);
    color: var(--text-main);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(120deg, rgba(255,255,255,0.05), transparent 28%),
        radial-gradient(circle at center, rgba(255,255,255,0.03), transparent 55%);
    opacity: .9;
    z-index: 0;
}

body.theme-light::before {
    background:
        linear-gradient(120deg, rgba(255,255,255,0.45), transparent 26%),
        radial-gradient(circle at center, rgba(255,255,255,0.28), transparent 55%);
}

.app-shell,
.flash-stack,
.auth-modal,
.rename-modal {
    position: relative;
    z-index: 1;
}

.app-shell {
    grid-template-columns: 256px minmax(0, 1fr);
    gap: 18px;
    padding: 14px;
    min-height: 100vh;
}

.sidebar,
.content,
.sidebar-card,
.settings-card,
.admin-section,
.stat-card,
.install-card,
.ticket-list-item,
.download-platform-card,
.role-accordion-item,
.message-body,
.input-wrap,
.home-input-wrap,
.chat-menu,
.account-menu,
.help-sidebar-card,
.help-overview-hero,
.ticket-message,
.admin-side-card,
.table-shell {
    background: var(--surface-main) !important;
    border: 1px solid var(--surface-border-soft) !important;
    box-shadow: var(--surface-shadow);
    backdrop-filter: blur(26px);
    -webkit-backdrop-filter: blur(26px);
}

.sidebar {
    min-height: calc(100vh - 28px);
    border-radius: 28px;
    padding: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)), var(--surface-alt) !important;
}

.sidebar-card {
    border-radius: 22px;
    padding: 12px;
}

.brand {
    align-items: center;
    padding: 8px 8px 12px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--brand-a), var(--brand-b));
    box-shadow: 0 16px 28px rgba(151, 97, 255, 0.22);
    color: white;
    font-weight: 800;
}

.brand-text strong,
.chat-context strong,
.message-content,
.user-meta strong,
.sidebar-footer-meta strong,
.section-head h2,
.settings-card h2,
.admin-nav-item strong {
    color: var(--text-main);
}

.brand-text span,
.chat-context span,
.sidebar-section-title,
.chat-subtitle,
.user-meta span,
.message-meta,
.message-artifact-label,
.attachment-preview,
.info-list span,
.stat-label,
.tiny-meta,
.subtle,
.sidebar-footer-label {
    color: var(--text-soft) !important;
}

.sidebar-section-title {
    font-size: 11px;
    letter-spacing: .12em;
}

.button,
.admin-link,
.ghost-button,
.mode-chip,
.mode-pill,
.badge {
    border-radius: 16px;
}

.button {
    min-height: 48px;
    border: 1px solid rgba(255,255,255,0.08);
    background: var(--cta-bg) !important;
    color: var(--cta-text) !important;
    font-weight: 700;
    box-shadow: 0 16px 28px rgba(30, 10, 20, 0.18);
}

.button.secondary,
.ghost-button,
.badge,
.mode-chip,
.mode-pill,
.admin-link,
.topbar-auth-box .button.secondary {
    background: var(--chip-bg) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--chip-border) !important;
    box-shadow: none;
}

.sidebar-actions .button {
    min-height: 52px;
    border-radius: 18px;
    font-size: 18px;
}

.ghost-button,
.agent-item,
.chat-row,
.admin-nav-item,
.role-accordion-summary,
.checkbox-row,
.ticket-list-item {
    border-radius: 18px;
}

.agent-item,
.ghost-button,
.chat-row,
.admin-nav-item,
.checkbox-row,
.role-accordion-summary {
    background: rgba(255,255,255,0.03) !important;
    border: 1px solid rgba(255,255,255,0.06) !important;
}

body.theme-light .agent-item,
body.theme-light .ghost-button,
body.theme-light .chat-row,
body.theme-light .admin-nav-item,
body.theme-light .checkbox-row,
body.theme-light .role-accordion-summary {
    background: rgba(255,255,255,0.58) !important;
}

.chat-row.active,
.admin-nav-item.active,
.mode-option.active,
.agent-item:hover,
.ghost-button:hover,
.role-accordion-summary:hover,
.checkbox-row:hover {
    border-color: var(--surface-border-strong) !important;
    background: rgba(255,255,255,0.08) !important;
}

.chat-list-scroll,
.messages,
.help-sidebar-nav,
.admin-list,
.ticket-thread,
.version-feed {
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) transparent;
}

.chat-list-scroll::-webkit-scrollbar,
.messages::-webkit-scrollbar,
.help-sidebar-nav::-webkit-scrollbar,
.admin-list::-webkit-scrollbar,
.ticket-thread::-webkit-scrollbar,
.version-feed::-webkit-scrollbar {
    width: 8px;
}

.chat-list-scroll::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb,
.help-sidebar-nav::-webkit-scrollbar-thumb,
.admin-list::-webkit-scrollbar-thumb,
.ticket-thread::-webkit-scrollbar-thumb,
.version-feed::-webkit-scrollbar-thumb {
    background: var(--scroll-thumb);
    border-radius: 999px;
}

.sidebar-footer-minimal {
    margin-top: auto;
    min-height: 84px;
    display: flex;
    align-items: center;
}

.sidebar-footer-meta {
    display: grid;
    gap: 8px;
    width: 100%;
}

.sidebar-footer-meta strong {
    display: block;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.main {
    min-height: calc(100vh - 28px);
    padding: 0;
    background: transparent;
}

.topbar {
    min-height: auto;
    padding: 2px 8px 14px;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.topbar-left {
    gap: 16px;
}

.chat-context strong {
    font-size: 31px;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.chat-context span {
    margin-top: 6px;
    font-size: 14px;
}

.topbar-right {
    gap: 12px;
    align-items: center;
}

.admin-link {
    min-height: 46px;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.topbar-account-box,
.topbar-auth-box {
    margin-left: 0;
}

.account-box {
    position: relative;
}

.account-trigger {
    min-width: 190px;
    min-height: 58px;
    padding: 8px 12px 8px 9px;
    border-radius: 20px;
    border: 1px solid var(--surface-border-soft);
    background: var(--surface-soft) !important;
    box-shadow: var(--surface-shadow);
}

.account-trigger .avatar,
.profile-head .avatar,
.message-avatar {
    border-radius: 16px;
    background: linear-gradient(135deg, var(--brand-a), var(--brand-b));
    color: #fff;
    box-shadow: 0 12px 24px rgba(146, 101, 255, 0.22);
}

.account-trigger .avatar {
    width: 40px;
    height: 40px;
}

.user-meta {
    gap: 2px;
}

.account-menu,
.chat-menu,
.mode-dropdown {
    border-radius: 20px;
    padding: 10px;
}

.account-menu a,
.account-menu button,
.chat-menu button,
.mode-option {
    border-radius: 14px;
}

.content {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 92px);
    padding: 12px;
    border-radius: 34px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)), var(--surface-alt) !important;
}

.chat-layout {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    gap: 0;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0;
}

.chat-layout.is-home {
    justify-content: center;
}

.messages {
    flex: 1;
    padding: 10px 28px 12px;
    gap: 18px;
}

.home-hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px 32px;
    text-align: center;
}

.home-hero h1 {
    margin: 0;
    font-size: clamp(42px, 6vw, 62px);
    line-height: 1.08;
    letter-spacing: -0.05em;
    font-weight: 700;
    color: var(--text-main);
}

.input-panel {
    padding: 20px 18px 12px;
}

.input-wrap,
.home-input-wrap {
    width: min(880px, calc(100% - 12px));
    margin: 0 auto;
    padding: 14px 18px 14px;
    border-radius: 28px;
    background: var(--input-bg) !important;
}

.input-wrap textarea,
.home-input-wrap textarea {
    min-height: 92px;
    padding: 10px 4px 14px;
    background: transparent !important;
    border: 0 !important;
    color: var(--text-main) !important;
    font-size: 18px;
    line-height: 1.45;
}

.input-wrap textarea::placeholder,
.home-input-wrap textarea::placeholder {
    color: var(--text-soft);
}

.composer-footer {
    align-items: center;
    gap: 14px;
    border-top: 1px solid var(--surface-border-soft);
    padding-top: 12px;
}

.composer-actions-left,
.composer-actions-right {
    align-items: center;
    gap: 10px;
}

.composer-icon-button,
.composer-send-button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--surface-border-soft);
    background: rgba(255,255,255,0.06) !important;
    color: var(--text-main) !important;
}

body.theme-light .composer-icon-button,
body.theme-light .composer-send-button {
    background: rgba(255,255,255,0.92) !important;
}

.composer-send-button {
    background: linear-gradient(135deg, var(--brand-a), var(--brand-b)) !important;
    border-color: transparent !important;
    color: #fff !important;
}

.composer-icon,
.composer-send-arrow {
    display: inline-block;
    width: 18px;
    height: 18px;
    background-color: currentColor;
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
}

.composer-icon-plus {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10.5 3a1.5 1.5 0 0 1 3 0v7.5H21a1.5 1.5 0 0 1 0 3h-7.5V21a1.5 1.5 0 0 1-3 0v-7.5H3a1.5 1.5 0 0 1 0-3h7.5V3z'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M10.5 3a1.5 1.5 0 0 1 3 0v7.5H21a1.5 1.5 0 0 1 0 3h-7.5V21a1.5 1.5 0 0 1-3 0v-7.5H3a1.5 1.5 0 0 1 0-3h7.5V3z'/%3E%3C/svg%3E");
}

.composer-icon-mic {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 15a3.75 3.75 0 0 0 3.75-3.75V6.75a3.75 3.75 0 1 0-7.5 0v4.5A3.75 3.75 0 0 0 12 15Zm5.25-3.75a.75.75 0 0 1 1.5 0A6.75 6.75 0 0 1 12.75 17.94V21a.75.75 0 0 1-1.5 0v-3.06A6.75 6.75 0 0 1 5.25 11.25a.75.75 0 0 1 1.5 0 5.25 5.25 0 1 0 10.5 0Z'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 15a3.75 3.75 0 0 0 3.75-3.75V6.75a3.75 3.75 0 1 0-7.5 0v4.5A3.75 3.75 0 0 0 12 15Zm5.25-3.75a.75.75 0 0 1 1.5 0A6.75 6.75 0 0 1 12.75 17.94V21a.75.75 0 0 1-1.5 0v-3.06A6.75 6.75 0 0 1 5.25 11.25a.75.75 0 0 1 1.5 0 5.25 5.25 0 1 0 10.5 0Z'/%3E%3C/svg%3E");
}

.composer-send-arrow {
    background: #fff;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4.22 11.27 18.28 5.24c1.05-.45 2.14.63 1.7 1.69l-6.03 14.06c-.5 1.16-2.17 1-2.45-.24l-1.02-4.55a1.5 1.5 0 0 0-1.12-1.13L4.45 14c-1.24-.28-1.4-1.95-.23-2.45Z'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M4.22 11.27 18.28 5.24c1.05-.45 2.14.63 1.7 1.69l-6.03 14.06c-.5 1.16-2.17 1-2.45-.24l-1.02-4.55a1.5 1.5 0 0 0-1.12-1.13L4.45 14c-1.24-.28-1.4-1.95-.23-2.45Z'/%3E%3C/svg%3E");
}


.composer-send-button.is-stop .composer-send-arrow {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 7h10v10H7z'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M7 7h10v10H7z'/%3E%3C/svg%3E");
}

.mode-switcher,
.mode-pill,
.composer-brand-tag {
    border-radius: 999px;
}

.mode-chip,
.mode-pill,
.composer-brand-tag,
.attachment-preview {
    min-height: 38px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--chip-border);
    background: var(--chip-bg) !important;
}

.mode-pill-fast,
.mode-pill-thinking {
    color: var(--text-main) !important;
}

.attachment-preview {
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message {
    gap: 14px;
    align-items: flex-start;
}

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

.message.user .message-body {
    background: var(--message-user-bg) !important;
    border-color: transparent !important;
    color: #fff;
}

.message.user .message-content,
.message.user .message-meta,
.message.user .message-artifact-label,
.message.user .message-download-link {
    color: #f8fbff !important;
}

.message.assistant .message-body {
    background: var(--message-ai-bg) !important;
}

.message-body {
    border-radius: 26px;
    padding: 18px 18px 12px;
}

.message-content {
    font-size: 16px;
    line-height: 1.62;
}

.bridge-thinking-card {
    margin-bottom: 12px;
    border-radius: 18px;
    border: 1px solid rgba(63, 201, 132, 0.22);
    background: linear-gradient(180deg, rgba(23, 103, 66, 0.18), rgba(19, 56, 40, 0.1));
}

body.theme-light .bridge-thinking-card {
    background: linear-gradient(180deg, rgba(81, 195, 131, 0.15), rgba(81, 195, 131, 0.06));
}

.message-speak-button,
.icon-button,
.chat-controls .icon-button {
    border-radius: 14px;
    border: 1px solid var(--surface-border-soft);
    background: rgba(255,255,255,0.05) !important;
    color: var(--text-main);
}

body.theme-light .message-speak-button,
body.theme-light .icon-button,
body.theme-light .chat-controls .icon-button {
    background: rgba(255,255,255,0.75) !important;
}

.settings-page,
.admin-page {
    padding: 6px;
}

.settings-grid,
.admin-shell {
    gap: 16px;
}

.settings-card,
.admin-section,
.stat-card,
.install-card {
    border-radius: 28px;
    padding: 22px;
}

.settings-form input,
.settings-form textarea,
.settings-form select,
.table-select,
.ticket-reply-box textarea,
.ticket-reply-box input,
.search-input,
.search-box input,
label input,
label select {
    border-radius: 16px !important;
    background: rgba(255,255,255,0.04) !important;
    border: 1px solid var(--surface-border-soft) !important;
    color: var(--text-main) !important;
}

body.theme-light .settings-form input,
body.theme-light .settings-form textarea,
body.theme-light .settings-form select,
body.theme-light .table-select,
body.theme-light .ticket-reply-box textarea,
body.theme-light .ticket-reply-box input,
body.theme-light .search-input,
body.theme-light .search-box input,
body.theme-light label input,
body.theme-light label select {
    background: rgba(255,255,255,0.82) !important;
}

.admin-nav-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    min-height: 70px;
}

.admin-nav-item span:last-child {
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
}

.admin-grid.compact-admin-grid,
.admin-columns,
.settings-grid,
.profile-grid-custom {
    gap: 16px;
}

.profile-summary-card,
.settings-main-card,
.help-overview-hero {
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)), var(--surface-alt) !important;
}

.auth-modal-card,
.rename-card {
    border-radius: 30px;
    background: var(--surface-soft) !important;
    border: 1px solid var(--surface-border-strong) !important;
    box-shadow: var(--surface-shadow);
}

.flash {
    border-radius: 18px;
    background: var(--surface-soft) !important;
    border: 1px solid var(--surface-border-soft) !important;
    color: var(--text-main);
}

@media (max-width: 1100px) {
    .app-shell {
        grid-template-columns: 1fr;
        padding: 10px;
        gap: 12px;
    }

    .sidebar {
        position: fixed;
        left: 10px;
        top: 10px;
        bottom: 10px;
        width: min(300px, calc(100vw - 20px));
        transform: translateX(-110%);
        transition: transform .24s ease;
        z-index: 50;
    }

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

    .main,
    .content {
        min-height: calc(100vh - 20px);
    }

    .topbar {
        padding-inline: 4px;
    }

    .chat-context strong {
        font-size: 24px;
    }

    .topbar-right {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .account-trigger {
        min-width: 0;
        padding-right: 10px;
    }
}

@media (max-width: 760px) {
    .content {
        border-radius: 24px;
        padding: 10px;
    }

    .messages {
        padding: 6px 8px 8px;
    }

    .message {
        gap: 10px;
    }

    .message-avatar {
        width: 38px;
        height: 38px;
        font-size: 13px;
    }

    .message-body {
        padding: 14px 14px 10px;
        border-radius: 20px;
    }

    .home-hero h1 {
        font-size: 34px;
    }

    .input-panel {
        padding: 14px 6px 6px;
    }

    .input-wrap,
    .home-input-wrap {
        width: 100%;
        border-radius: 24px;
        padding: 12px 14px;
    }

    .input-wrap textarea,
    .home-input-wrap textarea {
        min-height: 70px;
        font-size: 16px;
    }

    .composer-footer {
        flex-wrap: wrap;
        gap: 10px;
    }

    .composer-actions-left,
    .composer-actions-right {
        width: 100%;
        justify-content: space-between;
    }

    .attachment-preview {
        flex: 1;
        max-width: none;
        min-width: 0;
    }

    .topbar {
        align-items: flex-start;
        gap: 10px;
    }

    .topbar-left {
        width: 100%;
    }

    .topbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .topbar-account-box {
        flex: 1;
    }

    .account-trigger {
        width: 100%;
    }

    .admin-link {
        min-height: 42px;
        padding: 0 14px;
    }

    .settings-card,
    .admin-section,
    .stat-card {
        padding: 16px;
        border-radius: 22px;
    }
}


/* auth modal hotfix */
.auth-modal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 1800 !important;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-modal.visible {
    display: flex !important;
}

.auth-overlay {
    position: absolute !important;
    inset: 0 !important;
    z-index: 0 !important;
}

.auth-overlay[hidden] {
    display: none !important;
}

.auth-dialog {
    position: relative !important;
    z-index: 1 !important;
    max-height: min(90vh, 860px);
    overflow: auto;
}

.auth-box a.button {
    text-decoration: none;
}


/* ui shell polish v2 */
body.theme-dark {
    --shell-bg: #05070f;
    --shell-bg-2: #0a1020;
    --shell-glow-a: rgba(95, 117, 255, 0.16);
    --shell-glow-b: rgba(113, 179, 255, 0.09);
    --surface-main: rgba(11, 18, 32, 0.50);
    --surface-alt: rgba(12, 18, 30, 0.62);
    --surface-soft: rgba(16, 24, 38, 0.78);
    --surface-border-strong: rgba(255, 255, 255, 0.12);
    --surface-border-soft: rgba(255, 255, 255, 0.08);
    --surface-shadow: 0 22px 56px rgba(0, 0, 0, 0.34);
    --text-main: #f4f6fb;
    --text-soft: rgba(226, 232, 245, 0.70);
    --text-muted: rgba(203, 210, 226, 0.46);
    --input-bg: rgba(11, 18, 31, 0.72);
}

body.theme-light {
    --shell-bg: #eef1f7;
    --shell-bg-2: #e9edf5;
    --shell-glow-a: rgba(154, 159, 198, 0.12);
    --shell-glow-b: rgba(255, 255, 255, 0.58);
    --surface-main: rgba(255, 255, 255, 0.54);
    --surface-alt: rgba(255, 255, 255, 0.72);
    --surface-soft: rgba(255, 255, 255, 0.84);
    --surface-border-strong: rgba(136, 149, 177, 0.18);
    --surface-border-soft: rgba(136, 149, 177, 0.12);
    --surface-shadow: 0 22px 60px rgba(133, 145, 170, 0.18);
    --text-main: #141b2d;
    --text-soft: rgba(40, 50, 76, 0.68);
    --text-muted: rgba(58, 70, 97, 0.42);
    --input-bg: rgba(255, 255, 255, 0.66);
}

body {
    background:
        radial-gradient(circle at 14% 12%, var(--shell-glow-a), transparent 30%),
        radial-gradient(circle at 86% 82%, var(--shell-glow-b), transparent 28%),
        linear-gradient(180deg, var(--shell-bg) 0%, var(--shell-bg-2) 100%);
}

body::before {
    background:
        radial-gradient(circle at 50% 40%, rgba(255,255,255,0.04), transparent 42%),
        repeating-linear-gradient(120deg, rgba(255,255,255,0.018) 0 2px, transparent 2px 34px);
    opacity: .72;
}

body.theme-light::before {
    background:
        radial-gradient(circle at 50% 38%, rgba(255,255,255,0.34), transparent 44%),
        repeating-linear-gradient(120deg, rgba(168,176,201,0.08) 0 2px, transparent 2px 36px);
    opacity: .85;
}

.app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 16px;
    padding: 18px;
}

.sidebar,
.content,
.sidebar-card,
.settings-card,
.admin-section,
.stat-card,
.install-card,
.ticket-list-item,
.download-platform-card,
.role-accordion-item,
.message-body,
.input-wrap,
.home-input-wrap,
.chat-menu,
.account-menu,
.help-sidebar-card,
.help-overview-hero,
.ticket-message,
.admin-side-card,
.table-shell,
.auth-modal-card,
.rename-card {
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
}

.sidebar,
.content {
    position: relative;
    overflow: hidden;
}

.sidebar::before,
.content::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 25% 18%, rgba(255,255,255,0.065), transparent 32%),
        linear-gradient(135deg, rgba(255,255,255,0.038), transparent 34%),
        repeating-linear-gradient(125deg, rgba(255,255,255,0.015) 0 2px, transparent 2px 30px);
    opacity: .9;
}

body.theme-light .sidebar::before,
body.theme-light .content::before {
    background:
        radial-gradient(circle at 26% 18%, rgba(255,255,255,0.52), transparent 34%),
        linear-gradient(135deg, rgba(255,255,255,0.34), transparent 36%),
        repeating-linear-gradient(125deg, rgba(150,160,188,0.08) 0 2px, transparent 2px 30px);
}

.sidebar > *,
.content > * {
    position: relative;
    z-index: 1;
}

.sidebar {
    width: 240px;
    min-height: calc(100vh - 36px);
    border-radius: 28px;
    padding: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.016)), var(--surface-alt) !important;
}

.brand {
    padding: 8px 8px 10px;
}

.brand-text strong {
    font-size: 17px;
}

.brand-text span {
    font-size: 12px;
    color: var(--text-soft);
}

.brand-sidebar-toggle,
.icon-button {
    background: rgba(255,255,255,0.06) !important;
    border-color: rgba(255,255,255,0.08) !important;
}

body.theme-light .brand-sidebar-toggle,
body.theme-light .icon-button {
    background: rgba(255,255,255,0.72) !important;
}

.sidebar-card {
    background: rgba(12, 18, 30, 0.46) !important;
}

body.theme-light .sidebar-card {
    background: rgba(255,255,255,0.58) !important;
}

.sidebar-actions .button {
    min-height: 54px;
    border-radius: 18px;
    font-size: 15px;
    font-weight: 700;
    background: linear-gradient(180deg, rgba(112, 18, 37, 0.96), rgba(58, 9, 18, 0.98)) !important;
    border: 1px solid rgba(255, 116, 151, 0.22) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 14px 30px rgba(38, 5, 13, 0.34);
}

.ghost-button,
.admin-link,
.account-trigger,
.mode-chip,
.attachment-preview,
.admin-nav-item,
.auth-box .button {
    background: rgba(255,255,255,0.05) !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
}

body.theme-light .ghost-button,
body.theme-light .admin-link,
body.theme-light .account-trigger,
body.theme-light .mode-chip,
body.theme-light .attachment-preview,
body.theme-light .admin-nav-item,
body.theme-light .auth-box .button {
    background: rgba(255,255,255,0.72) !important;
    border-color: rgba(136,149,177,0.16) !important;
}

.topbar {
    position: relative;
    z-index: 120;
    overflow: visible !important;
    padding: 4px 4px 14px;
}

.topbar-right {
    position: relative;
    z-index: 160;
    overflow: visible !important;
}

.chat-context strong {
    font-size: 29px;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.chat-context span {
    color: var(--text-soft);
}

.content {
    min-height: calc(100vh - 36px);
    padding: 12px;
    border-radius: 30px;
    background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.018)), var(--surface-alt) !important;
}

.topbar-account-box,
.account-box {
    position: relative;
    z-index: 240;
    pointer-events: auto;
}

.account-trigger {
    min-width: 184px;
    min-height: 56px;
    border-radius: 18px;
    padding: 8px 12px 8px 8px;
    box-shadow: 0 14px 30px rgba(0,0,0,0.18);
}

.account-trigger .avatar {
    width: 42px;
    height: 42px;
    border-radius: 15px;
}

.account-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    z-index: 400;
    padding: 8px;
    background: rgba(10, 17, 30, 0.9) !important;
    border: 1px solid rgba(255,255,255,0.10) !important;
}

body.theme-light .account-menu {
    background: rgba(255,255,255,0.92) !important;
    border-color: rgba(136,149,177,0.16) !important;
}

.account-menu a,
.account-menu button {
    padding: 12px 14px;
}

.sidebar-footer-minimal {
    display: none !important;
}

.flash-stack {
    position: fixed !important;
    left: 50% !important;
    top: 20px !important;
    transform: translateX(-50%);
    width: min(560px, calc(100vw - 40px));
    z-index: 2200 !important;
    pointer-events: none;
}

.flash {
    padding: 14px 18px;
    border-radius: 18px;
    text-align: center;
    font-weight: 500;
    background: rgba(11, 18, 31, 0.82) !important;
    border: 1px solid rgba(255,255,255,0.10) !important;
    box-shadow: 0 20px 46px rgba(0,0,0,0.26);
}

body.theme-light .flash {
    background: rgba(255,255,255,0.88) !important;
    border-color: rgba(136,149,177,0.16) !important;
}

.home-hero {
    padding: 72px 24px 34px;
}

.home-hero h1 {
    font-size: clamp(38px, 6vw, 58px);
    letter-spacing: -0.055em;
    font-weight: 700;
}

.input-panel {
    padding: 18px 16px 12px;
}

.input-wrap,
.home-input-wrap {
    width: min(860px, calc(100% - 12px));
    margin: 0 auto;
    border-radius: 26px;
    padding: 14px 16px 12px;
    background: rgba(9, 15, 27, 0.74) !important;
}

body.theme-light .input-wrap,
body.theme-light .home-input-wrap {
    background: rgba(255,255,255,0.78) !important;
}

.composer-footer {
    padding-top: 10px;
}

.composer-icon-button,
.composer-send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05) !important;
}

.composer-send-button {
    background: linear-gradient(135deg, #1fd794, #3ddf9c) !important;
    box-shadow: 0 12px 24px rgba(26, 180, 116, 0.28);
}

body.theme-light .composer-send-button {
    background: linear-gradient(135deg, #10b981, #34d399) !important;
}

.messages {
    padding: 10px 24px 8px;
}

.message-body {
    background: rgba(11, 18, 30, 0.58) !important;
}

body.theme-light .message-body {
    background: rgba(255,255,255,0.68) !important;
}

.settings-card,
.admin-section,
.stat-card,
.install-card,
.table-shell,
.help-overview-hero,
.admin-side-card,
.ticket-list-item {
    background: rgba(12, 18, 30, 0.52) !important;
}

body.theme-light .settings-card,
body.theme-light .admin-section,
body.theme-light .stat-card,
body.theme-light .install-card,
body.theme-light .table-shell,
body.theme-light .help-overview-hero,
body.theme-light .admin-side-card,
body.theme-light .ticket-list-item {
    background: rgba(255,255,255,0.68) !important;
}

@media (max-width: 1100px) {
    .app-shell {
        padding: 12px;
        gap: 12px;
    }

    .sidebar {
        width: min(300px, calc(100vw - 24px));
        min-height: calc(100vh - 24px);
    }

    .content,
    .main {
        min-height: calc(100vh - 24px);
    }
}


/* Paczka 24: portal dla menu czatu nad sidebar/content */
.chat-menu.chat-menu-floating {
    position: fixed !important;
    z-index: 5000 !important;
}

.chat-controls,
.chat-row {
    overflow: visible;
}


/* Paczka 26: akcent globalny + korekta home/topbar */
:root {
    --accent-a: #12a56a;
    --accent-b: #34d399;
    --accent-contrast: #ffffff;
    --accent-shadow: rgba(18, 165, 106, 0.32);
}

body.accent-red { --accent-a: #b91c1c; --accent-b: #ef4444; --accent-contrast: #ffffff; --accent-shadow: rgba(185, 28, 28, 0.34); }
body.accent-green { --accent-a: #0f9f63; --accent-b: #34d399; --accent-contrast: #ffffff; --accent-shadow: rgba(15, 159, 99, 0.32); }
body.accent-blue { --accent-a: #2563eb; --accent-b: #60a5fa; --accent-contrast: #ffffff; --accent-shadow: rgba(37, 99, 235, 0.34); }
body.accent-pink { --accent-a: #be185d; --accent-b: #f472b6; --accent-contrast: #ffffff; --accent-shadow: rgba(190, 24, 93, 0.34); }
body.accent-yellow { --accent-a: #ca8a04; --accent-b: #fde047; --accent-contrast: #1f2937; --accent-shadow: rgba(202, 138, 4, 0.30); }
body.accent-orange { --accent-a: #c2410c; --accent-b: #fb923c; --accent-contrast: #ffffff; --accent-shadow: rgba(194, 65, 12, 0.32); }
body.accent-white { --accent-a: #e5e7eb; --accent-b: #ffffff; --accent-contrast: #111827; --accent-shadow: rgba(148, 163, 184, 0.24); }
body.accent-gray { --accent-a: #4b5563; --accent-b: #9ca3af; --accent-contrast: #ffffff; --accent-shadow: rgba(75, 85, 99, 0.32); }
body.accent-lime { --accent-a: #65a30d; --accent-b: #bef264; --accent-contrast: #172554; --accent-shadow: rgba(101, 163, 13, 0.30); }
body.accent-gold { --accent-a: #a16207; --accent-b: #fbbf24; --accent-contrast: #111827; --accent-shadow: rgba(161, 98, 7, 0.30); }
body.accent-sky { --accent-a: #0284c7; --accent-b: #7dd3fc; --accent-contrast: #082f49; --accent-shadow: rgba(2, 132, 199, 0.30); }

.button:not(.secondary):not(.danger),
.sidebar-actions .button,
.auth-box .button:not(.secondary),
.brand-mark,
.composer-send-button {
    background: linear-gradient(135deg, var(--accent-a), var(--accent-b)) !important;
    color: var(--accent-contrast) !important;
}

.sidebar-actions .button,
.composer-send-button {
    border-color: transparent !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.10), 0 14px 30px var(--accent-shadow) !important;
}

.button:not(.secondary):not(.danger):hover,
.sidebar-actions .button:hover,
.auth-box .button:not(.secondary):hover,
.composer-send-button:hover,
.brand-mark:hover {
    filter: brightness(1.06);
}

.main {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
    min-height: calc(100vh - 36px);
}

.topbar {
    padding: 2px 2px 6px !important;
}

.content {
    min-height: 0 !important;
    height: auto;
}

.chat-layout.is-home {
    justify-content: space-between !important;
    min-height: 100%;
}

.home-hero {
    padding: 18px 24px 8px !important;
    flex: 1 1 auto;
}

.input-panel,
.home-input-panel {
    padding: 8px 18px 14px !important;
}

.flash-stack {
    top: 34px !important;
}

@media (max-width: 980px) {
    .main {
        gap: 6px;
    }

    .topbar {
        padding-bottom: 4px !important;
    }

    .home-hero {
        padding-top: 14px !important;
    }
}


/* Paczka 27: brand mark zawsze prowadzi do strony głównej */
.brand {
    position: relative;
    z-index: 24;
}

.brand-mark,
.brand-text,
.brand-sidebar-toggle {
    position: relative;
    z-index: 25;
}

.brand-mark {
    pointer-events: auto;
    cursor: pointer;
}

/* Composer alignment fix: closer to reference shell */
.brand {
    position: relative;
}

.brand-mark {
    position: relative;
    z-index: 40;
}

.input-panel {
    padding-top: 10px !important;
    padding-bottom: 14px !important;
}

.home-input-panel {
    padding-top: 6px !important;
}

.input-wrap,
.home-input-wrap {
    position: relative;
    width: min(840px, calc(100% - 12px)) !important;
    border-radius: 30px !important;
    padding: 18px 18px 14px !important;
    background: linear-gradient(180deg, rgba(8, 15, 28, 0.74), rgba(6, 12, 24, 0.88)) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255,255,255,0.06) !important;
}

body.theme-light .input-wrap,
body.theme-light .home-input-wrap {
    background: linear-gradient(180deg, rgba(255,255,255,0.76), rgba(248,250,255,0.9)) !important;
    border-color: rgba(112, 130, 170, 0.16) !important;
    box-shadow: 0 20px 48px rgba(110, 132, 173, 0.18), inset 0 1px 0 rgba(255,255,255,0.7) !important;
}

.input-wrap textarea,
.home-input-wrap textarea {
    min-height: 92px !important;
    padding: 6px 66px 18px 4px !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    font-size: 18px !important;
    line-height: 1.45 !important;
}

.input-wrap textarea::placeholder,
.home-input-wrap textarea::placeholder {
    color: rgba(231, 236, 248, 0.72) !important;
}

body.theme-light .input-wrap textarea::placeholder,
body.theme-light .home-input-wrap textarea::placeholder {
    color: rgba(59, 72, 99, 0.62) !important;
}

.composer-ai-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border-radius: 11px;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
    border: 1px solid rgba(255,255,255,0.08);
    font-weight: 700;
    letter-spacing: -0.02em;
    pointer-events: none;
}

body.theme-light .composer-ai-badge {
    background: rgba(255,255,255,0.78);
    color: #4a5568;
    border-color: rgba(137, 151, 177, 0.22);
}

.composer-footer {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 18px !important;
    padding-top: 12px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.theme-light .composer-footer {
    border-top-color: rgba(117, 132, 160, 0.16) !important;
}

.composer-actions-left,
.composer-actions-right {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    flex-wrap: nowrap !important;
}

.composer-actions-left {
    min-width: 0;
    flex: 1 1 auto;
}

.composer-actions-right {
    margin-left: auto;
    flex: 0 0 auto;
}

.composer-icon-button,
.composer-send-button,
.composer-mode-trigger {
    height: 40px !important;
}

.composer-icon-button {
    width: 40px !important;
    min-width: 40px !important;
    background: rgba(255,255,255,0.07) !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05) !important;
}

body.theme-light .composer-icon-button {
    background: rgba(255,255,255,0.78) !important;
    border-color: rgba(123, 141, 175, 0.2) !important;
}

.mic-trigger {
    background: linear-gradient(135deg, rgba(212, 89, 219, 0.92), rgba(234, 89, 173, 0.95)) !important;
    border-color: rgba(255,255,255,0.12) !important;
    box-shadow: 0 10px 24px rgba(214, 83, 173, 0.28) !important;
}

.composer-mode-switcher {
    position: relative;
    flex: 0 0 auto;
}

.composer-mode-trigger,
.composer-mode-switcher .mode-chip {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
    padding: 0 14px !important;
    border-radius: 999px !important;
    background: rgba(255,255,255,0.07) !important;
    border: 1px solid rgba(255,255,255,0.09) !important;
    color: rgba(255,255,255,0.94) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05) !important;
}

body.theme-light .composer-mode-trigger,
body.theme-light .composer-mode-switcher .mode-chip {
    background: rgba(255,255,255,0.82) !important;
    border-color: rgba(123, 141, 175, 0.2) !important;
    color: #233047 !important;
}

.composer-mode-trigger .mode-chip-value {
    font-size: 13px !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em !important;
    white-space: nowrap;
}

.attachment-preview {
    display: inline-flex !important;
    align-items: center !important;
    min-width: 0 !important;
    max-width: 320px !important;
    height: 40px !important;
    padding: 0 12px !important;
    border-radius: 12px !important;
    background: rgba(255,255,255,0.03) !important;
    border: 1px solid rgba(255,255,255,0.05) !important;
    color: rgba(223, 230, 243, 0.88) !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-preview[hidden],
.attachment-preview.is-empty {
    display: none !important;
}

body.theme-light .attachment-preview {
    background: rgba(255,255,255,0.7) !important;
    color: #516076 !important;
    border-color: rgba(123, 141, 175, 0.16) !important;
}

.mode-pill {
    height: 40px !important;
    padding: 0 14px !important;
    border-radius: 999px !important;
    display: inline-flex !important;
    align-items: center !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    letter-spacing: -0.01em !important;
}

@media (max-width: 900px) {
    .input-wrap,
    .home-input-wrap {
        width: calc(100% - 8px) !important;
        padding: 16px 14px 12px !important;
    }

    .input-wrap textarea,
    .home-input-wrap textarea {
        min-height: 82px !important;
        padding-right: 58px !important;
        font-size: 16px !important;
    }

    .composer-footer {
        gap: 10px !important;
    }

    .composer-actions-left,
    .composer-actions-right {
        gap: 8px !important;
    }

    .composer-mode-trigger .mode-chip-value,
    .mode-pill {
        font-size: 12px !important;
    }

    .attachment-preview {
        max-width: 160px !important;
    }
}


.sidebar-card-static-agent {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-static-note {
    color: var(--muted-text, rgba(255,255,255,0.7));
    font-size: 0.88rem;
}

.sidebar-static-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sidebar-static-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 600;
}


.composer-submit-status {
    margin: 0 0 10px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.88);
    font-size: 13px;
    line-height: 1.45;
}


.composer-status-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.composer-thinking-dots {
    color: rgba(223, 242, 255, 0.92);
}

.composer-loading-copy {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.composer-loading-copy .composer-thinking-dots,
.composer-submit-status .composer-thinking-dots {
    transform: translateY(1px);
}

body.theme-light .composer-submit-status {
    border-color: rgba(17, 24, 39, 0.08);
    background: rgba(17, 24, 39, 0.04);
    color: rgba(17, 24, 39, 0.88);
}

.input-wrap.is-submitting .composer-send-button,
.home-input-wrap.is-submitting .composer-send-button {
    opacity: 0.7;
    pointer-events: none;
}

.input-wrap.is-submitting .composer-send-button.is-stop,
.home-input-wrap.is-submitting .composer-send-button.is-stop {
    opacity: 1;
    pointer-events: auto;
}

.input-wrap.is-submitting textarea,
.home-input-wrap.is-submitting textarea {
    opacity: 0.96;
}

/* A1_9 overflow hardening for wide inline/code replies */
.message,
.message-body,
.message-content,
.rich-content {
    min-width: 0;
}

.message-content,
.rich-content,
.message-code-language {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.message-code-wrap {
    max-width: 100%;
}

.message-code-toolbar {
    min-width: 0;
}

.message-code {
    max-width: 100%;
}

.chat-main,
.chat-title,
.chat-subtitle {
    min-width: 0;
}


/* A1_10 overflow hardening for wide replies */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

.chat-layout,
.chat-main,
.message-list,
.message-body,
.message-content,
.rich-content {
    min-width: 0;
}

.message-code,
.message-code-wrap,
.message-code-wrap pre,
.message-code-wrap code {
    max-width: 100%;
}



.hardware-admin-root {
    display: grid;
    gap: 18px;
}

.hardware-heading-row {
    margin-bottom: 0;
}

.hardware-status-row,
.hardware-kpi-grid,
.hardware-chart-grid,
.hardware-meta-grid {
    display: grid;
    gap: 16px;
}

.hardware-status-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.hardware-kpi-grid-primary {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.hardware-kpi-grid-primary .hardware-kpi-card,
.hardware-meta-card,
.hardware-chart-card,
.hardware-summary-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(9, 18, 40, 0.86), rgba(8, 17, 34, 0.72));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 16px 34px rgba(2, 6, 23, 0.18);
}

.hardware-summary-card {
    padding: 18px 18px 16px;
}

.hardware-summary-card .stat-label {
    display: block;
    margin-bottom: 10px;
    color: rgba(226, 232, 240, 0.68);
    font-size: 13px;
}

.hardware-summary-card .stat-value {
    display: block;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.2;
}

.hardware-summary-card .stat-hint {
    display: block;
    margin-top: 7px;
    color: rgba(148, 163, 184, 0.82);
    font-size: 11px;
}

.hardware-summary-card .stat-hint sup {
    font-size: 10px;
    top: -0.3em;
    position: relative;
}

.hardware-summary-value-compact {
    font-size: 14px !important;
    line-height: 1.3 !important;
    letter-spacing: -0.01em;
}

.hardware-summary-value-timestamp {
    font-size: 13px !important;
    line-height: 1.35 !important;
}

.hardware-summary-value-timestamp sup {
    font-size: 9px;
    top: -0.35em;
    position: relative;
}

.hardware-summary-card-power.is-online .stat-value {
    color: #e2fbe8;
}

.hardware-summary-card-power.is-offline {
    border-color: rgba(239, 68, 68, 0.34);
    background: linear-gradient(180deg, rgba(40, 9, 16, 0.9), rgba(29, 8, 13, 0.76));
}

.hardware-summary-card-power.is-offline .stat-value {
    color: #fca5a5;
}

.hardware-summary-card-power.is-offline .stat-hint {
    color: rgba(252, 165, 165, 0.78);
}

.hardware-kpi-card,
.hardware-meta-card,
.hardware-chart-card {
    padding: 18px;
}

.hardware-kpi-card-compact {
    min-height: 0;
}

.hardware-kpi-card-disk .hardware-kpi-value {
    margin: 10px 0 10px;
    font-size: 32px;
}

.hardware-kpi-card-disk .hardware-submeta {
    font-size: 12px;
    color: rgba(226, 232, 240, 0.72);
    margin-top: 10px;
}

.hardware-kpi-head,
.hardware-chart-head,
.hardware-meta-grid div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.hardware-kpi-head span,
.hardware-chart-head span,
.hardware-submeta,
.hardware-meta-grid span {
    color: rgba(226, 232, 240, 0.72);
    font-size: 12px;
}

.hardware-kpi-value {
    font-size: 38px;
    font-weight: 800;
    margin: 10px 0 12px;
    letter-spacing: -0.03em;
}

.hardware-kpi-value.small {
    font-size: 18px;
}

.hardware-meter {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(148, 163, 184, 0.18);
}

.hardware-meter span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.95), rgba(59, 130, 246, 0.95));
}

.hardware-submeta {
    margin-top: 12px;
}

.hardware-kpi-head span {
    text-align: right;
    min-height: 18px;
}

.hardware-kpi-value {
    font-size: 34px;
}

.hardware-submeta {
    margin-top: 10px;
    line-height: 1.35;
    min-height: 32px;
}

.hardware-kpi-card-disk .hardware-submeta {
    min-height: 18px;
}

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

.hardware-meta-grid strong {
    font-size: 18px;
}

.hardware-accordion {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(9, 18, 40, 0.86), rgba(8, 17, 34, 0.72));
    overflow: hidden;
}

.hardware-accordion > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    font-weight: 700;
}

.hardware-accordion > summary::-webkit-details-marker {
    display: none;
}

.hardware-accordion > summary small {
    color: rgba(148, 163, 184, 0.82);
    font-size: 12px;
}

.hardware-accordion[open] > summary {
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.hardware-chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 18px;
}

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

.hardware-chart-card {
    padding: 16px;
}

.hardware-chart-head {
    margin-bottom: 10px;
}

.hardware-trend-chart {
    min-height: 200px;
}

.hardware-chart-surface {
    position: relative;
    height: 200px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(2, 6, 23, 0.42), rgba(15, 23, 42, 0.18));
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px 10px 8px;
}

.hardware-trend-chart svg {
    display: block;
    width: 100%;
    height: 164px;
}

.hardware-chart-axis {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: rgba(148, 163, 184, 0.78);
    font-size: 11px;
    margin-top: 4px;
}

.hardware-chart-grid-line {
    stroke: rgba(148, 163, 184, 0.12);
    stroke-width: 1;
}

.hardware-chart-cursor {
    stroke: rgba(148, 163, 184, 0.46);
    stroke-dasharray: 4 4;
    stroke-width: 1.2;
}

.hardware-chart-dot {
    fill: #f8fafc;
    stroke: rgba(15, 23, 42, 0.8);
    stroke-width: 2;
}

.hardware-chart-tooltip {
    position: absolute;
    top: 12px;
    min-width: 126px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 14px 28px rgba(2, 6, 23, 0.32);
    pointer-events: none;
}

.hardware-chart-tooltip strong {
    display: block;
    font-size: 16px;
    margin-bottom: 2px;
}

.hardware-chart-tooltip span {
    color: rgba(148, 163, 184, 0.82);
    font-size: 12px;
}

.hardware-chart-empty {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(226, 232, 240, 0.52);
    font-size: 13px;
    border-radius: 18px;
    border: 1px dashed rgba(148, 163, 184, 0.24);
    background: rgba(2, 6, 23, 0.22);
}

.hardware-inline-error {
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.24);
    color: #fecaca;
}

@media (max-width: 1600px) {
    .hardware-kpi-grid-primary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1400px) {
    .hardware-status-row,
    .hardware-kpi-grid,
    .hardware-meta-grid-compact,
    .hardware-chart-grid,
    .hardware-chart-grid-temps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 960px) {
    .hardware-status-row,
    .hardware-kpi-grid,
    .hardware-meta-grid-compact,
    .hardware-chart-grid,
    .hardware-chart-grid-temps {
        grid-template-columns: 1fr;
    }

    .hardware-kpi-value {
        font-size: 32px;
    }
}

/* Patch 007: restore wcześniejsze poprawki po telemetry + admin cleanup */
.bridge-thinking-card {
    border-radius: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
}

body.theme-light .bridge-thinking-card {
    background: transparent;
}

:root {
    --chat-frame-max: 900px;
    --home-chat-frame-max: 980px;
    --chat-side-gutter: 24px;
    --chat-side-gutter-mobile: 14px;
    --message-avatar-track: 48px;
    --message-avatar-gap: 14px;
    --composer-offset-left: 30px;
    --composer-frame-max: calc(var(--chat-frame-max) - var(--composer-offset-left));
}

.brand {
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.brand-text {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
}

.brand-text strong {
    display: inline-block;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-text span,
.composer-ai-badge {
    display: none !important;
}

.message-list {
    padding-left: var(--chat-side-gutter);
    padding-right: var(--chat-side-gutter);
}

.message,
.input-wrap {
    width: min(var(--chat-frame-max), 100%);
}

.home-hero,
.home-input-wrap {
    width: min(var(--home-chat-frame-max), 100%);
}

.mode-strip-inner {
    width: min(var(--chat-frame-max), 100%);
    padding-left: 0;
    padding-right: 0;
}

.input-panel {
    padding-left: var(--chat-side-gutter);
    padding-right: var(--chat-side-gutter);
}

.input-wrap {
    position: relative;
}

.input-wrap textarea {
    padding-top: 12px;
    padding-right: 12px;
}

@media (min-width: 721px) {
    .input-panel:not(.home-input-panel) {
        display: grid;
        grid-template-columns: var(--composer-offset-left) minmax(0, var(--composer-frame-max));
        column-gap: 0;
        justify-content: center;
        align-items: start;
    }

    .input-panel:not(.home-input-panel) .input-wrap {
        grid-column: 2;
        width: min(var(--composer-frame-max), 100%) !important;
        max-width: var(--composer-frame-max);
        margin: 0;
    }
}

@media (max-width: 900px) {
    .mode-strip-inner {
        padding-left: 0;
        padding-right: 0;
    }
}

@media (max-width: 720px) {
    .brand {
        gap: 10px;
    }

    .brand-mark {
        width: 34px;
        height: 34px;
        border-radius: 11px;
    }

    .message-list {
        padding-left: var(--chat-side-gutter-mobile);
        padding-right: var(--chat-side-gutter-mobile);
    }

    .input-panel,
    .home-input-panel {
        padding-left: var(--chat-side-gutter-mobile);
        padding-right: var(--chat-side-gutter-mobile);
    }

    .input-panel:not(.home-input-panel) {
        display: block;
    }

    .input-panel:not(.home-input-panel) .input-wrap {
        width: 100% !important;
        max-width: none;
        margin: 0 auto;
    }
}

/* tylko jeden scroll w adminie */
.admin-page {
    height: auto !important;
    min-height: calc(100dvh - 60px);
    overflow: visible !important;
}

/* lekkie uproszczenie menu admina po usunięciu opisów */
.admin-nav-item > div {
    display: flex;
    align-items: center;
    min-width: 0;
}

.admin-nav-item > div strong {
    margin: 0;
}


/* P008: delete chat redirect + single scroll shell */
html,
body {
    height: 100%;
    overflow: hidden;
}

.app-shell {
    height: 100dvh;
    min-height: 100dvh;
}

.main {
    height: 100dvh !important;
    min-height: 100dvh !important;
    overflow: hidden;
}

.content {
    height: 100%;
    min-height: 0 !important;
    overflow: hidden !important;
}

.chat-layout,
.admin-page,
.settings-page {
    min-height: 0;
}

.message-list,
.admin-page,
.settings-page {
    overscroll-behavior: contain;
}

.admin-page,
.settings-page {
    height: 100%;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

@media (max-width: 980px) {
    .app-shell,
    .main {
        height: 100dvh !important;
        min-height: 100dvh !important;
    }
}


/* Hotfix stream/dropdown: stabilny portal dla menu użytkownika */
.account-menu[data-account-menu] {
    border-radius: 22px !important;
    overflow: visible !important;
    background: linear-gradient(180deg, rgba(12, 19, 33, 0.96), rgba(9, 15, 27, 0.94)) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 24px 54px rgba(0, 0, 0, 0.34) !important;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.account-menu.account-menu-floating {
    position: fixed !important;
    left: 0;
    top: 0;
    right: auto !important;
    bottom: auto !important;
    width: min(248px, calc(100vw - 24px)) !important;
    min-width: 0 !important;
    max-width: calc(100vw - 24px) !important;
    z-index: 3200 !important;
}

body.theme-light .account-menu[data-account-menu] {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 247, 252, 0.96)) !important;
    border-color: rgba(136, 149, 177, 0.18) !important;
    box-shadow: 0 24px 54px rgba(80, 95, 122, 0.18) !important;
}

/* Hotfix v12: stabilny dropdown konta po poprawkach streamu */
.topbar-account-box,
.account-box {
    overflow: visible !important;
}

.topbar-account-box .account-menu[data-account-menu],
.account-box .account-menu[data-account-menu] {
    position: absolute !important;
    top: calc(100% + 10px) !important;
    right: 0 !important;
    left: auto !important;
    bottom: auto !important;
    width: 230px !important;
    min-width: 230px !important;
    max-width: min(230px, calc(100vw - 24px)) !important;
    padding: 8px !important;
    border-radius: 18px !important;
    overflow: hidden !important;
    background: linear-gradient(180deg, rgba(15, 22, 36, 0.98), rgba(11, 17, 29, 0.97)) !important;
    border: 1px solid rgba(255, 255, 255, 0.10) !important;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.30) !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
    background-clip: padding-box !important;
    z-index: 1400 !important;
}

.topbar-account-box .account-menu[data-account-menu] a,
.topbar-account-box .account-menu[data-account-menu] button,
.account-box .account-menu[data-account-menu] a,
.account-box .account-menu[data-account-menu] button {
    border-radius: 12px !important;
}

body.theme-light .topbar-account-box .account-menu[data-account-menu],
body.theme-light .account-box .account-menu[data-account-menu] {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 247, 252, 0.96)) !important;
    border-color: rgba(136, 149, 177, 0.18) !important;
    box-shadow: 0 18px 42px rgba(80, 95, 122, 0.18) !important;
}
