/* Max app shell — built on Agentrix tokens */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-container {
    width: min(1280px, calc(100% - 2rem));
    margin-inline: auto;
}

.app-topbar {
    background: var(--header-bg);
    color: var(--header-fg);
    border-bottom: 1px solid var(--header-border);
    box-shadow: var(--header-shadow);
    position: sticky;
    top: 0;
    z-index: 40;
}

.app-topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 4rem;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--header-fg);
}

.app-brand__mark {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-md);
    background: var(--header-logo-mark-bg);
    color: var(--header-logo-mark-fg);
    display: grid;
    place-items: center;
    font-weight: 800;
}

.app-brand__copy {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.app-brand__copy strong {
    font-size: 0.95rem;
}

.app-brand__copy small {
    color: var(--header-tagline-fg);
    font-size: 0.75rem;
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.app-nav__link,
.app-nav__utility {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.8rem;
    border-radius: var(--radius-pill);
    color: var(--header-fg-muted);
    background: transparent;
    border: 0;
    cursor: pointer;
}

.app-nav__link:hover,
.app-nav__utility:hover,
.app-nav__link.is-active {
    color: var(--header-fg-hover);
    background: var(--header-control-hover-bg);
}

.app-nav__link.is-active {
    color: var(--header-nav-active);
}

.app-nav-toggle {
    display: none;
    background: var(--header-control-bg);
    border: 1px solid var(--header-control-border);
    color: var(--header-control-fg);
    border-radius: var(--radius-md);
    padding: 0.45rem;
}

.app-main {
    padding: 1.5rem 0 3rem;
}

.page-header {
    margin-bottom: 1.25rem;
}

.page-header h1 {
    margin: 0 0 0.25rem;
    font-size: 1.6rem;
}

.page-header--row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.muted {
    color: var(--text-muted);
    margin: 0;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.stat-card,
.panel,
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.stat-card {
    padding: 1rem 1.1rem;
}

.stat-card__label {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.stat-card__value {
    margin: 0.35rem 0 0;
    font-size: 1.75rem;
    font-weight: 700;
}

.panel {
    padding: 1.1rem;
}

.panel__head h2 {
    margin: 0 0 0.75rem;
    font-size: 1.1rem;
}

.panel--form {
    max-width: 820px;
}

.admin-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.admin-subnav__link {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 0.9rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
}

.admin-subnav__link.is-active {
    background: var(--tab-active-bg, var(--accent));
    color: var(--tab-active-fg, #1f2328);
    border-color: transparent;
}

.search-bar {
    display: flex;
    gap: 0.75rem;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.85rem;
}

.field span {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.field input,
.field select,
.field textarea {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.7rem 0.85rem;
    background: var(--surface);
    color: var(--text-primary);
}

.field-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem 1rem;
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 0.75rem;
}

.form-actions--split {
    justify-content: space-between;
    align-items: center;
}

.btn-danger {
    background: #b91c1c;
    color: #fff;
    border-color: #b91c1c;
}

.btn-danger:hover {
    background: #991b1b;
    border-color: #991b1b;
    color: #fff;
}

body.confirm-modal-open {
    overflow: hidden;
}

.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.confirm-modal[hidden] {
    display: none !important;
}

.confirm-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
}

.confirm-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    padding: 1.35rem 1.25rem 1.15rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
    text-align: center;
}

.confirm-modal__icon {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 0.85rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, #ef4444 14%, transparent);
    color: #b91c1c;
}

.confirm-modal__icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.confirm-modal__title {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
}

.confirm-modal__message {
    margin: 0 0 1.15rem;
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.45;
}

.confirm-modal__actions {
    display: flex;
    justify-content: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-radius: var(--radius-md);
    padding: 0.65rem 1rem;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
}

.btn-primary {
    background: var(--btn-primary-bg, var(--accent));
    color: var(--btn-primary-fg, #1f2328);
}

.btn-primary:hover {
    background: var(--btn-primary-hover-bg, var(--accent-strong));
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.8rem 0.65rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table th {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.table-actions {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
}

.inline-form {
    display: inline;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius-pill);
    padding: 0.2rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-success {
    background: var(--success-bg, #ecfccb);
    color: var(--success, #3f6212);
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: var(--danger-bg, #fee2e2);
    color: var(--danger, #b91c1c);
}

.connection-form {
    display: inline-flex;
    margin: 0;
}

.ai-usage {
    display: grid;
    gap: 0.85rem;
    margin: 0 0 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 0.9rem;
    background: var(--surface);
}

.ai-usage__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.ai-usage__head .muted {
    margin: 0.15rem 0 0;
    font-size: 0.78rem;
}

.ai-usage__pct {
    text-align: right;
    line-height: 1.1;
}

.ai-usage__pct span {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
}

.ai-usage__pct small {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.ai-usage__pct--ok span { color: #3f6212; }
.ai-usage__pct--warn span { color: #a16207; }
.ai-usage__pct--critical span { color: #b91c1c; }

.ai-usage__bar {
    height: 0.45rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--border) 80%, transparent);
    overflow: hidden;
}

.ai-usage__bar-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
}

.ai-usage__bar-fill--warn { background: #eab308; }
.ai-usage__bar-fill--critical { background: #ef4444; }

.ai-usage__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
}

.ai-usage__card {
    display: grid;
    gap: 0.15rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.7rem;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-secondary) 70%, var(--surface));
}

.ai-usage__card strong {
    font-size: 1.05rem;
}

.ai-usage__card small {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.ai-usage__providers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.ai-usage__pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.priority-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}

.priority-controls__rank {
    min-width: 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

.priority-dnd {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: grab;
    user-select: none;
}

.priority-dnd:active {
    cursor: grabbing;
}

.priority-dnd__handle {
    display: inline-grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 0.4rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    background: var(--surface);
}

.priority-dnd__handle svg {
    width: 0.9rem;
    height: 0.9rem;
}

.data-table--dnd tbody tr[draggable="true"] {
    cursor: grab;
}

.data-table--dnd tbody tr.is-dragging {
    opacity: 0.55;
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.data-table--dnd tbody tr.is-drag-over {
    box-shadow: inset 0 2px 0 var(--accent);
}

.table-wrap--flush {
    overflow: visible;
}

.status-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.15rem 0.45rem 0.15rem 0.15rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    font: inherit;
    color: var(--text-secondary);
}

.status-toggle__track {
    width: 1.7rem;
    height: 1rem;
    border-radius: 999px;
    background: #cbd5e1;
    position: relative;
}

.status-toggle__track::after {
    content: '';
    position: absolute;
    top: 0.12rem;
    left: 0.12rem;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: #fff;
    transition: transform .15s ease;
}

.status-toggle.is-on {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
    color: #3f6212;
}

.status-toggle.is-on .status-toggle__track {
    background: var(--accent);
}

.status-toggle.is-on .status-toggle__track::after {
    transform: translateX(0.7rem);
}

.status-toggle__label {
    font-size: 0.72rem;
    font-weight: 600;
}

.icon-btn--danger {
    color: #b91c1c;
}

.icon-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

@media (max-width: 900px) {
    .ai-usage__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.connection-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 9.5rem;
    padding: 0.35rem 0.7rem 0.35rem 0.4rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
}

.connection-chip__icon {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 1px solid currentColor;
    flex-shrink: 0;
}

.connection-chip__icon svg {
    width: 1rem;
    height: 1rem;
}

.connection-chip__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
    text-align: left;
}

.connection-chip__meta strong {
    font-size: 0.82rem;
    font-weight: 700;
}

.connection-chip__meta small {
    font-size: 0.7rem;
    opacity: 0.85;
}

.connection-chip.is-online {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
    background: color-mix(in srgb, var(--accent) 18%, var(--surface));
    color: #3f6212;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}

.connection-chip.is-online .connection-chip__icon {
    background: var(--accent);
    border-color: var(--accent);
    color: #111;
}

.connection-chip.is-offline {
    border-color: color-mix(in srgb, #ef4444 35%, var(--border));
    background: color-mix(in srgb, #ef4444 8%, var(--surface));
    color: #9f1239;
}

.connection-chip.is-offline .connection-chip__icon {
    background: color-mix(in srgb, #ef4444 12%, var(--surface));
    border-color: #fb7185;
    color: #be123c;
}

.connection-chip:hover {
    filter: brightness(0.98);
}

.provider-row.is-online td:first-child strong {
    color: inherit;
}

.flash {
    border-radius: var(--radius-md);
    padding: 0.75rem 0.9rem;
    margin-bottom: 1rem;
}

.flash-success {
    background: var(--success-bg, #ecfccb);
    color: var(--success, #3f6212);
}

.flash-error {
    background: var(--danger-bg, #fee2e2);
    color: var(--danger, #b91c1c);
}

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
    display: grid;
    gap: 0.85rem;
    justify-items: center;
}

/* Auth */
.auth-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 18%, transparent), transparent 40%),
        linear-gradient(180deg, #171b22 0%, #1f2328 35%, var(--bg-secondary) 35%);
}

.auth-shell {
    width: min(420px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 3rem 0;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #f8fafc;
    margin-bottom: 1.25rem;
}

.auth-logo-mark {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: #1f2328;
    display: grid;
    place-items: center;
    font-weight: 800;
}

.auth-brand-title {
    margin: 0;
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.auth-brand-tagline {
    margin: 0.15rem 0 0;
    color: var(--accent);
    font-size: 0.85rem;
    line-height: 1.35;
    max-width: 16rem;
}

.auth-card {
    padding: 1.5rem;
}

.auth-title {
    margin: 0;
    font-size: 1.4rem;
}

.auth-subtitle {
    margin: 0.25rem 0 1.25rem;
    color: var(--text-muted);
}

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-links a:hover {
    color: var(--accent-strong);
}

.workspace-switcher {
    position: relative;
    margin-left: 0.75rem;
}

.workspace-switcher__button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid var(--header-control-border);
    background: var(--header-control-bg);
    color: var(--header-fg);
    border-radius: var(--radius-pill);
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    max-width: 220px;
}

.workspace-switcher__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workspace-switcher__menu {
    position: absolute;
    top: calc(100% + 0.4rem);
    left: 0;
    min-width: 240px;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 0.35rem;
    z-index: 50;
}

.workspace-switcher__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-md);
    color: var(--text-primary);
}

.workspace-switcher__item:hover,
.workspace-switcher__item.is-active {
    background: var(--surface-hover);
}

.workspace-switcher__dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 999px;
    flex: 0 0 auto;
}

.workspace-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.9rem;
}

.workspace-grid--compact {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.workspace-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    box-shadow: var(--shadow-sm);
}

.workspace-card__link {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.workspace-card h2 {
    margin: 0;
    font-size: 1.05rem;
}

.workspace-card__icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--ws-color, var(--accent)) 18%, transparent);
    color: color-mix(in srgb, var(--ws-color, var(--accent)) 70%, #0f172a);
    flex: 0 0 auto;
}

.workspace-card__meta,
.page-actions,
.workspace-heading {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.workspace-card--mini {
    flex-direction: row;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.workspace-card--mini strong {
    font-size: 0.95rem;
}

.panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.9rem;
}

.panel__title {
    margin: 0 0 0.85rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
}

.inline-role-form select {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.35rem 0.5rem;
    background: var(--surface);
}

@media (max-width: 768px) {
    .app-nav-toggle {
        display: inline-flex;
    }

    .app-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        padding-bottom: 0.75rem;
    }

    .app-topbar__inner.is-open .app-nav {
        display: flex;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .workspace-switcher {
        order: 3;
        width: 100%;
        margin: 0.35rem 0;
    }

    .workspace-switcher__button {
        width: 100%;
        max-width: none;
        justify-content: space-between;
    }
}

/* Kanban */
.kanban-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 1rem;
}

.kanban-board {
    display: flex;
    gap: 0.85rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    align-items: flex-start;
}

.kanban-column {
    flex: 0 0 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.65rem;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.kanban-column__head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.kanban-column__head h2 {
    margin: 0;
    font-size: 0.95rem;
    flex: 1;
}

.kanban-column__dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
}

.kanban-column__count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--surface);
    border-radius: var(--radius-pill);
    padding: 0.1rem 0.45rem;
}

.kanban-column__list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-height: 80px;
    flex: 1;
}

.kanban-column__add {
    border: 1px dashed var(--border);
    background: transparent;
    border-radius: var(--radius-md);
    padding: 0.45rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.kanban-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.7rem;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    position: relative;
}

.kanban-card--ghost {
    opacity: 0.5;
}

.kanban-card.is-overdue {
    border-color: #ef4444;
}

.kanban-card__priority {
    width: 100%;
    height: 3px;
    border-radius: 999px;
    margin-bottom: 0.45rem;
}

.kanban-card__title {
    margin: 0 0 0.45rem;
    font-size: 0.92rem;
    line-height: 1.35;
}

.kanban-card__meta,
.kanban-card__footer,
.kanban-card__counts {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.kanban-card__due.is-overdue {
    color: #b91c1c;
    font-weight: 600;
}

.kanban-card__menu {
    margin-top: 0.45rem;
}

.kanban-card__move {
    width: 100%;
    font-size: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.25rem;
    background: var(--surface);
}

.tag-chip {
    display: inline-flex;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--tag-color, #64748b) 18%, white);
    color: var(--text-secondary);
    font-size: 0.72rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.modal[hidden],
.task-drawer[hidden] {
    display: none !important;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
}

.modal__backdrop,
.task-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.modal__dialog {
    position: relative;
    z-index: 1;
    width: min(480px, calc(100vw - 1.5rem));
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 1.1rem;
    box-shadow: var(--shadow-lg);
}

.agenda-create-ws {
    margin: 0 0 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.form-grid--single {
    grid-template-columns: 1fr;
}

.task-drawer {
    position: fixed;
    inset: 0;
    z-index: 90;
}

.task-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: min(720px, 100vw);
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
}

.task-drawer__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border);
}

.task-drawer__body {
    padding: 1rem 1.1rem 2rem;
    overflow: auto;
}

.drawer-section {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.drawer-section h3 {
    margin: 0 0 0.65rem;
    font-size: 0.95rem;
}

.checklist-item {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 0.4rem;
}

.inline-add {
    display: flex;
    gap: 0.45rem;
    margin-top: 0.55rem;
}

.inline-add input {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.45rem 0.6rem;
}

.comment {
    margin-bottom: 0.65rem;
}

.comment p {
    margin: 0.15rem 0 0;
}

.history-list {
    margin: 0;
    padding-left: 1.1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.toast-root {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 100;
    display: grid;
    gap: 0.45rem;
}

.toast {
    min-width: 220px;
    max-width: 360px;
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    background: var(--surface);
    border: 1px solid var(--border);
}

.toast--success {
    background: var(--success-bg, #ecfccb);
    color: var(--success, #3f6212);
}

.toast--error {
    background: var(--danger-bg, #fee2e2);
    color: var(--danger, #b91c1c);
}

.toast--warning {
    background: #fef3c7;
    color: #92400e;
}

.is-overdue-row td {
    color: #b91c1c;
}

@media (max-width: 768px) {
    .kanban-column {
        flex-basis: 85vw;
    }

    .task-drawer__panel {
        width: 100vw;
    }
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--accent);
    color: #1f2328;
    font-size: 0.7rem;
    font-weight: 700;
}

.notification-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.65rem;
}

.notification-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.notification-item.is-unread {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
    background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.notification-item__actions {
    display: flex;
    gap: 0.4rem;
    align-items: start;
}

#calendar {
    min-height: 620px;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.alert-success {
    background: color-mix(in srgb, var(--accent) 18%, var(--surface));
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.alert-danger {
    background: color-mix(in srgb, #ef4444 12%, var(--surface));
    border-color: color-mix(in srgb, #ef4444 35%, var(--border));
    color: #b91c1c;
}

.field--full {
    grid-column: 1 / -1;
}

.checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.code-block {
    margin: 0;
    padding: 0.85rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: auto;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.simple-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.simple-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border);
}

/* ===== Harness shell (sidebar + stage) ===== */
.harness-body {
    font-size: 0.875rem;
    height: 100%;
    overflow: hidden;
    background:
        radial-gradient(1200px 500px at 80% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
        var(--bg-secondary);
}

html:has(.harness-body) {
    height: 100%;
    overflow: hidden;
}

.harness-shell {
    display: grid;
    grid-template-columns: 248px 1fr;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.harness-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.7rem 0.65rem;
    background: linear-gradient(180deg, #1f2328 0%, #151920 100%);
    color: #f8fafc;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    height: 100%;
    min-height: 0;
    overflow: hidden;
    z-index: 30;
}

.harness-sidebar__brand {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.85rem 0.15rem 0.45rem;
    margin-top: 0.25rem;
}

.harness-sidebar__top-utils {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.harness-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    color: inherit;
    min-width: 0;
}

.harness-brand__mark {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.5rem;
    display: grid;
    place-items: center;
    background: #f8fafc;
    color: #151920;
    font-weight: 800;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.harness-brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
    min-width: 0;
}

.harness-brand__text strong {
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.harness-brand__text small {
    color: var(--accent);
    font-weight: 500;
    letter-spacing: 0;
    font-size: 0.62rem;
    line-height: 1.25;
    max-width: 11.5rem;
    white-space: normal;
}

.harness-user-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.1rem 0.15rem;
    padding: 0.4rem 0.5rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
}

.harness-user-chip:hover,
.harness-user-chip.is-active {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

.harness-user-chip__meta {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    min-width: 0;
}

.harness-user-chip__meta strong {
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 9.5rem;
}

.harness-user-chip__meta small {
    font-size: 0.62rem;
    color: #94a3b8;
}

.user-avatar {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #1f2328;
    font-size: 0.75rem;
    font-weight: 800;
    overflow: hidden;
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-avatar--lg {
    width: 4.25rem;
    height: 4.25rem;
    font-size: 1.4rem;
}

.profile-avatar-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.profile-avatar-actions {
    display: grid;
    gap: 0.45rem;
}

.field__label,
.field > span:first-child,
.drawer-section h3 {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.field__label svg,
.field > span:first-child svg,
.drawer-section h3 svg,
.admin-subnav__link svg,
.btn svg,
.page-header h1 svg {
    width: 0.85rem;
    height: 0.85rem;
    flex-shrink: 0;
    opacity: 0.85;
}

.admin-subnav__link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.harness-new-chat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 2.1rem;
    border-radius: 0.7rem;
    background: var(--accent);
    color: #1f2328;
    font-weight: 700;
    font-size: 0.8rem;
    margin: 0.1rem 0.15rem;
}

.harness-new-chat:hover {
    background: var(--accent-hover);
}

.harness-nav {
    display: grid;
    gap: 0.1rem;
    padding: 0.1rem;
}

.harness-nav__link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.42rem 0.6rem;
    border-radius: 0.6rem;
    color: #cbd5e1;
    font-size: 0.8rem;
}

.harness-nav__link svg {
    width: 0.95rem;
    height: 0.95rem;
}

.harness-nav__link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.harness-nav__link.is-active {
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    color: var(--accent);
    box-shadow: inset 2px 0 0 var(--accent);
    font-weight: 600;
}

.harness-nav__link.is-active svg {
    color: var(--accent);
    stroke: var(--accent);
}

.harness-sessions {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.25rem 0.1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 0.2rem;
}

.harness-sessions--spacer {
    border-top: 0;
}

.harness-sessions__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #94a3b8;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.25rem 0.15rem 0.25rem 0.45rem;
}

.harness-sessions__search {
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 0.45rem;
}

.harness-sessions__search svg {
    width: 0.85rem;
    height: 0.85rem;
}

.harness-sessions__list {
    overflow: auto;
    display: grid;
    gap: 0.12rem;
    padding-bottom: 0.35rem;
}

.harness-sessions__empty {
    margin: 0;
    padding: 0.4rem 0.45rem;
    color: #64748b;
    font-size: 0.75rem;
}

.harness-session {
    display: block;
    padding: 0.4rem 0.55rem;
    border-radius: 0.5rem;
    color: #cbd5e1;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.harness-session:hover,
.harness-session.is-active {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}

.harness-session.is-active {
    box-shadow: inset 2px 0 0 var(--accent);
}

.harness-sidebar__footer {
    display: grid;
    gap: 0.3rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.harness-workspace-chip {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.55rem;
    border-radius: 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
    font-size: 0.75rem;
}

.harness-workspace-chip:hover {
    background: rgba(255, 255, 255, 0.08);
}

.harness-workspace-chip--static {
    cursor: default;
}

.harness-workspace-chip--static:hover {
    background: rgba(255, 255, 255, 0.04);
}

.harness-nav__link--accent {
    margin-top: 0.15rem;
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    color: var(--accent);
    font-weight: 600;
}

.harness-nav__link--accent:hover {
    background: color-mix(in srgb, var(--accent) 24%, transparent);
    color: var(--accent);
}

.harness-icon-btn {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 0.55rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
}

.harness-icon-btn svg {
    width: 0.9rem;
    height: 0.9rem;
}

.harness-sidebar .harness-icon-btn {
    color: #e2e8f0;
}

.harness-stage .harness-icon-btn {
    border-color: var(--border);
    background: var(--surface);
    color: var(--text-secondary);
}

.harness-sidebar__close {
    display: none;
    position: absolute;
    top: 0.55rem;
    right: 0.15rem;
}

.harness-backdrop {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden;
}

.harness-stage {
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.harness-stage__top {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.95rem;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(8px);
    flex-shrink: 0;
    z-index: 10;
}

.harness-stage__menu {
    display: none;
}

.harness-stage__title {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
    margin-right: auto;
}

.harness-stage__title strong {
    font-size: 0.88rem;
}

.harness-stage__title small {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.harness-stage__actions {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
    flex-shrink: 0;
}

.harness-user-menu {
    position: relative;
}

.harness-user-chip--top {
    margin: 0;
    padding: 0.25rem 0.45rem 0.25rem 0.25rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.harness-user-chip--top:hover,
.harness-user-menu.is-open .harness-user-chip--top,
.harness-user-chip--top.is-active {
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.harness-user-chip--top .harness-user-chip__meta small {
    color: var(--text-muted);
}

.harness-user-menu__chevron {
    width: 0.85rem;
    height: 0.85rem;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform .15s ease;
}

.harness-user-menu.is-open .harness-user-menu__chevron {
    transform: rotate(180deg);
}

.harness-user-menu__panel {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    min-width: 11.5rem;
    padding: 0.35rem;
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    z-index: 40;
    display: grid;
    gap: 0.1rem;
}

.harness-user-menu__panel[hidden] {
    display: none !important;
}

.harness-user-menu__item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    margin: 0;
    padding: 0.5rem 0.6rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
}

.harness-user-menu__item svg {
    width: 0.95rem;
    height: 0.95rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.harness-user-menu__item:hover,
.harness-user-menu__item.is-active {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.harness-user-menu__item--danger {
    color: #b91c1c;
}

.harness-user-menu__item--danger svg {
    color: #b91c1c;
}

.harness-user-menu__sep {
    height: 1px;
    margin: 0.2rem 0.35rem;
    background: var(--border);
}

.harness-ws-nav {
    flex-shrink: 0;
    padding: 0.55rem 0.95rem 0.15rem;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    border-bottom: 1px solid var(--border);
    z-index: 8;
}

.harness-ws-nav .admin-subnav {
    margin-bottom: 0.45rem;
}

.harness-stage__body {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.harness-stage__body--chat {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.harness-stage__body--chat .harness-ws-nav {
    padding-bottom: 0.45rem;
}

.harness-stage__body:not(.harness-stage__body--chat) .harness-page {
    flex: 1;
    min-height: 0;
    overflow: visible;
}

.harness-stage__body:not(.harness-stage__body--chat) {
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.harness-stage__body:not(.harness-stage__body--chat)::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.harness-page {
    width: min(1200px, calc(100% - 1.5rem));
    margin: 0.85rem auto 1.5rem;
}

.harness-page h1 {
    font-size: 1.25rem;
}

.harness-page h2 {
    font-size: 1rem;
}

.harness-page .muted,
.harness-page .admin-subnav__link,
.harness-page .data-table,
.harness-page .btn {
    font-size: 0.8rem;
}

.harness-page .admin-subnav__link {
    padding: 0.35rem 0.65rem;
}

/* Chat canvas */
.chat-app {
    flex: 1;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    width: min(760px, 100%);
    margin: 0 auto;
    padding: 0.65rem 1rem 0.9rem;
}

.chat-welcome {
    flex: 1;
    min-height: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 0.35rem;
    text-align: center;
    padding: 1.25rem 0.75rem;
    overflow: auto;
}

.chat-welcome[hidden],
.chat-thread[hidden] {
    display: none !important;
}

.chat-welcome h1 {
    margin: 0;
    font-size: clamp(1.25rem, 2.2vw, 1.7rem);
    letter-spacing: -0.03em;
}

.chat-welcome .muted {
    font-size: 0.8rem;
}

.chat-welcome__mark {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.9rem;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    font-weight: 800;
    background: #111827;
    color: var(--accent);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    overflow: hidden;
}

.chat-welcome__mark.is-max [data-chat-mark-label] {
    font-size: 0.78rem;
    letter-spacing: -0.03em;
    line-height: 1;
}

.chat-welcome__mark.is-agent [data-chat-mark-label] {
    font-size: 1.35rem;
}

.chat-welcome__mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chat-welcome__mark.is-workspace {
    background: var(--ws-color, #111827);
    color: #111827;
    box-shadow: 0 12px 28px color-mix(in srgb, var(--ws-color, #111827) 35%, transparent);
}

.chat-welcome__mark svg {
    width: 1.35rem;
    height: 1.35rem;
}

.agent-avatar-sm {
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    display: inline-grid;
    place-items: center;
    background: #111827;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 800;
    overflow: hidden;
    vertical-align: middle;
}

.agent-avatar-sm img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.agent-avatar-preview {
    background: #111827 !important;
    color: var(--accent) !important;
    font-weight: 800;
}

.chat-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 22%, var(--surface));
    color: #3f6212;
    font-size: 0.65rem;
    font-weight: 700;
}

.chat-thread {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.35rem 0 0.75rem;
    overscroll-behavior: contain;
}

.chat-bubble {
    max-width: 92%;
    padding: 0.55rem 0.75rem;
    border-radius: 0.8rem;
    border: 1px solid var(--border);
    background: var(--surface);
}

.chat-bubble--user {
    align-self: flex-end;
    background: color-mix(in srgb, var(--accent) 14%, var(--surface));
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.chat-bubble--assistant {
    align-self: flex-start;
}

.chat-bubble__role {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.chat-bubble__content {
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.45;
    font-size: 0.84rem;
}

.chat-bubble__actions {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    margin-top: 0.45rem;
    opacity: 0.55;
    transition: opacity .15s ease;
}

.chat-bubble--assistant:hover .chat-bubble__actions,
.chat-bubble--assistant:focus-within .chat-bubble__actions {
    opacity: 1;
}

.chat-action-btn {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 0.45rem;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    display: inline-grid;
    place-items: center;
    cursor: pointer;
}

.chat-action-btn svg {
    width: 0.9rem;
    height: 0.9rem;
}

.chat-action-btn:hover,
.chat-action-btn.is-done {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    color: #3f6212;
}

.chat-bubble.is-thinking {
    opacity: 0.75;
}

.chat-bubble.is-thinking .chat-bubble__actions {
    display: none;
}

body.chat-expand-open {
    overflow: hidden;
}

.chat-expand-modal {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.chat-expand-modal[hidden] {
    display: none !important;
}

.chat-expand-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
}

.chat-expand-modal__panel {
    position: relative;
    width: min(760px, 100%);
    max-height: min(82vh, 720px);
    display: flex;
    flex-direction: column;
    border-radius: 1rem;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
    overflow: hidden;
}

.chat-expand-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--border);
}

.chat-expand-modal__tools {
    display: inline-flex;
    gap: 0.15rem;
}

.chat-expand-modal__body {
    padding: 1rem 1.1rem 1.25rem;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.55;
    font-size: 0.92rem;
}

.chat-composer {
    display: grid;
    gap: 0.45rem;
    padding-top: 0.2rem;
    flex-shrink: 0;
}

.chat-composer__box {
    display: grid;
    gap: 0.3rem;
    border: 1px solid var(--border);
    border-radius: 0.95rem;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
    padding: 0.55rem 0.7rem 0.45rem;
}

.chat-composer__box textarea {
    width: 100%;
    border: 0;
    resize: none;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    min-height: 1.35rem;
    max-height: 140px;
    line-height: 1.4;
    font-size: 0.84rem;
}

.chat-composer__actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.4rem;
}

.chat-composer__left {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
}

.chat-model-picker {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    max-width: min(14rem, 50vw);
    min-height: 1.7rem;
    padding: 0.1rem 0.35rem 0.1rem 0.3rem;
    border-radius: 999px;
    border: 1px solid transparent;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
}

.chat-model-picker:hover,
.chat-model-picker:focus-within {
    border-color: var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.chat-model-picker svg {
    width: 0.85rem;
    height: 0.85rem;
    flex-shrink: 0;
    opacity: 0.85;
}

.chat-model-picker select {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 0.7rem;
    font-weight: 500;
    max-width: 100%;
    min-width: 0;
    padding: 0.1rem 0.7rem 0.1rem 0;
    cursor: pointer;
    outline: none;
    text-overflow: ellipsis;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.chat-send {
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: #1f2328;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.chat-send svg {
    width: 0.95rem;
    height: 0.95rem;
}

.chat-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.chat-empty-models {
    text-align: center;
    padding: 0.85rem;
    border: 1px dashed var(--border);
    border-radius: 0.85rem;
    background: var(--surface);
    font-size: 0.8rem;
}

@media (max-width: 960px) {
    .harness-shell {
        grid-template-columns: 1fr;
    }

    .harness-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(280px, 88vw);
        transform: translateX(-105%);
        transition: transform .2s ease;
        box-shadow: 12px 0 40px rgba(0, 0, 0, 0.25);
    }

    .harness-shell[data-sidebar-open="true"] .harness-sidebar {
        transform: translateX(0);
    }

    .harness-sidebar__close,
    .harness-stage__menu {
        display: inline-grid;
    }

    /* Backdrop só com menu aberto — nunca cobrir a tela “fumê” por padrão */
    .harness-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 25;
        display: none !important;
        pointer-events: none !important;
        visibility: hidden;
    }

    .harness-shell[data-sidebar-open="true"] .harness-backdrop {
        display: block !important;
        pointer-events: auto !important;
        visibility: visible;
    }

    .harness-shell[data-sidebar-open="true"] .harness-sidebar {
        z-index: 30;
    }

    .harness-user-chip--top .harness-user-chip__meta {
        display: none;
    }
}

/* Chat search modal (ChatGPT-style) */
body.chat-search-open {
    overflow: hidden;
}

.chat-search-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: start center;
    padding: 12vh 1rem 1rem;
}

.chat-search-modal[hidden] {
    display: none !important;
}

.chat-search-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(3px);
}

.chat-search-modal__panel {
    position: relative;
    width: min(560px, 100%);
    max-height: min(70vh, 520px);
    display: flex;
    flex-direction: column;
    border-radius: 1rem;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
    overflow: hidden;
}

.chat-search-modal__bar {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}

.chat-search-modal__bar svg {
    width: 1.05rem;
    height: 1.05rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.chat-search-modal__bar input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.chat-search-modal__esc {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.4rem;
    border-radius: 0.35rem;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-secondary) 80%, var(--surface));
    color: var(--text-muted);
    font-size: 0.65rem;
    font-family: inherit;
    cursor: pointer;
}

.chat-search-modal__hint {
    margin: 0;
    padding: 0.45rem 1rem 0.2rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.chat-search-modal__list {
    overflow: auto;
    padding: 0.35rem;
    display: grid;
    gap: 0.15rem;
}

.chat-search-modal__loading,
.chat-search-modal__empty {
    margin: 0;
    padding: 1.25rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.chat-search-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.65rem;
    align-items: center;
    padding: 0.65rem 0.7rem;
    border-radius: 0.7rem;
    color: inherit;
    outline: none;
}

.chat-search-item:hover,
.chat-search-item:focus {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.chat-search-item__icon {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.5rem;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    color: #3f6212;
}

.chat-search-item__icon svg {
    width: 0.9rem;
    height: 0.9rem;
}

.chat-search-item__body {
    min-width: 0;
    display: grid;
    gap: 0.1rem;
}

.chat-search-item__body strong {
    font-size: 0.84rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-search-item__body small {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-search-item__meta {
    display: grid;
    justify-items: end;
    gap: 0.1rem;
    font-size: 0.65rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.chat-search-item__meta em {
    font-style: normal;
    max-width: 7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Workspace overview dashboard */
.stat-card--alert .stat-card__value {
    color: #dc2626;
}

.ws-dash {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.95fr);
    gap: 1rem;
    align-items: start;
}

.ws-dash__charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.ws-dash__panel {
    margin: 0;
    min-width: 0;
}

.ws-dash__panel--wide {
    grid-column: 1 / -1;
}

.ws-dash__panel-head h2 {
    margin: 0 0 0.2rem;
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.ws-dash__panel-head h2 i {
    width: 1rem;
    height: 1rem;
    color: var(--accent-strong);
}

.ws-dash__panel-head .muted {
    font-size: 0.82rem;
}

.ws-dash__chart-wrap {
    position: relative;
    height: 240px;
    margin-top: 0.35rem;
}

.ws-dash__chart-wrap--tall {
    height: 280px;
}

.ws-dash__side {
    display: grid;
    gap: 1rem;
}

.ws-dash__insights-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.ws-dash__insights-head .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.ws-dash__insights-head .btn i {
    width: 0.9rem;
    height: 0.9rem;
}

.ws-dash__insights-meta {
    margin: 0 0 0.85rem;
    font-size: 0.8rem;
}

.ws-insight-list,
.ws-overdue-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.65rem;
}

.ws-insight {
    display: grid;
    gap: 0.2rem;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    border-left-width: 3px;
    background: var(--bg-secondary);
}

.ws-insight strong {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.ws-insight span {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.ws-insight--info {
    border-left-color: #38bdf8;
}

.ws-insight--warn {
    border-left-color: #f97316;
}

.ws-insight--danger {
    border-left-color: #ef4444;
}

.ws-insight--ok {
    border-left-color: var(--accent);
}

.ws-overdue-list a {
    display: grid;
    gap: 0.15rem;
    text-decoration: none;
    color: inherit;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.ws-overdue-list a:hover {
    background: var(--surface-hover);
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.ws-overdue-list strong {
    font-size: 0.9rem;
}

.ws-overdue-list span {
    font-size: 0.78rem;
    color: #dc2626;
}

.empty-state--compact {
    padding: 0.85rem 0.25rem;
}

.empty-state--compact p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

@media (max-width: 1100px) {
    .ws-dash {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .ws-dash__charts {
        grid-template-columns: 1fr;
    }

    .ws-dash__insights-head {
        flex-direction: column;
        align-items: stretch;
    }

    .ws-dash__chart-wrap,
    .ws-dash__chart-wrap--tall {
        height: 220px;
    }
}


/* Settings: groups + access matrix */
.groups-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.group-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.group-card__head h2 {
    margin: 0;
    font-size: 1.05rem;
}

.group-card__alias {
    display: inline-block;
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm, 4px);
}

.group-card__meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.85rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.perm-chip-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.perm-chip-list code {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm, 4px);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    font-size: 0.78rem;
}

.access-layout {
    display: grid;
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.access-groups {
    padding: 0.85rem;
    position: sticky;
    top: 1rem;
}

.access-groups__label {
    margin: 0 0 0.55rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.access-groups__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.35rem;
}

.access-groups__item {
    display: grid;
    gap: 0.15rem;
    padding: 0.7rem 0.8rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.access-groups__item:hover {
    background: var(--surface-hover);
}

.access-groups__item.is-active {
    background: color-mix(in srgb, var(--accent) 18%, var(--surface));
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.access-groups__item strong {
    font-size: 0.92rem;
}

.access-groups__item span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.access-editor__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.access-editor__head h2 {
    margin: 0 0 0.2rem;
    font-size: 1.25rem;
}

.access-editor__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.access-section__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.access-section__head h3 {
    margin: 0 0 0.15rem;
    font-size: 1.05rem;
}

.access-banner {
    margin: 0 0 0.85rem;
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--accent) 14%, var(--bg-secondary));
    border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
    font-size: 0.86rem;
    color: var(--text-secondary);
}

.access-perm-cats {
    display: grid;
    gap: 0.55rem;
}

.access-cat {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    overflow: hidden;
}

.access-cat summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    font-weight: 650;
    font-size: 0.9rem;
}

.access-cat summary::-webkit-details-marker {
    display: none;
}

.access-cat summary em {
    font-style: normal;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
}

.access-cat__body {
    display: grid;
    gap: 0.35rem;
    padding: 0 0.65rem 0.7rem;
}

.access-toggle {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.7rem;
    align-items: center;
    padding: 0.55rem 0.65rem;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
}

.access-toggle.is-locked {
    cursor: default;
    opacity: 0.92;
}

.access-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.access-toggle__ui {
    width: 2.4rem;
    height: 1.35rem;
    border-radius: 999px;
    background: #cbd5e1;
    position: relative;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.access-toggle__ui::after {
    content: '';
    position: absolute;
    top: 0.15rem;
    left: 0.15rem;
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
    transition: transform 0.15s ease;
}

.access-toggle input:checked + .access-toggle__ui {
    background: var(--accent);
}

.access-toggle input:checked + .access-toggle__ui::after {
    transform: translateX(1.05rem);
}

.access-toggle__text {
    display: grid;
    gap: 0.1rem;
    min-width: 0;
}

.access-toggle__text strong {
    font-size: 0.88rem;
    font-weight: 600;
}

.access-toggle__text code {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.access-ws-modes {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 0.9rem;
}

.access-ws-mode {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.65rem;
    align-items: start;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    cursor: pointer;
}

.access-ws-mode:has(input:checked) {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.access-ws-mode input {
    margin-top: 0.2rem;
    accent-color: var(--accent-strong);
}

.access-ws-mode strong {
    display: block;
    font-size: 0.9rem;
}

.access-ws-mode small {
    display: block;
    margin-top: 0.15rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.access-ws-list {
    display: grid;
    gap: 0.4rem;
    max-height: 360px;
    overflow: auto;
    padding-right: 0.15rem;
}

.access-ws-list.is-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.access-ws-chip {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    cursor: pointer;
}

.access-ws-chip:has(input:checked) {
    border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.access-ws-chip input {
    accent-color: var(--accent-strong);
}

.access-ws-chip__dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    background: var(--ws-color, var(--accent));
    flex-shrink: 0;
}

.access-ws-chip__name {
    font-size: 0.9rem;
    font-weight: 550;
}

.access-editor__foot {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}

.field--full {
    grid-column: 1 / -1;
}

@media (max-width: 1100px) {
    .access-editor__grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .access-layout {
        grid-template-columns: 1fr;
    }

    .access-groups {
        position: static;
    }

    .access-groups__list {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }

    .access-editor__head {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Agentic office settings */
.admin-subnav--secondary {
    margin-top: -0.35rem;
    margin-bottom: 1rem;
}

.admin-subnav--md {
    margin: 0 0 0.85rem;
}

.admin-subnav--md .admin-subnav__link {
    cursor: pointer;
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
}

.md-tabs {
    display: grid;
    gap: 0.25rem;
}

.md-tabs__panel[hidden] {
    display: none !important;
}

.md-tabs__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

@media (max-width: 900px) {
    .md-tabs__grid { grid-template-columns: 1fr; }
}

.md-tabs__editor,
.md-tabs textarea {
    min-height: 14rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.45;
}

.md-preview {
    min-height: 14rem;
    max-height: 28rem;
    overflow: auto;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 0.65rem);
    background: color-mix(in srgb, var(--surface-2, var(--surface)) 92%, #000 4%);
    font-size: 0.86rem;
    line-height: 1.45;
}

.md-preview h1, .md-preview h2, .md-preview h3 { margin: 0.4rem 0; font-size: 1rem; }
.md-preview ul { margin: 0.4rem 0; padding-left: 1.2rem; }

.field__section-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.55rem;
}

.skills-picker {
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 0.75rem);
    padding: 0.85rem 1rem 1rem;
}

.skills-picker legend {
    padding: 0 0.35rem;
    font-weight: 600;
}

.skills-picker__hint {
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
}

.chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.chip-check {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    font-size: 0.8rem;
    cursor: pointer;
}

.chip-check:has(input:checked) {
    border-color: transparent;
    background: var(--tab-active-bg, var(--accent));
    color: var(--tab-active-fg, #1f2328);
}

.chip-check input {
    margin: 0;
}

.brain-layout {
    display: grid;
    grid-template-columns: minmax(200px, 240px) 1fr;
    gap: 1rem;
}

@media (max-width: 860px) {
    .brain-layout { grid-template-columns: 1fr; }
}

.brain-cats {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.35rem;
}

.brain-cats li {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.brain-cats a {
    flex: 1;
    padding: 0.35rem 0.5rem;
    border-radius: 0.45rem;
    color: var(--text-secondary);
}

.brain-cats a.is-active,
.brain-cats a:hover {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    color: var(--text-primary);
}

.color-dot {
    display: inline-block;
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 50%;
    margin-right: 0.35rem;
    vertical-align: middle;
}

.max-identity-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md, 0.75rem);
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
    margin-bottom: 1rem;
}

.max-identity-card strong {
    display: block;
}

.max-identity-card small {
    color: var(--text-muted);
}

