/* Buttons */
button {
    font-family: inherit;
}

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
    min-height: 32px;
    white-space: nowrap;
}

.btn-primary {
    border: none;
    background: var(--color-primary-red);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.1s;
    gap: 8px;
    text-decoration: none;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    border: 1px solid var(--color-primary-red);
    background: var(--color-surface);
    color: var(--color-primary-red);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.1s;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-bg-cream);
}

tr:hover td {
    background: var(--color-surface-active);
    color: var(--color-text-primary);
}

.btn-secondary:disabled {
    border-color: var(--color-border);
    color: var(--color-text-secondary);
    cursor: not-allowed;
    opacity: 0.6;
    filter: grayscale(1);
    box-shadow: inset 4px 0 0 rgba(245, 67, 47, 0.35);
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--color-text-primary);
}

.icon-btn.danger:hover {
    background: rgba(217, 48, 37, 0.1);
    color: var(--color-danger);
}

.icon-btn.transcript-jump-btn {
    color: var(--color-primary-red);
}

.icon-btn.transcript-jump-btn:disabled {
    color: var(--color-text-secondary);
}

/* Forms (Inputs, Selects, Textareas) */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-body);
}

.form-input,
.form-select,
.form-textarea,
input[type="text"],
input[type="number"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: var(--color-surface-input);
    color: var(--color-text-primary);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
input[type="text"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary-green);
    box-shadow: 0 0 0 3px rgba(13, 102, 107, 0.1);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
input[type="number"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    border-color: var(--color-primary-green);
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 102, 107, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder,
input[type="text"]::placeholder,
input[type="number"]::placeholder,
input[type="search"]::placeholder,
textarea::placeholder,
.select-search-input::placeholder,
.chip-input::placeholder,
.search-input::placeholder {
    color: var(--color-text-placeholder);
    opacity: 1;
}

/* Checkboxes */
input[type="checkbox"] {
    accent-color: var(--color-primary-green);
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

/* Toggle Switch */
.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.toggle-track {
    width: 40px;
    height: 22px;
    background: #ccc;
    border-radius: 999px;
    position: relative;
    transition: background 0.2s;
}

.toggle-track::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-track {
    background: var(--color-primary-green);
}

.toggle-switch input:checked+.toggle-track::after {
    transform: translateX(18px);
}

/* Custom Select Styling Override */
select,
.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 40px;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--color-text-body) 50%),
        linear-gradient(135deg, var(--color-text-body) 50%, transparent 50%),
        linear-gradient(to right, #d0d7de, #d0d7de);
    background-position: calc(100% - 22px) 50%, calc(100% - 14px) 50%, calc(100% - 2.8em) 50%;
    background-size: 7px 7px, 7px 7px, 1px 40%;
    background-repeat: no-repeat;
    cursor: pointer;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
    overflow: auto;
    border-color: var(--color-border);
    padding-bottom: 14px;
    background-image: linear-gradient(-45deg,
            transparent 0 53%,
            var(--color-border-light) 53% 59%,
            transparent 59% 69%,
            var(--color-border) 69% 75%,
            transparent 75%);
    background-size: 14px 14px;
    background-repeat: no-repeat;
    background-position: right 6px bottom 6px;
}

/* === AI Improve Field === */
.ai-improve-field {
    position: relative;
}

.ai-improve-field__control--with-action {
    position: relative;
}

/* Scanning beam overlay — sits above the control, lets clicks through */
.ai-improve-field__overlay {
    position: absolute;
    inset: 1px;
    border-radius: 5px;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ai-improve-field.is-improving .ai-improve-field__overlay {
    opacity: 1;
}

/* Wide soft glow body */
.ai-improve-field__overlay::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 52px;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(139, 92, 246, 0.10) 30%,
        rgba(167, 139, 250, 0.22) 50%,
        rgba(139, 92, 246, 0.10) 70%,
        transparent 100%
    );
    animation: ai-improve-scan 1.7s ease-in-out infinite;
}

/* Thin bright scan line */
.ai-improve-field__overlay::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1.5px;
    background: linear-gradient(90deg, transparent 0%, rgba(192, 132, 252, 0.8) 20%, rgba(216, 180, 254, 1) 50%, rgba(192, 132, 252, 0.8) 80%, transparent 100%);
    box-shadow: 0 0 8px rgba(192, 132, 252, 0.55);
    animation: ai-improve-scan 1.7s ease-in-out infinite;
}

@keyframes ai-improve-scan {
    0% { top: -60px; }
    100% { top: calc(100% + 60px); }
}

/* Border glow during improvement */
.ai-improve-field.is-improving .ai-improve-field__control {
    border-color: rgba(139, 92, 246, 0.35);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.08);
    color: rgba(15, 23, 42, 0.55);
}

/* Button container — bottom-right of the field */
.ai-improve-field__actions {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    z-index: 2;
}

/* Pill button — hidden by default, revealed on hover/focus */
.ai-improve-field__action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 26px;
    padding: 0 10px 0 7px;
    border-radius: 999px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    background: rgba(255, 255, 255, 0.95);
    color: #6d28d9;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.015em;
    box-shadow: 0 1px 5px rgba(109, 40, 217, 0.1);
    cursor: pointer;
    opacity: 0;
    transform: translateY(3px);
    transition: opacity 0.18s ease, transform 0.18s ease, background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.ai-improve-field:hover .ai-improve-field__action:not(:disabled):not(.is-busy),
.ai-improve-field:focus-within .ai-improve-field__action:not(:disabled):not(.is-busy) {
    opacity: 1;
    transform: translateY(0);
}

.ai-improve-field__action:hover:not(:disabled):not(.is-busy) {
    background: rgba(237, 233, 254, 0.97);
    border-color: rgba(109, 40, 217, 0.4);
    box-shadow: 0 2px 10px rgba(109, 40, 217, 0.18);
}

/* Busy state: animated purple gradient */
.ai-improve-field__action.is-busy {
    opacity: 1 !important;
    transform: translateY(0) !important;
    border-color: transparent;
    background: linear-gradient(270deg, #6d28d9, #9333ea, #7c3aed, #a855f7, #6d28d9);
    background-size: 300% 100%;
    color: #fff;
    box-shadow: 0 2px 12px rgba(109, 40, 217, 0.3);
    cursor: default;
    animation: ai-improve-gradient-slide 2.4s linear infinite;
}

.ai-improve-field__action:disabled {
    cursor: default;
}

/* Sparkle pop on hover */
.ai-improve-field__action:hover:not(.is-busy) svg {
    animation: ai-improve-sparkle-pop 0.38s ease-out forwards;
}

/* Sparkle orbit while busy */
.ai-improve-field__action.is-busy svg {
    animation: ai-improve-sparkle-orbit 1.5s ease-in-out infinite;
}

@keyframes ai-improve-sparkle-orbit {
    0%,
    100% { transform: scale(1) rotate(0deg); }
    33% { transform: scale(1.25) rotate(14deg); }
    66% { transform: scale(1.25) rotate(-14deg); }
}

@keyframes ai-improve-sparkle-pop {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.35) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes ai-improve-gradient-slide {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

.ai-improve-field__error {
    margin-top: 6px;
    color: var(--color-danger);
    font-size: 0.85rem;
}

/* Custom Select & Multi-Pick */
.custom-select {
    position: relative;
    width: 100%;
}

.select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background-color: var(--color-surface-input);
    color: var(--color-text-primary);
    cursor: pointer;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.select-trigger.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.select-trigger:focus,
.select-trigger.open {
    outline: none;
    border-color: var(--color-primary-green);
    box-shadow: 0 0 0 3px rgba(13, 102, 107, 0.1);
}

.select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    margin-top: 4px;
    background: var(--color-surface-panel);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    z-index: 50;
    /* Expand to fit the longest option when space allows (prevents cut-off labels). */
    min-width: 100%;
    width: max-content;
    max-width: calc(100vw - 24px);
    max-height: 200px;
    overflow-y: auto;
    overflow-x: auto;
    display: none;
}

.select-dropdown.open {
    display: block;
}

.select-search {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--color-surface-panel);
    border-bottom: 1px solid var(--color-border);
    padding: 8px 12px;
}

.select-search-input {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 0.95rem;
    background: var(--color-surface-input);
    color: var(--color-text-primary);
}

.select-search-input:focus {
    outline: none;
    border-color: var(--color-primary-green);
    box-shadow: 0 0 0 3px rgba(13, 102, 107, 0.1);
}

.select-option {
    padding: 8px 12px;
    cursor: pointer;
    color: var(--color-text-primary);
    transition: background 0.1s;
}

.select-option:hover {
    background: var(--color-surface-alt);
}

.select-option.selected {
    background: var(--color-surface-active);
    color: var(--color-text-primary);
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--color-primary-green);
}

.select-empty,
.select-overflow-hint {
    padding: 8px 12px;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.select-overflow-hint {
    border-top: 1px dashed var(--color-border);
}

/* Input Wrapper (Search, Chip Inputs) */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface-input);
    padding: 4px 12px;
    transition: box-shadow 0.2s;
    gap: 8px;
}

.input-wrapper:focus-within {
    border-color: var(--color-primary-green);
    box-shadow: 0 0 0 3px rgba(13, 102, 107, 0.1);
}

.input-wrapper.multiline {
    align-items: flex-end;
}

.chip-input {
    border: none;
    outline: none;
    flex: 1;
    min-width: 120px;
    padding: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    background: transparent;
    color: var(--color-text-primary);
    box-shadow: none !important;
    /* override default input focus */
}

textarea.chip-input.chip-textarea {
    resize: none;
    overflow-y: hidden;
    min-height: 34px;
    max-height: 180px;
    padding: 6px 4px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

textarea.chip-input.chip-textarea.form-input,
textarea.chip-input.chip-textarea.form-textarea {
    width: 100%;
    flex: initial;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-input);
    resize: vertical;
    overflow-y: auto;
    min-height: 120px;
    max-height: none;
    padding: 8px 12px 14px;
    background-image: linear-gradient(-45deg,
            transparent 0 53%,
            var(--color-border-light) 53% 59%,
            transparent 59% 69%,
            var(--color-border) 69% 75%,
            transparent 75%);
    background-size: 14px 14px;
    background-repeat: no-repeat;
    background-position: right 6px bottom 6px;
}

textarea.chip-input.chip-textarea.form-input:focus,
textarea.chip-input.chip-textarea.form-textarea:focus {
    border-color: var(--color-primary-green);
    box-shadow: 0 0 0 3px rgba(13, 102, 107, 0.1) !important;
}

.search-wrapper {
    position: relative;
    max-width: 300px;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

/* Chips */
.chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 4px;
    margin-bottom: 2px;
}

.chip.tool,
.function-chip {
    background: var(--color-surface-active);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.function-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    gap: 4px;
}

.chip.kb {
    background: #fff4e0;
    color: #d68b00;
}

.chip.more {
    background: #eee;
    color: #666;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.published {
    background: #e6f4ea;
    color: #137333;
}

.status-badge.draft {
    background: #f1f3f4;
    color: #5f6368;
}

.status-badge.deprecated {
    background: #fce8e6;
    color: #c5221f;
}

.status-badge.sync-completed {
    background: #e6f4ea;
    color: #0c5c20;
}

.status-badge.sync-in_progress {
    background: #fff4e0;
    color: #b15e0f;
}

.status-badge.sync-failed {
    background: #fbe4e2;
    color: #c5221f;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
}

.status-dot.active {
    background: var(--color-primary-green);
    box-shadow: 0 0 0 4px rgba(13, 102, 107, 0.15);
}

/* Chat UI */
.chat-wrapper {
    display: flex;
    flex: 0 1 auto;
    width: var(--chat-width, 800px);
    max-width: 100%;
    min-width: 480px;
    height: 100%;
    margin: 0 auto;
    position: relative;
    transition: width 0.1s;
    gap: 8px;
    min-height: 0;
}

.chat-shell {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 100%;
    max-height: 100%;
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.chat-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-surface-alt);
    font-weight: 600;
}

.chat-body {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    min-height: 0;
    color: var(--color-text-primary);
}

.chat-footer {
    padding: 16px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

.attachment-preview,
.message-attachment {
    display: flex;
    gap: 12px;
    align-items: center;
}

.attachment-preview {
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-input);
    margin-bottom: 10px;
}

.message-attachment {
    align-items: flex-start;
    margin-bottom: 8px;
}

.attachment-thumb {
    width: 72px;
    height: 72px;
    border: 1px dashed var(--color-border-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    overflow: hidden;
    flex-shrink: 0;
}

.message-attachment .attachment-thumb {
    width: 140px;
    height: 96px;
}

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

.attachment-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.attachment-name {
    font-weight: 700;
    color: var(--color-text-primary);
}

.attachment-meta {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

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

.attachment-link {
    color: var(--color-primary-blue);
    font-weight: 600;
    text-decoration: none;
}

.attachment-link:hover {
    text-decoration: underline;
}

.message {
    max-width: 85%;
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.message.user {
    align-self: flex-end;
    background-color: var(--color-user-bubble-bg);
    color: var(--color-text-inverse);
    border-bottom-right-radius: 4px;
}

.message.user * {
    color: var(--color-text-inverse) !important;
}

.message.bot {
    align-self: flex-start;
    background-color: var(--color-bot-bubble-bg);
    color: var(--color-text-primary);
    border-bottom-left-radius: 4px;
}

.message.source-summary {
    max-width: min(760px, 92%);
    padding: 12px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.source-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.source-summary-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.source-summary-count {
    min-width: 24px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.74rem;
    font-weight: 700;
    background: color-mix(in srgb, var(--color-primary-blue) 11%, var(--color-surface) 89%);
    color: var(--color-text-secondary);
}

.source-summary-list {
    display: grid;
    gap: 8px;
}

.source-summary-item {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--color-border-light);
    border-radius: 8px;
    background: color-mix(in srgb, var(--color-surface) 92%, var(--color-primary-green) 8%);
}

.source-summary-rank {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.74rem;
    font-weight: 700;
    color: #0d5558;
    background: color-mix(in srgb, var(--color-primary-green) 16%, var(--color-surface) 84%);
}

.source-summary-body {
    min-width: 0;
}

.source-summary-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.source-summary-link {
    display: inline-block;
    min-width: 0;
    max-width: 100%;
    flex: 0 1 auto;
    color: var(--color-text-link);
    font-weight: 400;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.source-summary-link:hover {
    text-decoration: underline;
}

.source-summary-link-muted {
    color: var(--color-text-primary);
}

.source-summary-quality {
    flex: 0 0 auto;
    font-size: 0.78rem;
    color: var(--color-text-secondary);
}

.source-summary-extract-btn {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    min-width: 26px;
    color: var(--color-text-secondary);
}

.source-summary-extract-btn[aria-expanded="true"] {
    color: var(--color-text-link);
    background: color-mix(in srgb, var(--color-text-link) 10%, var(--color-surface) 90%);
}

.source-summary-meta {
    margin-top: 2px;
    font-size: 0.78rem;
    color: var(--color-text-secondary);
}

.source-summary-excerpt {
    margin: 6px 0 0;
    padding: 6px 8px;
    border-left: 3px solid color-mix(in srgb, var(--color-primary-green) 38%, var(--color-border) 62%);
    border-radius: 0 6px 6px 0;
    background: color-mix(in srgb, var(--color-surface) 86%, var(--color-primary-blue) 14%);
    color: var(--color-text-secondary);
    font-size: 0.82rem;
    line-height: 1.4;
}

.source-summary-actions {
    opacity: 0;
}

.message.support {
    align-self: flex-start;
    background: color-mix(in srgb, #6d28d9 9%, var(--color-surface) 91%);
    color: var(--color-text-primary);
    border: 1px solid rgba(109, 40, 217, 0.24);
    border-bottom-left-radius: 4px;
    box-shadow: 0 6px 18px rgba(109, 40, 217, 0.10);
}

.message.support .message-author {
    color: #6d28d9;
}

.message-author {
    margin-bottom: 6px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

.message.tool {
    align-self: center;
    background-color: #e7f2f5;
    color: #0d666b;
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid #b5dfe2;
    width: auto;
    max-width: 90%;
}

.message.tool-progress {
    align-self: center;
    max-width: min(720px, 92%);
    padding: 7px 11px;
    border-radius: 8px;
    box-shadow: none;
    font-size: 0.82rem;
    line-height: 1.35;
    overflow: visible;
    transform-origin: center center;
    transition:
        transform 0.14s cubic-bezier(0.2, 0, 0.2, 1),
        opacity 0.1s ease;
    will-change: transform, opacity;
}

.message.tool-progress-collapsing,
.message.tool-progress-expanding {
    overflow: hidden;
}

.message.tool-progress-collapsing {
    opacity: 0.72;
    transform: scaleX(0.06);
}

.message.tool-progress-expanding {
    opacity: 1;
    transform: scaleX(1);
}

.message.tool-progress .tool-progress-content {
    transition: opacity 0.08s ease;
}

.message.tool-progress .tool-progress-content p {
    margin: 0;
}

.message.tool-progress-collapsing .tool-progress-content {
    opacity: 0;
}

.message.tool-progress-expanding .tool-progress-content {
    animation: tool-progress-content-in 0.14s ease-out both;
}

@keyframes tool-progress-content-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.message.tool-progress-transient {
    background: color-mix(in srgb, var(--color-surface) 90%, var(--color-primary-blue) 10%);
    border-color: color-mix(in srgb, var(--color-border) 72%, var(--color-primary-blue) 28%);
    color: var(--color-text-secondary);
}

.message.tool-progress-milestone {
    background: color-mix(in srgb, var(--color-surface) 88%, var(--color-primary-green) 12%);
    border-color: color-mix(in srgb, var(--color-border) 68%, var(--color-primary-green) 32%);
    color: #0d5558;
}

.message.tool-progress-decision {
    background: color-mix(in srgb, var(--color-surface) 88%, #c97a00 12%);
    border-color: color-mix(in srgb, var(--color-border) 62%, #c97a00 38%);
    color: #704a00;
}

.message.tool-progress-diagnostic {
    background: #f4f7fa;
    border-color: #d6dde6;
    color: #274055;
    font-family: Consolas, "Courier New", monospace;
}

@media (prefers-reduced-motion: reduce) {
    .message.tool-progress,
    .message.tool-progress .tool-progress-content {
        animation: none;
        opacity: 1;
        transform: none;
        transition: none;
    }
}

.message-feedback-badge {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-surface-pilled);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.message-feedback-badge svg {
    width: 16px;
    height: 16px;
}

.message-feedback-badge.thumbs_up {
    color: var(--color-primary-green);
}

.message-feedback-badge.thumbs_down {
    color: var(--color-primary-red);
}

.message-actions {
    position: absolute;
    bottom: -16px;
    right: 0;
    background: var(--color-surface-pilled);
    border-radius: 20px;
    padding: 2px;
    box-shadow: var(--shadow-sm);
    display: flex;
    opacity: 0;
    transition: opacity 0.2s;
    border: 1px solid var(--color-border);
}

.message-actions .icon-btn.active.thumbs-up {
    color: var(--color-primary-green);
}

.message-actions .icon-btn.active.thumbs-down {
    color: var(--color-primary-red);
}

.message:hover .message-actions {
    opacity: 1;
}

.typing-indicator span {
    display: inline-block;
    width: 5px;
    height: 5px;
    background: #aaa;
    border-radius: 50%;
    margin: 0 2px;
    animation: bounce 1s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

/* Chat Overlays */
.chat-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    color: var(--color-text-primary);
}

:root[data-theme="dark"] .chat-overlay {
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
}

.chat-overlay.unauth {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.75), rgba(255, 243, 236, 0.9));
    backdrop-filter: blur(8px) saturate(115%);
    border: 1px solid rgba(217, 48, 37, 0.12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

:root[data-theme="dark"] .chat-overlay.unauth {
    background: linear-gradient(135deg, rgba(40, 40, 40, 0.9), rgba(28, 28, 28, 0.92));
    border: 1px solid rgba(110, 204, 223, 0.22);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.chat-overlay .chat-overlay-card {
    background: var(--color-surface);
    border-radius: 18px;
    padding: 16px 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 260px;
    max-width: 340px;
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
}

:root[data-theme="dark"] .chat-overlay .chat-overlay-card {
    background: var(--color-surface-panel);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.chat-overlay .chat-overlay-headline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-overlay .chat-overlay-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(217, 48, 37, 0.1);
    color: var(--color-primary-red);
}

:root[data-theme="dark"] .chat-overlay .chat-overlay-icon {
    background: rgba(245, 67, 47, 0.16);
}

.chat-overlay .chat-overlay-title {
    font-weight: 700;
    color: var(--color-text-primary);
}

.chat-overlay .chat-overlay-subtitle {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
}

.chat-overlay .chat-overlay-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.chat-overlay .chat-overlay-actions .btn-secondary {
    padding: 6px 12px;
}

.chat-blur-target {
    filter: blur(3px);
    pointer-events: none;
    user-select: none;
}

.drag-overlay {
    position: absolute;
    inset: 0;
    background: rgba(13, 102, 107, 0.1);
    border: 2px dashed var(--color-primary-green);
    border-radius: var(--radius-lg);
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary-green);
}

.drag-overlay.active {
    opacity: 1;
    background: radial-gradient(circle at 50% 30%, rgba(13, 102, 107, 0.15), rgba(13, 102, 107, 0.05));
    box-shadow: 0 12px 32px rgba(13, 102, 107, 0.12);
}

.drag-overlay .drag-overlay-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 18px;
    padding: 14px 18px;
    box-shadow: var(--shadow-lg);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(13, 102, 107, 0.15);
}

.drag-overlay .drag-overlay-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 102, 107, 0.1);
    color: var(--color-primary-green);
}

.drag-overlay .drag-overlay-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}

.drag-overlay .drag-overlay-text .title {
    font-weight: 700;
    color: var(--color-text-primary);
}

.drag-overlay .drag-overlay-text .subtitle {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

/* Slash Menu */
.slash-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-light);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-height: 240px;
    overflow-y: auto;
    margin-bottom: 8px;
    z-index: 20;
}

.slash-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border-light);
}

.slash-item:last-child {
    border-bottom: none;
}

.slash-item .small {
    color: var(--color-text-secondary);
}

.slash-item.active {
    background: var(--color-surface-active);
}

.slash-item:hover {
    background: color-mix(in srgb, var(--color-surface-active) 70%, var(--color-surface) 30%);
}

/* Side Panel (Chat Context) */
.side-panel {
    background: var(--color-surface);
    /* Width is handled inline by JS for resizing */
    border-left: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    z-index: 20;
    height: calc(100% - 32px);
    /* Vertical float */
    color: var(--color-text-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    margin: 16px;
    /* Fully floating */
    transition: opacity 0.2s;
    position: relative;
    min-width: 300px;
    max-width: 800px;
}

.side-panel.inactive {
    border-color: var(--color-border-light);
    box-shadow: inset 0 0 0 1px var(--color-border-light);
    background: var(--color-surface-alt);
}

/* Disabled state applies to the body content wrapper, not the whole panel */
.sp-content-wrapper.disabled {
    pointer-events: none;
    opacity: 0.6;
    filter: grayscale(1);
}

.sp-content-wrapper.inactive {
    pointer-events: none;
    opacity: 0.8;
    filter: grayscale(0.2);
}

.side-panel.inactive .sp-header h3 {
    color: var(--color-text-secondary);
}

.side-panel.inactive .sp-field input,
.side-panel.inactive .sp-field select,
.side-panel.inactive .sp-field textarea {
    pointer-events: none;
    background: var(--color-surface);
    border-color: var(--color-border-light);
    color: var(--color-text-secondary);
}

.side-panel.inactive .sp-actions,
.side-panel.inactive .sp-body .btn-primary,
.side-panel.inactive .sp-body .btn-secondary {
    display: none !important;
}

.sp-record-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 12px;
}

.sp-record-link,
.sp-record-link:link,
.sp-record-link:visited,
.markdown-content .sp-record-link,
.markdown-content .sp-record-link:visited {
    color: var(--color-text-link) !important;
    text-decoration: none;
}

.sp-record-link:hover {
    text-decoration: underline;
}

.deep-dive-table td {
    vertical-align: top;
}

.sp-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    word-break: break-word;
}

.sp-truncate.sp-value {
    color: var(--color-text-body);
}

.panel-rail {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 8px;
    border-left: 1px solid transparent;
    /* Placeholder for alignment */
    height: 100%;
}

.panel-rail.disabled {
    pointer-events: none;
    opacity: 0.6;
    filter: grayscale(1);
}

.panel-chip {
    min-width: 44px;
    max-width: 132px;
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid var(--color-primary-red);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-primary-red);
    text-align: center;
    line-height: 1.15;
    padding: 8px 10px;
    white-space: normal;
    word-break: break-word;
    transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
}

.panel-chip:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--color-bg-cream);
}

:root[data-theme="dark"] .panel-chip {
    background: var(--color-surface-panel);
    border-color: var(--color-primary-red);
    color: var(--color-primary-red);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.panel-chip.disabled {
    border-color: var(--color-border);
    color: var(--color-text-secondary);
    background: var(--color-surface-alt);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

:root[data-theme="dark"] .panel-chip.disabled {
    background: var(--color-surface);
}


.sp-header {
    min-height: 64px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
    gap: 16px;
}

.sp-body {
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sp-grid {
    display: grid;
    gap: 12px;
}

.sp-grid.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 720px) {
    .sp-grid.two-col {
        grid-template-columns: 1fr;
    }
}

.sp-field label {
    font-size: 0.8rem;
    color: var(--color-text-body);
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.sp-field input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
}

/* Tables */
.table-container {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    /* Enable vertical scrolling for CRUD/admin tables inside fixed-height shells */
    overflow: auto;
    background: var(--color-surface);
    flex: 1 1 auto;
    min-height: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    color: var(--color-text-primary);
}

th {
    text-align: left;
    padding: 12px 16px;
    background: var(--color-surface-alt);
    color: var(--color-text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

th.sortable-th {
    cursor: pointer;
    user-select: none;
}

th.sortable-th:hover {
    background: var(--color-surface-active);
}

th.sortable-th:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(13, 102, 107, 0.25);
}

.th-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.th-indicator {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    transform: translateY(-1px);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: var(--color-surface-active);
    cursor: pointer;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    background: var(--color-surface);
    padding: 24px;
    border-radius: 16px;
    width: 400px;
    max-width: 90%;
    box-shadow: var(--shadow-lg);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

:root[data-theme="dark"] .modal {
    background: var(--color-surface-panel);
}

.floating-table-overlay {
    position: fixed;
    inset: 0;
    z-index: 260;
    background: rgba(0, 0, 0, 0.42);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.floating-table-dialog {
    position: relative;
    width: min(1100px, calc(100vw - 48px));
    max-height: calc(100vh - 56px);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.floating-table-resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 14px;
    cursor: ew-resize;
    z-index: 2;
    touch-action: none;
}

.floating-table-resize-handle--left {
    left: -7px;
}

.floating-table-resize-handle--right {
    right: -7px;
}

.floating-table-dialog__header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.floating-table-dialog__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.floating-table-dialog__body {
    padding: 16px;
    overflow: auto;
    min-height: 180px;
}

.pushai-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.pushai-tooltip__trigger {
    display: inline-flex;
    align-items: center;
    outline: none;
}

.pushai-tooltip__bubble {
    position: absolute;
    z-index: 420;
    width: max-content;
    max-width: min(320px, calc(100vw - 32px));
    padding: 8px 10px;
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
    background: var(--color-surface-elevated);
    box-shadow: var(--shadow-lg);
    color: var(--color-text-primary);
    font-size: 0.78rem;
    line-height: 1.35;
    white-space: normal;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.12s ease, transform 0.12s ease;
}

.pushai-tooltip:hover .pushai-tooltip__bubble,
.pushai-tooltip:focus-within .pushai-tooltip__bubble {
    opacity: 1;
    transform: translateY(0);
}

.pushai-tooltip--top .pushai-tooltip__bubble {
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translate(-50%, 4px);
}

.pushai-tooltip--top:hover .pushai-tooltip__bubble,
.pushai-tooltip--top:focus-within .pushai-tooltip__bubble {
    transform: translate(-50%, 0);
}

.pushai-tooltip--right .pushai-tooltip__bubble {
    left: calc(100% + 8px);
    top: 50%;
    transform: translate(0, -50%);
}

.pushai-tooltip--bottom .pushai-tooltip__bubble {
    top: calc(100% + 8px);
    left: 50%;
    transform: translate(-50%, -4px);
}

.pushai-tooltip--bottom:hover .pushai-tooltip__bubble,
.pushai-tooltip--bottom:focus-within .pushai-tooltip__bubble {
    transform: translate(-50%, 0);
}

.pushai-tooltip--left .pushai-tooltip__bubble {
    right: calc(100% + 8px);
    top: 50%;
    transform: translate(0, -50%);
}

@media (max-width: 720px) {
    .floating-table-overlay {
        padding: 12px;
    }

    .floating-table-dialog {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 24px);
    }

    .floating-table-dialog__body {
        padding: 12px;
    }
}

/* Typography Utilities */
.text-h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text-link);
    margin-bottom: 1rem;
}

.text-h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text-link);
    margin-bottom: 0.75rem;
}

.text-body {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text-primary);
}

.text-meta {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.text-link,
a {
    color: var(--color-text-link);
    text-decoration: none;
    font-weight: inherit;
    cursor: pointer;
}

.text-link:hover,
a:hover {
    text-decoration: underline;
}

.text-link:visited,
a:visited {
    color: var(--color-text-link);
}

.link-button {
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    color: var(--color-text-link);
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}

.link-button:hover {
    color: var(--color-primary-red);
}

/* Tabs */
.tabs {
    --tabs-accent: color-mix(in srgb, var(--color-primary-blue) 55%, var(--color-primary-green) 45%);

    display: flex;
    align-items: stretch;
    gap: 2px;
    width: 100%;
    max-width: 100%;
    padding: 4px;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--color-surface) 78%, transparent 22%), transparent),
        color-mix(in srgb, var(--color-surface-alt) 78%, var(--color-surface) 22%);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-surface) 80%, transparent 20%);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    appearance: none;
    background: transparent;
    cursor: pointer;
    color: color-mix(in srgb, var(--color-text-secondary) 86%, var(--color-text-primary) 14%);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
    user-select: none;
    transition:
        background 0.16s ease,
        border-color 0.16s ease,
        box-shadow 0.16s ease,
        color 0.16s ease,
        transform 0.16s ease;
}

.tab .atlas-inline-icon,
.tab .tab__icon,
.tab svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.tab .atlas-inline-icon svg,
.tab .tab__icon svg {
    width: 16px;
    height: 16px;
}

.tab:hover:not(:disabled):not([aria-disabled="true"]) {
    background: color-mix(in srgb, var(--color-surface) 72%, var(--color-surface-active) 28%);
    color: var(--color-text-primary);
}

.tab:focus-visible {
    outline: none;
    border-color: color-mix(in srgb, var(--tabs-accent) 42%, var(--color-border) 58%);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tabs-accent) 16%, transparent 84%);
}

.tab.active,
.tab.is-active,
.tab[aria-selected="true"] {
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--color-surface-active) 76%, var(--color-surface) 24%), var(--color-surface-active));
    border-color: color-mix(in srgb, var(--tabs-accent) 24%, var(--color-border) 76%);
    color: var(--color-text-primary);
    box-shadow:
        0 1px 2px rgba(17, 42, 52, 0.08),
        inset 0 1px 0 color-mix(in srgb, var(--color-surface) 78%, transparent 22%);
}

.tab.active::after,
.tab.is-active::after,
.tab[aria-selected="true"]::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: -1px;
    height: 3px;
    border-radius: 999px 999px 0 0;
    background: var(--tabs-accent);
}

.tab:disabled,
.tab[aria-disabled="true"] {
    cursor: not-allowed;
    color: var(--color-text-secondary);
    opacity: 0.48;
}

@media (max-width: 640px) {
    .tabs {
        border-radius: 12px;
    }

    .tab {
        min-height: 38px;
        padding: 9px 14px;
        font-size: 0.84rem;
    }
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-body);
    text-align: center;
    padding: 40px;
}

/* Markdown Styles */
.markdown-content p {
    margin-bottom: 0.5em;
}

.markdown-content p:last-child {
    margin-bottom: 0;
}

.markdown-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
}

.markdown-content pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.markdown-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.markdown-content ul,
.markdown-content ol {
    padding-left: 20px;
    margin: 8px 0;
}

.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
    font-size: 0.9em;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid #ddd;
    padding: 6px 10px;
    text-align: left;
}

.markdown-content th {
    background: rgba(0, 0, 0, 0.05);
}

/* Conversation List Item (Left Panel) */
.conv-item {
    padding: 12px;
    border-bottom: 1px solid var(--color-border-light);
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    color: var(--color-text-primary);
}

.conv-item:hover {
    background: var(--color-surface-alt);
}

.conv-item.active {
    background: var(--color-surface-active);
    border-left: 3px solid var(--color-primary-green);
    color: var(--color-text-primary);
}

.conv-date {
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-title {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-left-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 3px solid var(--color-border-light);
    border-top-color: var(--color-primary-blue);
    animation: spin 0.9s linear infinite;
}

.loading-spinner.sm {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

.loading-spinner.lg {
    width: 44px;
    height: 44px;
    border-width: 4px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.loading-spinner-wrap {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text-secondary);
}

.loading-spinner-wrap .loading-label {
    font-weight: 600;
    color: var(--color-text-primary);
}

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

/* Utilities */
.small {
    font-size: 0.85rem;
    color: #666;
}

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

/* Top Nav - Dropdown (Reusable) */
.nav-group {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.nav-dropdown > summary:hover {
    background: var(--color-surface-alt);
}

.nav-summary-content {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-dropdown > summary::-webkit-details-marker {
    display: none;
}

.nav-dropdown[open] > summary {
    box-shadow: 0 0 0 3px rgba(13, 102, 107, 0.1);
    border-color: rgba(13, 102, 107, 0.35);
}

.nav-dropdown .nav-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: auto;
    min-width: 220px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    overflow: visible;
    padding: 6px;
    z-index: 60;
}

.nav-menu-cascade {
    position: relative;
}

.nav-menu .nav-menu-item {
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    color: var(--color-text-primary);
    cursor: pointer;
    border-radius: 10px;
    padding: 10px 10px;
    font-weight: 600;
}

.nav-menu-item__content,
.nav-menu-item__with-chevron {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-menu-item__with-chevron {
    width: 100%;
    justify-content: space-between;
}

.nav-menu-item__chevron {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.nav-menu .nav-menu-item.nav-menu-item--danger {
    color: var(--color-primary-red);
}

.nav-menu .nav-menu-item.nav-menu-item--active {
    background: var(--color-surface-alt);
}

.nav-menu .nav-menu-item.nav-menu-item--highlight {
    background: var(--color-primary-red);
    color: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.nav-menu .nav-menu-item.nav-menu-item--muted {
    color: var(--color-text-secondary);
}

.nav-menu .nav-menu-item.nav-menu-item--highlight:hover {
    background: var(--color-primary-light, #e04130);
    color: #fff;
}

.nav-menu .nav-menu-item.nav-menu-item--disabled,
.nav-menu .nav-menu-item:disabled {
    color: var(--color-text-secondary);
    cursor: not-allowed;
    opacity: 0.55;
    filter: grayscale(0.6);
}

.nav-menu .nav-menu-item.nav-menu-item--disabled:hover,
.nav-menu .nav-menu-item:disabled:hover {
    background: transparent;
}

.nav-menu .nav-menu-item:hover {
    background: var(--color-surface-alt);
}

.nav-menu .nav-menu-cascade:hover > .nav-menu-item,
.nav-menu .nav-menu-cascade:focus-within > .nav-menu-item,
.nav-menu .nav-menu-cascade--open > .nav-menu-item {
    background: var(--color-surface-alt);
}

.nav-submenu {
    position: absolute;
    top: 0;
    right: calc(100% + 8px);
    min-width: 242px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    padding: 6px;
    z-index: 70;
}

.nav-menu-cascade:hover > .nav-submenu,
.nav-menu-cascade:focus-within > .nav-submenu,
.nav-menu-cascade--open > .nav-submenu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.nav-menu .nav-menu-divider {
    height: 1px;
    background: var(--color-border);
    margin: 6px 2px;
}

.nav-menu-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 10px;
    border-radius: 10px;
    color: var(--color-text-primary);
    font-size: 0.9rem;
    line-height: 1.2;
}

.nav-menu-row__label {
    font-weight: 600;
}

.nav-menu-row--theme .toggle-switch {
    flex-shrink: 0;
}

.nav-menu-row--release {
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
    text-align: left;
    color: var(--color-text-secondary);
}

.nav-menu-row--release:hover,
.nav-menu-row--release:focus-visible {
    background: var(--color-surface-alt);
    color: var(--color-text-primary);
    outline: none;
}

.nav-menu-row__value {
    color: var(--color-text-placeholder);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.release-history-overlay {
    z-index: 320;
    padding: 20px;
}

.release-history-modal {
    width: min(760px, calc(100vw - 40px));
    max-width: min(760px, calc(100vw - 40px));
    max-height: calc(100vh - 40px);
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
}

.release-history-modal__header,
.release-history-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--color-border);
}

.release-history-modal__header h2 {
    margin: 0 0 4px;
    color: var(--color-text-primary);
    font-size: 1.05rem;
}

.release-history-current {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 0.82rem;
}

.release-history-modal__body {
    overflow: auto;
    padding: 16px 18px;
}

.release-history-modal__footer {
    justify-content: flex-end;
    border-top: 1px solid var(--color-border);
    border-bottom: 0;
}

.release-history-table-wrap {
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: auto;
    background: var(--color-surface);
}

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

.release-history-table th,
.release-history-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    vertical-align: top;
    font-size: 0.86rem;
}

.release-history-table th {
    background: var(--color-surface-alt);
    color: var(--color-text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.release-history-table tr:hover td {
    background: transparent;
    cursor: default;
}

.release-history-highlights {
    margin: 0;
    padding-left: 18px;
    color: var(--color-text-primary);
}

.release-history-highlights li + li {
    margin-top: 4px;
}

.release-history-empty,
.release-history-unavailable {
    color: var(--color-text-secondary);
}

@media (max-width: 640px) {
    .nav-submenu {
        top: calc(100% + 6px);
        right: 0;
    }

    .release-history-modal__header,
    .release-history-modal__body,
    .release-history-modal__footer {
        padding-left: 14px;
        padding-right: 14px;
    }
}

/*
========================================
   Forecast Target Coverage
========================================
*/

.forecast-widget {
    --forecast-won: #0d666b;
    --forecast-commit: #147a92;
    --forecast-stretch: #fbae0f;
    --forecast-best-case: #6d5bd0;
    --forecast-over: color-mix(in srgb, var(--color-primary-green) 12%, var(--color-surface) 88%);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    color: var(--color-text-primary);
    overflow: hidden;
}

.forecast-widget__header,
.forecast-widget__controls,
.forecast-widget__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.forecast-widget__header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--color-border);
}

.forecast-widget__title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.forecast-widget__title h3 {
    margin: 0;
    color: var(--color-text-primary);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
}

.forecast-widget__subtitle,
.forecast-widget__meta,
.forecast-control__label,
.forecast-chart__label,
.forecast-summary-item__label {
    color: var(--color-text-secondary);
    font-size: 0.78rem;
    line-height: 1.35;
}

.forecast-widget__meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.forecast-widget__body {
    padding: 18px 20px 20px;
    display: grid;
    gap: 18px;
}

.forecast-widget__controls {
    align-items: flex-end;
    flex-wrap: wrap;
}

.forecast-refresh-button--spinning svg {
    animation: spin 0.8s linear infinite;
}

.forecast-control {
    display: grid;
    gap: 6px;
}

.forecast-control--filters {
    flex: 1 1 360px;
    min-width: 260px;
}

.forecast-control--target {
    flex: 0 1 220px;
    min-width: 180px;
}

.forecast-control__label,
.forecast-chart__label,
.forecast-summary-item__label {
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.forecast-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.forecast-filter-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.forecast-filter-selects {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
}

.forecast-filter-select {
    display: grid;
    gap: 5px;
    min-width: 180px;
}

.forecast-filter-select span {
    color: var(--color-text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
}

.forecast-modal-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.forecast-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid color-mix(in srgb, var(--color-primary-green) 20%, var(--color-border) 80%);
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--color-primary-green) 9%, var(--color-surface) 91%);
    color: var(--color-primary-green);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
}

.forecast-filter-chip:not(.forecast-filter-chip--active) {
    border-color: var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-body);
}

.forecast-filter-chip--active {
    border-color: color-mix(in srgb, var(--color-primary-green) 35%, var(--color-border) 65%);
    background: color-mix(in srgb, var(--color-primary-green) 12%, var(--color-surface) 88%);
    color: var(--color-primary-green);
}

.forecast-control__empty {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.forecast-control--target input {
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text-primary);
    font: inherit;
    font-weight: 700;
}

.forecast-filter-chip svg {
    width: 14px;
    height: 14px;
}

.forecast-filter-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}

.forecast-filter-add:hover,
.forecast-filter-add:focus-visible {
    border-color: var(--color-primary-green);
    color: var(--color-primary-green);
    outline: none;
}

.forecast-target-input {
    position: relative;
}

.forecast-target-input input {
    height: 38px;
    padding-left: 26px;
    padding-right: 38px;
    font-weight: 700;
}

.forecast-target-input__prefix,
.forecast-target-input__action {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
}

.forecast-target-input__prefix {
    left: 11px;
    font-weight: 700;
}

.forecast-target-input__action {
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    cursor: pointer;
}

.forecast-target-input__action:hover {
    background: color-mix(in srgb, var(--color-surface-active) 82%, transparent 18%);
    color: var(--color-text-primary);
}

.forecast-chart {
    display: grid;
    gap: 10px;
}

.forecast-chart__topline {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}

.forecast-chart__total {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
}

.forecast-chart__amount {
    color: var(--color-text-primary);
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1;
}

.forecast-chart__target {
    color: var(--color-text-secondary);
    font-size: 1.05rem;
    font-weight: 700;
}

.forecast-chart__coverage {
    color: var(--color-primary-green);
    font-size: 0.88rem;
    font-weight: 700;
}

.forecast-bar {
    position: relative;
    display: flex;
    min-height: 104px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--color-surface-alt);
}

.forecast-segment {
    --segment-color: var(--color-primary-green);
    position: relative;
    display: flex;
    min-width: 72px;
    min-height: 104px;
    flex: var(--segment-weight, 1) 1 0;
    align-items: flex-end;
    border: none;
    border-right: 1px solid color-mix(in srgb, white 28%, transparent 72%);
    background: var(--segment-color);
    color: #fff;
    cursor: pointer;
    text-align: left;
    transition: filter 0.15s ease, transform 0.15s ease;
}

.forecast-segment:last-child {
    border-right: none;
}

.forecast-segment:hover,
.forecast-segment:focus-visible {
    filter: brightness(1.06);
    outline: none;
}

.forecast-segment__body {
    display: grid;
    gap: 4px;
    padding: 14px 14px 13px;
    min-width: 0;
}

.forecast-segment__value {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.1;
}

.forecast-segment__label,
.forecast-segment__percent {
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
}

.forecast-segment__percent {
    opacity: 0.82;
}

.forecast-segment--over {
    border-left: 1px dashed color-mix(in srgb, var(--color-primary-green) 42%, var(--color-border) 58%);
    background: var(--forecast-over);
    color: var(--color-primary-green);
}

.forecast-segment--target-gap {
    min-width: 24px;
    cursor: default;
    background:
        repeating-linear-gradient(
            90deg,
            color-mix(in srgb, #F5432F 8%, var(--color-surface-alt) 92%) 0,
            color-mix(in srgb, #F5432F 8%, var(--color-surface-alt) 92%) 12px,
            color-mix(in srgb, #F5432F 14%, var(--color-surface-alt) 86%) 12px,
            color-mix(in srgb, #F5432F 14%, var(--color-surface-alt) 86%) 24px
        );
}

.forecast-segment--target-gap:hover,
.forecast-segment--target-gap:focus-visible {
    filter: none;
}

.forecast-segment--non-counting {
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.45);
}

.forecast-target-marker {
    position: absolute;
    left: var(--target-position, 68%);
    top: 0;
    bottom: 0;
    width: 4px;
    background: #F5432F;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-surface) 88%, transparent 12%);
    pointer-events: none;
    transform: translateX(-50%);
    z-index: 3;
}

.forecast-target-marker::before {
    content: attr(data-label);
    position: absolute;
    left: 50%;
    top: 8px;
    transform: translateX(-50%);
    padding: 3px 7px;
    border: 1px solid #F5432F;
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: #F5432F;
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

.forecast-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
}

.forecast-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--color-text-secondary);
    font-size: 0.82rem;
}

.forecast-legend__dot {
    width: 9px;
    height: 9px;
    border-radius: var(--radius-full);
    background: var(--legend-color, var(--color-primary-green));
}

.forecast-widget__summary {
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--color-surface-alt) 72%, var(--color-surface) 28%);
    flex-wrap: wrap;
}

.forecast-summary-item {
    display: grid;
    gap: 2px;
    min-width: 118px;
}

.forecast-summary-item__value {
    color: var(--color-text-primary);
    font-size: 1rem;
    font-weight: 700;
}

@media (max-width: 860px) {
    .forecast-widget__header,
    .forecast-widget__controls,
    .forecast-widget__summary,
    .forecast-chart__topline {
        align-items: flex-start;
        flex-direction: column;
    }

    .forecast-widget__meta {
        white-space: normal;
    }

    .forecast-control--filters,
    .forecast-control--target {
        width: 100%;
        min-width: 0;
    }

    .forecast-bar {
        min-height: 88px;
        overflow-x: auto;
    }

    .forecast-segment {
        min-width: 112px;
        min-height: 88px;
    }

    .forecast-chart__amount {
        font-size: 1.55rem;
    }
}

.forecast-admin-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

.forecast-admin-settings {
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(180px, 1fr) auto auto;
    gap: 12px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-alt);
}

.forecast-admin-toggle,
.forecast-admin-checks label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-body);
    font-weight: 600;
}

.forecast-admin-help {
    display: block;
    margin-top: 6px;
    color: var(--color-text-secondary);
    font-size: 0.78rem;
    line-height: 1.35;
}

.forecast-admin-modal {
    width: min(720px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow: auto;
    border-radius: var(--radius-sm);
}

.forecast-admin-modal__header,
.forecast-admin-modal__actions,
.forecast-admin-checks {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.forecast-admin-modal__header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.forecast-admin-modal__actions {
    justify-content: flex-end;
    margin-top: 16px;
}

.forecast-admin-color-field {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
}

.forecast-admin-color-field input[type="color"] {
    width: 44px;
    height: 38px;
    padding: 2px;
}

.forecast-admin-swatch {
    width: 22px;
    height: 22px;
    display: inline-block;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
}

.forecast-admin-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

@media (max-width: 860px) {
    .forecast-admin-settings {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}

.admin-page-shell {
    min-height: 100vh;
    background: var(--color-page-bg);
}

.admin-layout-shell {
    display: flex;
    align-items: stretch;
    height: calc(100vh - var(--pushai-nav-height, 48px));
    min-height: 0;
    width: 100%;
    overflow: hidden;
}

.admin-content-card {
    flex: 1 1 auto;
    min-width: 0;
    margin: 24px;
    overflow: auto;
}

@media (max-width: 720px) {
    .admin-layout-shell {
        gap: 0;
    }

    .admin-console.admin-console--docked {
        width: 196px;
        flex-basis: 196px;
    }

    .admin-content-card {
        margin: 12px;
    }
}

/* Admin Console */
.admin-console-scrim {
    position: fixed;
    top: var(--pushai-nav-height, 48px);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 12, 20, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 120;
}

.admin-console-scrim.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.admin-console {
    position: fixed;
    top: var(--pushai-nav-height, 48px);
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 80vw;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.2s ease;
    z-index: 130;
    display: flex;
    flex-direction: column;
}

.admin-console.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.admin-console__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    font-weight: 700;
}

.admin-console__title {
    font-size: 1rem;
    color: var(--color-text-primary);
}

.admin-console__toggle {
    margin-left: auto;
    flex-shrink: 0;
}

.admin-console__body {
    padding: 10px 0 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-console__section {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-console__section + .admin-console__section {
    border-top: 1px solid var(--color-border);
    padding-top: 10px;
}

.admin-console__section-title {
    display: inline-flex;
    align-self: flex-start;
    margin: 0 14px 4px;
    padding: 5px 10px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface-alt);
    color: var(--color-text-secondary);
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.1;
    text-transform: uppercase;
    cursor: default;
    user-select: none;
    pointer-events: none;
}

.admin-console__item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    border: none;
    background: transparent;
    color: var(--color-text-primary);
    cursor: pointer;
    padding: 9px 20px;
    font-weight: 600;
    transition: background 0.1s;
}

.admin-console__item:hover {
    background: var(--color-surface-alt);
}

.admin-console__item-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    opacity: 0.55;
    transition: opacity 0.1s, color 0.1s;
}

.admin-console__item-icon svg {
    width: 15px;
    height: 15px;
}

.admin-console__item:hover .admin-console__item-icon,
.admin-console__item--active .admin-console__item-icon {
    opacity: 1;
    color: var(--color-primary-red);
}

.admin-console.admin-console--docked {
    position: relative;
    top: 0;
    left: 0;
    bottom: auto;
    height: 100%;
    width: 240px;
    max-width: none;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    box-shadow: none;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    flex: 0 0 240px;
    overflow: hidden;
}

.admin-console--docked .admin-console__body {
    flex: 1;
    min-height: 0;
}

.admin-console.admin-console--docked.admin-console--collapsed {
    width: 50px;
    min-width: 50px;
    flex-basis: 50px;
}

.admin-console--docked.admin-console--collapsed .admin-console__header {
    justify-content: center;
    padding: 12px 7px;
}

.admin-console__item--active {
    background: var(--color-surface-alt);
    box-shadow: inset 3px 0 0 var(--color-primary-red);
}

/* 
========================================
   Mobile Components (Drawer & Sheet)
========================================
*/

/* Drawer (Side Menu) */
.drawer-scrim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    backdrop-filter: blur(2px);
}

.drawer-scrim.open {
    opacity: 1;
    visibility: visible;
}

.drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 280px;
    max-width: 80%;
    background: var(--color-surface);
    z-index: 950;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--color-border);
}

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

.drawer-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-surface);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Bottom Sheet */
.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.sheet-overlay.open {
    opacity: 1;
    visibility: visible;
}

.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-surface);
    z-index: 950;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.sheet.open {
    transform: translateY(0);
}

:root[data-theme='dark'] .sheet {
    border-top: 1px solid var(--color-border);
}

.sheet-handle-bar {
    width: 100%;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--color-border);
    border-radius: 4px;
}

.sheet-header {
    padding: 0 20px 12px 20px;
    font-weight: 700;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--color-border-light);
}

.sheet-body {
    padding: 16px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.sheet-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid var(--color-border-light);
}

.sheet-item:last-child {
    border-bottom: none;
}

.sheet-item:active {
    background: var(--color-surface-active);
}

.sheet-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--color-surface-input);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
}

.sheet-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sheet-item-title {
    font-weight: 600;
    color: var(--color-text-primary);
}

.sheet-item-subtitle {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

