/* Projects Page Styles */

.projects-list {
    padding: 0 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 340px));
    gap: 16px;
    align-items: start;
    justify-content: start;
}

.project-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    min-height: 100%;
    background: linear-gradient(180deg, rgba(10, 19, 35, 0.96) 0%, rgba(7, 13, 24, 0.98) 100%);
    border: 1px solid rgba(111, 201, 255, 0.15);
    border-radius: 20px;
    padding: 18px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.22);
    width: 340px;
    max-width: 100%;
}

.project-card:hover {
    border-color: rgba(111, 201, 255, 0.28);
    box-shadow: var(--glow-sm);
}

.project-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.project-checkbox-name {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

.project-name {
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--text-primary);
    line-height: 1.35;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.project-card *,
.memory-page *,
.memory-modal-content * {
    min-width: 0;
}

.project-card-toggle {
    flex-shrink: 0;
}

.project-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 0;
    min-width: 0;
}

.project-meta-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
    flex-wrap: wrap;
    min-width: 0;
}

.project-meta-key {
    min-width: 90px;
    color: var(--text-disabled);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.project-meta-val {
    color: var(--text-secondary);
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.project-path-val {
    font-size: 13px;
    opacity: 1;
    flex: 1;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.project-cache-info {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-disabled);
    margin-bottom: 0;
    line-height: 1.55;
}

.memory-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border: 1px solid var(--border-faint);
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.2;
    color: var(--text-secondary);
    background: rgba(8, 18, 34, 0.55);
}

.memory-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-red);
    box-shadow: 0 0 8px var(--accent-red);
}

.memory-status-filled .memory-status-dot {
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

.memory-status-filling .memory-status-dot {
    background: var(--accent-amber);
    box-shadow: 0 0 8px var(--accent-amber);
    animation: pulse 1.1s ease-in-out infinite;
}

.memory-modal-content {
    width: min(1280px, 96vw);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-panel);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.memory-modal-body {
    padding: 16px 20px 20px;
    overflow: auto;
}

.memory-search-modal {
    min-height: min(82vh, 860px);
}

.memory-search-modal .memory-modal-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.memory-document-modal {
    width: min(1080px, 96vw);
}

.memory-search-modal,
.memory-history-modal {
    width: min(1040px, 94vw);
}

.memory-page {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: calc(100vh - 110px);
}

#screen-projects.memory-project-open {
    height: 100%;
    overflow: hidden;
}

#screen-projects.memory-project-open #project-memory-page {
    height: 100%;
    min-height: 0;
    gap: 0;
    overflow: hidden;
}

#screen-projects.memory-project-open .memory-page-header {
    flex: 0 0 auto;
}

#screen-projects.memory-project-open .memory-canvas-shell {
    flex: 1 1 auto;
    min-height: 0;
}

#screen-projects.memory-project-open .memory-panel-graph-full {
    height: 100%;
    min-height: 0;
}

#screen-projects.memory-project-open .memory-graph-stage {
    flex: 1 1 auto;
    min-height: 0;
}

#screen-projects.memory-project-open .memory-graph {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

#screen-projects.knowledge-open-loading {
    pointer-events: none;
    filter: blur(2px);
}

.knowledge-open-loader {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(3, 9, 18, 0.64);
    backdrop-filter: blur(3px);
}

.knowledge-open-loader[hidden] {
    display: none;
}

.knowledge-open-loader-panel {
    width: min(520px, 92vw);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 18px 20px;
    border: 1px solid rgba(0, 212, 255, 0.36);
    background: rgba(6, 18, 32, 0.96);
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42), 0 0 34px rgba(0, 212, 255, 0.16);
}

.knowledge-open-loader-title {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 5px;
}

.knowledge-open-loader-text {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.5;
}

.memory-page-header {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 18px 12px;
    border-bottom: 1px solid var(--border-faint);
    background: linear-gradient(180deg, rgba(7, 16, 30, 0.72), rgba(7, 16, 30, 0.32));
    min-height: 62px;
}

.memory-page-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(0, 212, 255, 0.38);
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, rgba(0, 212, 255, 0.13), rgba(0, 111, 155, 0.08));
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 9px 18px;
    cursor: pointer;
    box-shadow: 0 0 22px rgba(0, 212, 255, 0.18);
}

.memory-page-back:hover {
    color: var(--text-primary);
    border-color: rgba(0, 212, 255, 0.68);
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.34);
}

.memory-page-save-controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 260px;
}

.memory-page-save-controls .btn {
    min-height: 34px;
    padding: 8px 12px;
    font-size: 11px;
    white-space: nowrap;
}

.memory-page-save-controls .btn:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.memory-save-progress {
    min-width: 260px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.memory-save-progress[hidden] {
    display: none;
}

.memory-save-spinner {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 2px solid rgba(111, 201, 255, 0.22);
    border-top-color: var(--accent-cyan);
    animation: memory-save-spin 0.9s linear infinite;
}

.memory-save-progress-body {
    flex: 1;
    display: grid;
    gap: 5px;
}

.memory-save-progress-label,
.knowledge-conversion-status {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.35;
}

.knowledge-move-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(255, 216, 106, 0.58);
    background: rgba(32, 22, 2, 0.96);
    box-shadow: 0 0 0 1px rgba(255, 216, 106, 0.12), 0 0 22px rgba(255, 198, 71, 0.18);
    padding: 8px 10px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 11px;
}

.knowledge-move-bar[hidden] {
    display: none;
}

.knowledge-move-bar__status {
    color: var(--text-secondary);
    white-space: nowrap;
}

.knowledge-move-bar__status strong {
    color: #ffd86a;
    font-weight: 700;
}

.knowledge-move-bar__beacon {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #ffd86a;
    box-shadow: 0 0 0 4px rgba(255, 216, 106, 0.16), 0 0 16px rgba(255, 216, 106, 0.68);
    animation: knowledge-move-pulse 1.1s ease-in-out infinite;
}

.knowledge-move-bar.has-target {
    border-color: rgba(61, 220, 151, 0.72);
    background: rgba(4, 30, 24, 0.96);
    box-shadow: 0 0 0 1px rgba(61, 220, 151, 0.15), 0 0 22px rgba(61, 220, 151, 0.18);
}

.knowledge-move-bar.has-target .knowledge-move-bar__beacon {
    background: #3ddc97;
    box-shadow: 0 0 0 4px rgba(61, 220, 151, 0.16), 0 0 16px rgba(61, 220, 151, 0.68);
}

.knowledge-move-bar.has-target .knowledge-move-bar__status strong {
    color: #8cf0c3;
}

@keyframes knowledge-move-pulse {
    0%,
    100% {
        transform: scale(0.9);
        opacity: 0.65;
    }
    50% {
        transform: scale(1.12);
        opacity: 1;
    }
}

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

.memory-page-heading {
    display: grid;
    gap: 4px;
}

.memory-page-title {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.3;
}

.memory-page-subtitle {
    color: var(--text-muted);
    font-size: 12px;
}

.memory-canvas-shell {
    position: relative;
    min-height: calc(100vh - 122px);
    display: flex;
    flex-direction: column;
}

.memory-canvas-actions {
    position: absolute;
    z-index: 4;
    top: 14px;
    left: 14px;
    display: inline-flex;
    gap: 8px;
    align-items: center;
}

.knowledge-source-control {
    position: relative;
    display: inline-flex;
}

.knowledge-source-trigger {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
}

.knowledge-source-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 168px;
    padding: 6px;
    border: 1px solid rgba(0, 212, 255, 0.35);
    border-radius: 8px;
    background: rgba(5, 13, 25, 0.96);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.35), 0 0 24px rgba(0, 212, 255, 0.16);
}

.knowledge-source-menu button {
    width: 100%;
    min-height: 34px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 8px 10px;
    text-align: left;
}

.knowledge-source-menu button[hidden] {
    display: none;
}

.knowledge-source-menu button:hover {
    background: rgba(0, 212, 255, 0.12);
}

.knowledge-source-menu button:disabled {
    color: rgba(177, 192, 211, 0.46);
    cursor: not-allowed;
}

.knowledge-source-menu button:disabled:hover {
    background: transparent;
}

.knowledge-source-menu button.danger {
    color: #ff8f8f;
}

.knowledge-node-actions-layer {
    position: absolute;
    inset: 0;
    z-index: 30;
    pointer-events: none;
}

.knowledge-node-source-control {
    position: absolute;
    pointer-events: auto;
    z-index: 31;
}

.knowledge-node-source-trigger {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(0, 212, 255, 0.56);
    border-radius: 999px;
    background: rgb(5, 13, 25);
    color: var(--accent-cyan);
    box-shadow: 0 0 18px rgba(0, 212, 255, 0.24);
    display: inline-grid;
    place-items: center;
    padding: 0;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.82;
}

.knowledge-node-source-trigger:hover,
.knowledge-node-source-trigger[aria-expanded="true"] {
    opacity: 1;
    border-color: rgba(0, 212, 255, 0.94);
    background: rgb(5, 33, 48);
}

.knowledge-node-source-menu {
    top: calc(100% + 8px);
    left: 0;
    min-width: 218px;
    z-index: 25;
}

.knowledge-upload-status {
    min-width: 0;
    max-width: min(320px, 36vw);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.knowledge-upload-status[data-tone="success"] {
    color: #3ddc97;
}

.knowledge-upload-status[data-tone="warning"] {
    color: #f2c94c;
}

.knowledge-upload-status[data-tone="error"] {
    color: #ff6b6b;
}

.knowledge-upload-choice-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.knowledge-outline-modal {
    max-width: 680px;
    max-height: min(760px, 88vh);
}

.knowledge-outline-search-row {
    margin-bottom: 10px;
}

.knowledge-outline-search {
    width: 100%;
}

.knowledge-outline-loading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.knowledge-outline-loading-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.knowledge-outline-loading-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 6px currentColor;
    opacity: 0.25;
    animation: knowledge-outline-loading-dot 1.05s infinite ease-in-out;
}

.knowledge-outline-loading-dots span:nth-child(2) {
    animation-delay: 0.16s;
}

.knowledge-outline-loading-dots span:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes knowledge-outline-loading-dot {
    0%,
    80%,
    100% {
        opacity: 0.25;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

.knowledge-outline-tree {
    display: grid;
    gap: 6px;
    max-height: min(520px, 62vh);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
}

.knowledge-outline-children {
    display: grid;
    gap: 6px;
    margin-top: 6px;
}

.knowledge-outline-node[hidden],
.knowledge-outline-children[hidden] {
    display: none !important;
}

.knowledge-outline-item {
    display: grid;
    grid-template-columns: 24px 20px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-height: 36px;
    padding: 7px 9px 7px calc(9px + var(--outline-depth, 0) * 18px);
    border: 1px solid var(--border-faint);
    border-radius: var(--radius-sm);
    background: rgba(9, 22, 38, 0.68);
    color: var(--text-primary);
    cursor: pointer;
}

.knowledge-outline-expand {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: var(--radius-sm);
    background: rgba(0, 212, 255, 0.06);
    color: var(--accent-cyan);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.knowledge-outline-expand.is-spacer {
    visibility: hidden;
    pointer-events: none;
}

.knowledge-outline-check {
    position: relative;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.knowledge-outline-check input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.knowledge-outline-check span {
    width: 20px;
    height: 20px;
    border: 1px solid var(--border-mid);
    border-radius: 0;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.knowledge-outline-check input:checked + span,
.knowledge-outline-check input:indeterminate + span {
    border-color: var(--accent-primary);
    background: rgba(0, 180, 255, 0.1);
    box-shadow: var(--glow-sm);
}

.knowledge-outline-check input:checked + span::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 4px;
    width: 10px;
    height: 8px;
    border-left: 2px solid var(--accent-bright);
    border-bottom: 2px solid var(--accent-bright);
    transform: rotate(-45deg) translateY(-2px);
}

.knowledge-outline-check input:indeterminate + span::after {
    content: "";
    position: absolute;
    left: 4px;
    right: 4px;
    top: 8px;
    height: 2px;
    background: #e8fbff;
}

.knowledge-outline-item-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.knowledge-outline-item small {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 10px;
}

.memory-canvas-shell.is-knowledge-drag-over::after {
    content: "Перетащите файлы в базу знаний";
    position: absolute;
    inset: 16px;
    z-index: 5;
    border: 1px dashed rgba(61, 220, 151, 0.82);
    border-radius: 10px;
    background: rgba(3, 15, 18, 0.7);
    color: var(--text-primary);
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 13px;
    pointer-events: none;
}

.memory-page-grid {
    display: grid;
    grid-template-columns: minmax(280px, 0.75fr) minmax(360px, 1fr);
    grid-template-areas:
        "docs search"
        "graph graph"
        "history history";
    gap: 14px;
}

.memory-page-grid-role {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: none;
    padding: 0 clamp(14px, 2vw, 30px) 24px;
}

.memory-role-data-grid {
    align-items: start;
}

.memory-role-column {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.memory-page-grid-role .memory-panel {
    grid-area: auto;
}

.memory-panel-wide {
    grid-column: 1 / -1;
}

.memory-panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.memory-panel-subtitle {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.4;
}

.memory-panel-sticky {
    position: sticky;
    top: 10px;
}

.memory-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-faint);
}

.memory-modal-title,
.memory-panel-title {
    font-family: var(--font-mono);
    color: var(--text-primary);
    letter-spacing: 0;
}

.memory-modal-title {
    font-size: 14px;
}

.memory-modal-subtitle {
    margin-top: 5px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.memory-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 20px 20px;
    flex: 0 0 auto;
}

.memory-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 20px;
}

.memory-modal-grid {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 16px 20px;
    display: grid;
    grid-template-columns: minmax(340px, 1fr) minmax(420px, 1.2fr);
    grid-template-areas:
        "search graph"
        "docs history";
    gap: 14px;
}

.memory-panel {
    min-width: 0;
    border: 1px solid var(--border-faint);
    border-radius: var(--radius-md);
    background: rgba(8, 18, 34, 0.55);
    padding: 14px;
}

.memory-panel-graph-full {
    position: relative;
    flex: 1 1 auto;
    min-height: calc(100vh - 156px);
    padding-top: 56px;
    display: flex;
    flex-direction: column;
}

.memory-panel-search { grid-area: search; }
.memory-panel-graph { grid-area: graph; }
.memory-panel-docs { grid-area: docs; }
.memory-panel-history { grid-area: history; }

.memory-panel-title {
    margin-bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    padding: 3px 9px;
    border: 1px solid rgba(111, 201, 255, 0.2);
    border-radius: var(--radius-sm);
    background: rgba(0, 212, 255, 0.06);
    color: var(--text-primary);
    font-size: 13px;
    box-shadow: 0 0 18px rgba(0, 212, 255, 0.08);
}

.memory-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.memory-results,
.memory-chunks,
.memory-history-list,
.memory-doc-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.memory-results,
.memory-chunks {
    margin-top: 12px;
    max-height: 380px;
    overflow: auto;
}

.memory-search-modal .memory-results {
    flex: 1;
    min-height: 0;
    max-height: none;
}

.memory-document-chunks {
    max-height: min(74vh, 780px);
    padding: 16px 20px 20px;
}

.memory-info-note {
    margin: 12px 20px 0;
    padding: 10px 12px;
    border: 1px solid rgba(111, 201, 255, 0.22);
    border-radius: var(--radius-sm);
    background: rgba(111, 201, 255, 0.07);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
}

.memory-empty {
    padding: 12px;
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.5;
}

.memory-how {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(111, 201, 255, 0.08);
    border: 1px solid rgba(111, 201, 255, 0.2);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.5;
}

.memory-how-title {
    color: var(--text-primary);
    margin-bottom: 4px;
}

.memory-result,
.memory-chunk,
.memory-history-row {
    padding: 12px;
    border: 1px solid var(--border-faint);
    border-radius: var(--radius-sm);
    background: rgba(10, 22, 40, 0.68);
}

.memory-result-head,
.memory-history-head,
.memory-chunk-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 11px;
}

.memory-result-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.memory-result-score {
    margin-top: 7px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.memory-result-score:empty {
    display: none;
}

.memory-match-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 4px 9px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.memory-match-badge-exact {
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 212, 255, 0.42);
    background: rgba(0, 212, 255, 0.09);
    box-shadow: 0 0 18px rgba(0, 212, 255, 0.18);
}

.memory-match-badge-text {
    color: var(--accent-green);
    border: 1px solid rgba(80, 220, 150, 0.42);
    background: rgba(80, 220, 150, 0.09);
    box-shadow: 0 0 18px rgba(80, 220, 150, 0.16);
}

.memory-match-badge-semantic {
    color: var(--accent-amber);
    border: 1px solid rgba(255, 196, 87, 0.42);
    background: rgba(255, 196, 87, 0.09);
    box-shadow: 0 0 18px rgba(255, 196, 87, 0.16);
}

.memory-result-fragment {
    color: var(--text-muted);
    font-size: 10px;
}

.memory-result-tags span {
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(111, 201, 255, 0.1);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 10px;
}

.memory-result-text,
.memory-chunk-text,
.memory-history-query,
.memory-history-sources {
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.memory-result-text .workspace-preview-markdown,
.memory-chunk-text .workspace-preview-markdown,
.memory-full-text .workspace-preview-markdown {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.65;
}

.memory-result-text a,
.memory-chunk-text a,
.memory-full-text a,
.role-memory-page .workspace-preview-html a,
.memory-page .workspace-preview-html a {
    color: #8be8ff;
    text-decoration-color: rgba(139, 232, 255, 0.58);
    text-underline-offset: 3px;
}

.memory-result-text a:hover,
.memory-chunk-text a:hover,
.memory-full-text a:hover,
.role-memory-page .workspace-preview-html a:hover,
.memory-page .workspace-preview-html a:hover {
    color: #c6f6ff;
    text-shadow: 0 0 14px rgba(0, 212, 255, 0.42);
}

.workspace-preview-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    margin: 10px 0 14px;
    border: 1px solid rgba(111, 201, 255, 0.16);
    border-radius: var(--radius-sm);
    background: rgba(5, 12, 22, 0.34);
}

.memory-result-text .workspace-preview-markdown table,
.memory-chunk-text .workspace-preview-markdown table,
.memory-full-text .workspace-preview-markdown table {
    width: max-content;
    min-width: 100%;
    margin: 0;
    border-collapse: collapse;
    white-space: normal;
}

.memory-result-text .workspace-preview-markdown th,
.memory-result-text .workspace-preview-markdown td,
.memory-chunk-text .workspace-preview-markdown th,
.memory-chunk-text .workspace-preview-markdown td,
.memory-full-text .workspace-preview-markdown th,
.memory-full-text .workspace-preview-markdown td {
    min-width: 120px;
    vertical-align: top;
    overflow-wrap: anywhere;
    word-break: normal;
}

.memory-result-text pre,
.memory-chunk-text pre,
.memory-full-text pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.memory-doc-row {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    padding: 10px 12px;
    border: 1px solid var(--border-faint);
    border-radius: var(--radius-sm);
    background: rgba(10, 22, 40, 0.68);
    cursor: pointer;
    text-align: left;
}

.memory-doc-row:hover {
    border-color: var(--border-subtle);
}

.memory-doc-tree-group {
    display: grid;
    gap: 7px;
    min-width: 0;
    max-width: 100%;
    padding-left: min(calc(var(--doc-depth, 0) * 10px), 34px);
    box-sizing: border-box;
}

.memory-doc-tree-group summary {
    min-height: 34px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid rgba(111, 201, 255, 0.16);
    border-radius: var(--radius-sm);
    background: rgba(9, 23, 39, 0.72);
    color: var(--text-primary);
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 11px;
    list-style: none;
}

.memory-doc-tree-group summary::-webkit-details-marker {
    display: none;
}

.memory-doc-tree-group summary::before {
    content: "›";
    color: var(--accent-cyan);
    margin-right: 6px;
}

.memory-doc-tree-group[open] summary::before {
    content: "⌄";
}

.memory-doc-tree-group summary span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.memory-doc-tree-group summary small {
    color: var(--text-muted);
    font-size: 10px;
}

.memory-doc-tree-children {
    display: grid;
    gap: 7px;
    min-width: 0;
    max-width: 100%;
    padding-left: 10px;
    box-sizing: border-box;
}

.memory-doc-row-tree {
    margin-left: 0;
    padding-left: calc(12px + min(calc(var(--doc-depth, 0) * 8px), 30px));
    max-width: 100%;
    box-sizing: border-box;
}

.memory-doc-row-compact {
    margin-top: 8px;
    padding: 8px 10px;
}

.memory-doc-name {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 11px;
    overflow-wrap: anywhere;
}

.memory-doc-meta,
.memory-legend {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.4;
}

.memory-graph {
    position: relative;
    flex: 1 1 auto;
    height: auto;
    min-height: calc(100vh - 318px);
    border: 1px solid var(--border-faint);
    border-radius: var(--radius-sm);
    background: rgba(5, 12, 22, 0.52);
    overflow: auto;
    cursor: default;
}

.memory-graph-stage {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
}

.memory-doc-dock {
    position: absolute;
    top: 14px;
    right: 14px;
    width: min(380px, 34vw);
    max-height: calc(100% - 28px);
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border: 1px solid rgba(111, 201, 255, 0.18);
    border-radius: var(--radius-md);
    background: rgba(8, 18, 34, 0.88);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
    z-index: 3;
}

.memory-dock-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.memory-dock-toggle {
    min-width: 34px;
    width: auto;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 0 0 auto;
    border: 1px solid rgba(0, 210, 255, 0.35);
    border-radius: var(--radius-sm);
    color: var(--accent-cyan);
    background: rgba(0, 210, 255, 0.08);
    box-shadow: 0 0 18px rgba(0, 210, 255, 0.12);
    cursor: pointer;
}

.memory-dock-toggle:hover {
    border-color: rgba(0, 210, 255, 0.7);
    box-shadow: 0 0 22px rgba(0, 210, 255, 0.24);
}

.memory-dock-toggle-icon {
    display: inline-block;
    transform: rotate(0deg);
    transition: transform 0.16s ease;
    font-size: 18px;
    line-height: 1;
}

.memory-dock-toggle-doc {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.memory-doc-dock.is-collapsed {
    width: 64px;
    min-height: 54px;
    padding: 11px;
    overflow: hidden;
}

.memory-doc-dock.is-collapsed .memory-dock-head {
    justify-content: center;
}

.memory-doc-dock.is-collapsed .memory-dock-head > div,
.memory-doc-dock.is-collapsed .memory-doc-list {
    display: none;
}

.memory-doc-dock.is-collapsed .memory-dock-toggle-icon {
    transform: rotate(180deg);
}

.memory-doc-dock .memory-doc-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 12px 10px 10px;
    border: 1px solid rgba(111, 201, 255, 0.14);
    border-radius: var(--radius-sm);
    background: rgba(5, 12, 22, 0.44);
    box-sizing: border-box;
}

.memory-graph.is-dragging {
    cursor: grabbing;
}

.memory-force-graph {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: inherit;
}

.memory-force-graph canvas {
    display: block;
}

.memory-force-controls {
    position: absolute;
    left: 12px;
    top: 12px;
    z-index: 4;
    display: grid;
    gap: 8px;
    width: min(330px, calc(100% - 24px));
    padding: 10px 12px;
    border: 1px solid rgba(0, 212, 255, 0.28);
    background: rgba(8, 18, 34, 0.9);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    pointer-events: auto;
}

.memory-force-controls-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.memory-force-controls-title {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.memory-force-controls-body {
    display: grid;
    gap: 8px;
}

.memory-force-controls.is-collapsed {
    width: 64px;
    min-height: 54px;
    padding: 11px;
    overflow: hidden;
}

.memory-force-controls.is-collapsed .memory-force-controls-title,
.memory-force-controls.is-collapsed .memory-force-controls-body {
    display: none;
}

.memory-force-controls.is-collapsed .memory-force-controls-head {
    justify-content: center;
}

.memory-force-controls.is-collapsed .memory-dock-toggle-icon {
    transform: rotate(180deg);
}

.memory-force-control-row {
    display: grid;
    grid-template-columns: 78px minmax(96px, 1fr) 64px;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.memory-force-control-label {
    color: var(--text-secondary);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.memory-force-control-slider {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    min-width: 0;
    height: 18px;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.memory-force-control-slider::-webkit-slider-runnable-track {
    height: 6px;
    border: 1px solid rgba(0, 212, 255, 0.28);
    background: linear-gradient(90deg, rgba(0, 180, 255, 0.44), rgba(12, 31, 52, 0.96));
    box-shadow: inset 0 0 8px rgba(0, 212, 255, 0.16);
}

.memory-force-control-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    margin-top: -5px;
    border: 1px solid var(--accent-bright);
    border-radius: 0;
    background: var(--accent-primary);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.72);
}

.memory-force-control-slider::-moz-range-track {
    height: 6px;
    border: 1px solid rgba(0, 212, 255, 0.28);
    background: linear-gradient(90deg, rgba(0, 180, 255, 0.44), rgba(12, 31, 52, 0.96));
    box-shadow: inset 0 0 8px rgba(0, 212, 255, 0.16);
}

.memory-force-control-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border: 1px solid var(--accent-bright);
    border-radius: 0;
    background: var(--accent-primary);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.72);
}

.memory-force-control-slider:focus-visible {
    outline: 1px solid var(--accent-bright);
    outline-offset: 3px;
}

.memory-force-control-number {
    width: 64px;
    min-width: 0;
    padding: 5px 7px;
    border: 1px solid rgba(0, 212, 255, 0.28);
    background: rgba(8, 18, 34, 0.82);
    color: var(--text-primary);
    font: inherit;
    font-size: 12px;
}

.memory-graph-controls {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.memory-graph-controls button {
    min-width: 28px;
    height: 28px;
    padding: 0 9px;
    border: 1px solid var(--border-faint);
    border-radius: var(--radius-sm);
    background: rgba(10, 22, 40, 0.86);
    color: var(--text-primary);
    cursor: pointer;
}

.memory-graph-tooltip {
    position: absolute;
    z-index: 7;
    display: none;
    max-width: 320px;
    padding: 10px 12px;
    border: 1px solid rgba(111, 201, 255, 0.28);
    border-radius: var(--radius-sm);
    background: rgba(8, 18, 34, 0.96);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.45;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.42);
    pointer-events: none;
}

.memory-graph-tooltip strong {
    color: var(--text-primary);
    font-weight: 600;
}

.memory-graph-selection {
    position: absolute;
    left: 22px;
    bottom: 42px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(560px, calc(100% - 460px));
    max-height: min(230px, 42%);
    overflow: hidden;
    padding: 10px;
    border: 1px solid rgba(111, 201, 255, 0.18);
    border-radius: var(--radius-sm);
    background: rgba(8, 18, 34, 0.88);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.32);
    z-index: 4;
    pointer-events: auto;
}

.memory-graph-selection:empty {
    display: none;
}

.memory-graph-selection-head {
    flex: 0 0 auto;
    width: fit-content;
    max-width: 100%;
    padding: 7px 10px;
    border: 1px solid rgba(0, 210, 255, 0.26);
    border-radius: var(--radius-sm);
    background: rgba(0, 210, 255, 0.08);
}

.memory-graph-selection-title {
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.memory-graph-selection-body {
    min-height: 0;
    overflow: auto;
    display: grid;
    gap: 8px;
    padding-right: 6px;
}

.memory-graph-selection-meta {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}

.memory-legend {
    margin-top: 8px;
}

.memory-graph-svg {
    width: 100%;
    height: 100%;
}

.memory-graph-svg line,
.memory-graph-svg path.memory-graph-edge {
    stroke: rgba(111, 201, 255, 0.28);
    stroke-width: 2;
    fill: none;
    vector-effect: non-scaling-stroke;
}

.memory-graph-svg .memory-graph-edge-hit {
    stroke: transparent !important;
    stroke-width: 44;
    pointer-events: stroke;
}

.memory-graph-svg .memory-graph-edge-visible {
    pointer-events: none;
}

.memory-graph-svg .memory-graph-edge-hierarchy {
    stroke: rgba(111, 201, 255, 0.34);
}

.memory-graph-svg .memory-graph-edge-topic,
.memory-graph-svg .memory-graph-edge-usage,
.memory-graph-svg .memory-graph-edge-reference {
    stroke: rgba(255, 196, 87, 0.38);
    stroke-dasharray: 4 5;
}

.memory-graph-svg .memory-graph-edge.hovered {
    stroke: var(--accent-amber);
    stroke-width: 3;
}

.memory-graph-svg .memory-graph-edge.path-highlight {
    stroke: rgba(0, 212, 255, 0.82);
    stroke-width: 3;
}

.memory-graph-svg .memory-graph-edge-hit.hovered {
    stroke: transparent !important;
    stroke-width: 44;
}

.memory-graph-svg .memory-graph-edge-hit.path-highlight {
    stroke: transparent !important;
    stroke-width: 44;
}

.memory-graph-svg text {
    fill: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 9px;
    text-anchor: middle;
}

.memory-graph-node circle {
    fill: rgba(18, 63, 66, 0.95);
    stroke: rgba(111, 201, 255, 0.6);
    stroke-width: 1.4;
    filter: drop-shadow(0 0 12px rgba(0, 212, 255, 0.36));
}

.memory-graph-node {
    cursor: pointer;
}

.memory-graph-node:hover circle {
    stroke: rgba(0, 212, 255, 0.92);
    filter: drop-shadow(0 0 14px rgba(0, 212, 255, 0.42));
}

.memory-graph-node.path-highlight circle {
    stroke: rgba(0, 212, 255, 0.9);
    stroke-width: 2.1;
    filter: drop-shadow(0 0 16px rgba(0, 212, 255, 0.5));
}

.memory-graph-node.selected circle {
    stroke: var(--accent-amber);
    stroke-width: 2.4;
    filter: drop-shadow(0 0 8px rgba(255, 196, 87, 0.35));
}

.memory-graph-node-source circle {
    fill: rgba(66, 82, 108, 0.96);
}

.memory-graph-node-project circle {
    fill: rgba(25, 59, 99, 0.96);
}

.memory-graph-node-folder circle {
    fill: rgba(44, 61, 78, 0.96);
}

.memory-graph-node-role circle {
    fill: rgba(84, 65, 109, 0.96);
}

.memory-fact-grid {
    display: grid;
    gap: 8px;
}

.memory-fact-grid div {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 10px;
    align-items: baseline;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-faint);
}

.memory-fact-grid span,
.memory-section-meta {
    color: var(--text-muted);
    font-size: 11px;
}

.memory-fact-grid strong,
.memory-section-title {
    min-width: 0;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.memory-section-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.memory-section-row {
    padding: 10px 12px;
    border: 1px solid var(--border-faint);
    border-radius: var(--radius-sm);
    background: rgba(10, 22, 40, 0.5);
}

.memory-full-text {
    max-height: 560px;
    overflow: auto;
    padding-right: 4px;
}

.role-memory-page .memory-full-text,
.role-memory-page .memory-chunks,
.role-memory-page .memory-section-list,
.role-memory-page .memory-history-list {
    border: 1px solid rgba(111, 201, 255, 0.18);
    border-radius: var(--radius-sm);
    background: rgba(5, 12, 22, 0.4);
    padding: 10px;
}

.role-memory-page .memory-panel-docs {
    display: flex;
    min-height: 0;
    flex-direction: column;
}

.role-memory-page .memory-panel-title {
    font-size: 14px;
    padding: 5px 10px;
}

.role-memory-page .memory-section-list,
.role-memory-page .memory-history-list {
    flex: 1 1 auto;
    max-height: 560px;
    overflow: auto;
}

.role-memory-page .memory-panel-full-text .memory-full-text {
    flex: 1 1 auto;
    max-height: none;
}

.role-memory-page .memory-role-data-grid {
    align-items: stretch;
}

.role-memory-page .memory-role-column {
    height: 100%;
}

.role-memory-page .memory-panel-full-text {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
    flex-direction: column;
}

@media (max-width: 980px) {
    .memory-modal-content,
    .memory-search-modal,
    .memory-history-modal,
    .memory-document-modal {
        width: min(96vw, 760px);
        max-height: 94vh;
    }

    .memory-page-header {
        align-items: flex-start;
        flex-wrap: wrap;
        padding: 12px;
    }

    .memory-canvas-shell {
        min-height: auto;
    }

    .memory-canvas-actions {
        position: static;
        margin: 0 12px 10px;
        flex-wrap: wrap;
    }

    .memory-panel-graph-full {
        min-height: auto;
        padding-top: 14px;
    }

    #screen-projects.memory-project-open .memory-panel-graph-full {
        min-height: 0;
    }

    .memory-graph-stage {
        flex-direction: column;
    }

    .memory-graph {
        height: 480px;
        min-height: 360px;
        width: 100%;
    }

    #screen-projects.memory-project-open .memory-graph {
        height: 100%;
        min-height: 0;
    }

    .memory-doc-dock {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        max-height: 340px;
        margin-top: 12px;
    }

    #screen-projects.memory-project-open .memory-doc-dock {
        position: absolute;
        top: 12px;
        right: 12px;
        width: min(320px, calc(100% - 24px));
        max-height: min(340px, calc(100% - 24px));
        margin-top: 0;
    }

    #screen-projects.memory-project-open .memory-doc-dock.is-collapsed {
        width: 58px;
    }

    .memory-graph-selection {
        left: 18px;
        right: 18px;
        bottom: 38px;
        width: auto;
        max-height: min(210px, 40%);
    }

    .memory-page-grid,
    .memory-page-grid-role {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: none;
        padding: 0 12px 20px;
    }

    .memory-role-data-grid {
        gap: 14px;
    }

    .memory-page-grid .memory-panel,
    .memory-page-grid-role .memory-panel {
        grid-area: auto;
    }

    .memory-search-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .memory-page-title {
        font-size: 14px;
    }

    .memory-page-back {
        width: 100%;
    }

    .memory-modal-body {
        padding: 12px;
    }

    .memory-info-note {
        margin: 10px 12px 0;
    }

    .memory-result-head,
    .memory-history-head,
    .memory-chunk-head {
        display: grid;
        gap: 4px;
    }
}

.project-card-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(10, 22, 40, 0.3);
    border-radius: var(--radius-sm);
}

.project-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.project-status-indicator.indexed {
    background: var(--accent-green);
    box-shadow: 0 0 8px var(--accent-green);
}

.project-status-indicator.indexing {
    background: var(--accent-amber);
    box-shadow: 0 0 8px var(--accent-amber);
    animation: pulse 1.5s ease-in-out infinite;
}

.project-status-indicator.not-indexed {
    background: var(--text-disabled);
}

.project-status-indicator.error {
    background: var(--accent-red);
    box-shadow: 0 0 8px var(--accent-red);
}

.project-status-text {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
    flex: 1;
}

/* Spinner for indexing */
.project-status-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--accent-amber);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

/* Show spinner when card has indexing class */
.project-card.indexing .project-card-status {
    position: relative;
}

.project-card.indexing .project-status-indicator {
    display: none;
}

.project-card.indexing .project-card-status::before {
    content: '';
    width: 15px;
    height: 15px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--accent-amber);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
    margin-right: 8px;
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.project-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: auto;
}

.project-actions .btn {
    min-width: 0;
    padding: 6px 10px !important;
    font-size: 10px !important;
    text-decoration: none;
}

.project-actions .btn span {
    text-decoration: none;
}

.card-indexing-progress {
    width: 100%;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid rgba(0, 212, 255, 0.28);
    border-radius: 6px;
    background: rgba(0, 212, 255, 0.08);
    box-shadow: inset 0 0 18px rgba(0, 212, 255, 0.05);
}

.card-indexing-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    font-family: var(--font-mono);
}

.card-indexing-title {
    color: var(--accent-primary);
    font-size: 11px;
    letter-spacing: 0;
}

.card-indexing-count {
    color: var(--text-secondary);
    font-size: 11px;
    white-space: nowrap;
}

.card-indexing-track {
    width: 100%;
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(111, 201, 255, 0.12);
}

.card-indexing-fill {
    height: 100%;
    min-width: 5%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-green));
    box-shadow: 0 0 14px rgba(0, 212, 255, 0.35);
    transition: width 420ms ease;
}

.card-indexing-current {
    margin-top: 7px;
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.35;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.projects-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-faint);
    display: flex;
    gap: 8px;
}

.empty-state {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 12px;
}

/* Projects Cache Cards */
.projects-cache-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-faint);
    border-radius: var(--radius-md);
    padding: 14px;
    transition: var(--transition);
}

.projects-cache-card:hover {
    border-color: var(--border-subtle);
}

.projects-cache-card-header {
    margin-bottom: 12px;
}

.projects-cache-card-title {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
}

.projects-cache-card-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.projects-cache-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.projects-cache-stat-label {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.projects-cache-stat-value {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.projects-cache-card-actions {
    display: flex;
    gap: 6px;
}

@media (max-width: 900px) {
    #add-project-modal .btn {
        font-size: 8px;
        letter-spacing: 0.08em;
        line-height: 1.15;
    }

    #add-project-modal .project-modal-actions {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px !important;
        justify-content: stretch !important;
    }

    #add-project-modal .project-modal-actions .btn {
        width: 100%;
        min-width: 0;
        justify-content: center;
        padding-inline: 8px;
    }

    #add-project-modal #project-local-folder-group .btn {
        min-width: 0;
        padding-inline: 10px;
    }

    .projects-list {
        grid-template-columns: 1fr;
        padding: 0 12px;
    }

    .project-card {
        min-width: 0;
        width: 100%;
    }

    .project-card-top,
    .project-meta-row {
        flex-wrap: wrap;
    }

    .project-meta-key {
        min-width: 0;
    }

    .projects-footer .btn,
    .projects-cache-card-actions .btn {
        min-width: 0;
        width: 100%;
    }

    .project-actions {
        gap: 8px;
    }

    .project-actions .btn {
        min-width: 0;
        max-width: 100%;
    }

    .projects-footer,
    .projects-cache-card-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .memory-page,
    .memory-canvas-shell,
    .memory-panel,
    .memory-page-grid,
    .memory-page-grid-role,
    .memory-full-text,
    .memory-chunk-text,
    .memory-section-row,
    .memory-section-meta,
    .workspace-preview-html {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .memory-page {
        overflow-x: hidden;
    }

    .memory-panel-toolbar {
        align-items: flex-start;
        gap: 10px;
    }

    .memory-graph-controls {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .memory-graph-controls button {
        width: auto;
        min-width: 34px;
        padding-inline: 8px;
    }

    .memory-section-row,
    .memory-section-meta {
        white-space: normal;
    }

    .role-memory-page .workspace-preview-html,
    .role-memory-page .workspace-preview-html *:not(table):not(thead):not(tbody):not(tr):not(th):not(td) {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}
