/* client/public/css/style.css */

:root {
    color-scheme: dark;

    --bg: #060607;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-2: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: rgba(255, 255, 255, 0.88);
    --muted-text: rgba(255, 255, 255, 0.62);

    --accent: #a178ff;
    --accent-2: #ff7ad9;
    --success: #41d27a;
    --warning: #ffc857;
    --danger: #ff5c5c;

    --message-user-bg: rgba(161, 120, 255, 0.14);
    --message-assistant-bg: rgba(255, 255, 255, 0.04);
    --message-system-bg: rgba(255, 92, 92, 0.16);

    --shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
    --radius: 14px;
    --radius-sm: 10px;
    --content-max-width: 980px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.55;
    color: var(--text);
    background:
        radial-gradient(900px 600px at 15% 0%, rgba(161, 120, 255, 0.12), transparent 55%),
        radial-gradient(700px 500px at 85% 0%, rgba(255, 122, 217, 0.10), transparent 55%),
        var(--bg);
}

.chat-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: 100vh;
    margin: 0;
}

.chat-list {
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(14px);
    border-right: 1px solid var(--border);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
    height: 100vh;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(161, 120, 255, 0.6) transparent;
}

.chat-main {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.panel {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.panel-header h2 {
    font-size: 0.95rem;
    font-weight: 650;
    margin: 0;
}

.panel-body {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: hidden;
    max-height: 1000px;
    opacity: 1;
    transition: max-height 220ms ease, opacity 180ms ease, margin-top 220ms ease;
}

.panel--collapsed .panel-body {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    pointer-events: none;
}

.panel-help {
    color: var(--muted-text);
    font-size: 0.85rem;
    line-height: 1.35;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.upload-form input[type='file'] {
    width: 100%;
    color: var(--text);
    font-size: 0.9rem;
}

.document-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.document-item {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.document-item:hover {
    transform: translateY(-1px);
    border-color: rgba(161, 120, 255, 0.35);
}

.document-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.document-filename {
    font-size: 0.9rem;
    font-weight: 650;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge {
    font-size: 0.75rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted-text);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge.ready {
    color: rgba(65, 210, 122, 0.95);
    border-color: rgba(65, 210, 122, 0.35);
}

.badge.processing {
    color: rgba(255, 200, 87, 0.95);
    border-color: rgba(255, 200, 87, 0.35);
}

.badge.failed {
    color: rgba(255, 92, 92, 0.95);
    border-color: rgba(255, 92, 92, 0.35);
}

.document-meta {
    font-size: 0.8rem;
    color: var(--muted-text);
    overflow-wrap: anywhere;
}

.document-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Chat list scrollbar (Webkit browsers) */
.chat-list::-webkit-scrollbar {
    width: 6px;
}

.chat-list::-webkit-scrollbar-track {
    background: transparent;
}

.chat-list::-webkit-scrollbar-thumb {
    background-color: rgba(161, 120, 255, 0.6);
    border-radius: 3px;
}

.session-button {
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
    transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
    margin: 0 0 5px;
    width: 100%;
}

.session-button:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(161, 120, 255, 0.35);
}

.history-panel #sessions {
    margin-top: 0.5rem;
}

#messages {
    flex-grow: 1;
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    width: min(var(--content-max-width), calc(100% - 2rem));
    padding: 1rem 1.05rem;
    border-radius: var(--radius);
    margin: 0.15rem auto;
    align-self: center !important;
    position: relative;
    border: 1px solid var(--border);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
    transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.message-content {
    overflow-wrap: anywhere;
}

.message.assistant .message-content {
    white-space: normal;
}

.message.assistant .message-content p {
    margin: 0.2rem 0 0.75rem;
}

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

.message.assistant .message-content a {
    color: rgba(161, 120, 255, 0.95);
    text-decoration: none;
    border-bottom: 1px solid rgba(161, 120, 255, 0.35);
}

.message.assistant .message-content a:hover {
    border-bottom-color: rgba(255, 122, 217, 0.55);
}

.message.assistant .message-content ul,
.message.assistant .message-content ol {
    padding-left: 1.3rem;
    margin: 0.35rem 0 0.75rem;
}

.message.assistant .message-content li {
    margin: 0.15rem 0;
}

.message.assistant .message-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    font-size: 0.92em;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.08rem 0.35rem;
    border-radius: 8px;
}

.message.assistant .message-content pre {
    margin: 0.45rem 0 0.85rem;
    padding: 0.85rem 0.95rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(0, 0, 0, 0.45);
    overflow: auto;
}

.message.assistant .message-content pre code {
    background: transparent;
    border: none;
    padding: 0;
}

.message.assistant .message-content blockquote {
    margin: 0.45rem 0 0.85rem;
    padding: 0.1rem 0.9rem;
    border-left: 3px solid rgba(161, 120, 255, 0.45);
    color: rgba(255, 255, 255, 0.78);
}

.message.assistant .message-content hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
    margin: 0.85rem 0;
}

.message.assistant .message-content h1,
.message.assistant .message-content h2,
.message.assistant .message-content h3 {
    margin: 0.65rem 0 0.55rem;
    line-height: 1.15;
}

/* Message meta + actions */
.message__meta {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 0;
    margin: 0;
}

.message__actions {
    display: flex;
    gap: 0.35rem;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    transition: opacity 140ms ease;
}

.message:hover .message__actions,
.message:focus-within .message__actions {
    opacity: 1;
    pointer-events: auto;
}

.message--pinned {
    border-color: rgba(161, 120, 255, 0.55);
}

.message--pending .message__actions {
    display: none;
}

/* Pinned bar */
.pinned {
    width: min(var(--content-max-width), calc(100% - 2rem));
    margin: 1rem auto 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(10, 10, 12, 0.55);
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
    padding: 0.75rem;
}

.pinned__header {
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted-text);
    font-weight: 650;
    margin-bottom: 0.5rem;
}

.pinned__list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.pinned__item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem 0.55rem;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
}

.pinned__label {
    color: var(--text);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Welcome screen */
.welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2.2rem 1.5rem 1.5rem;
    text-align: center;
}

.welcome__title {
    font-size: clamp(1.9rem, 3.2vw, 3rem);
    font-weight: 850;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, rgba(161, 120, 255, 1), rgba(255, 122, 217, 0.95));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 0.6rem;
}

.welcome__subtitle {
    color: rgba(255, 255, 255, 0.72);
    font-size: 1.05rem;
    max-width: 52ch;
    margin-bottom: 1.15rem;
}

.welcome__actions {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 1.2rem;
}

.welcome__tips {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    justify-content: center;
    color: var(--muted-text);
    font-size: 0.92rem;
}

.welcome__tip {
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.04);
}

.welcome__kbd {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    font-size: 0.9em;
    padding: 0.05rem 0.35rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.85);
}

/* Command palette */
.palette {
    position: fixed;
    inset: 0;
    z-index: 30;
}

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

.palette__panel {
    position: relative;
    width: min(820px, calc(100vw - 28px));
    margin: 10vh auto 0;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(12, 12, 16, 0.90);
    box-shadow: var(--shadow);
    padding: 0.85rem;
}

.palette__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.palette__title {
    font-weight: 750;
    letter-spacing: 0.01em;
}

.palette__hint {
    color: var(--muted-text);
    font-size: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.2rem 0.45rem;
    border-radius: 8px;
}

.palette__input {
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.35);
    padding: 0.75rem 0.9rem;
    color: var(--text);
    font-size: 1rem;
    outline: none;
}

.palette__input:focus {
    border-color: rgba(161, 120, 255, 0.45);
    box-shadow: 0 0 0 3px rgba(161, 120, 255, 0.2);
}

.palette__results {
    margin-top: 0.8rem;
    max-height: min(56vh, 560px);
    overflow: auto;
}

.palette__empty {
    color: var(--muted-text);
    font-size: 0.95rem;
    padding: 0.7rem 0.2rem;
}

.palette__results-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

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

.palette__list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.palette__item {
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius);
    padding: 0.75rem;
}

.palette__item-title {
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.palette__item-snippet {
    color: var(--muted-text);
    font-size: 0.92rem;
    margin-bottom: 0.55rem;
    overflow-wrap: anywhere;
}

.palette__item-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.message.user {
    background: var(--message-user-bg);
    color: var(--text);
}

.message.assistant {
    background: var(--message-assistant-bg);
    color: var(--text);
}

.message.system {
    background: var(--message-system-bg);
    color: var(--text);
    align-self: center;
}

.input-area {
    padding: 0.95rem 1.1rem;
    background: rgba(10, 10, 12, 0.55);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius);
    display: flex;
    gap: 1rem;
    width: min(var(--content-max-width), calc(100% - 2rem));
    margin: 0 auto 1rem;
    align-items: flex-start;
    backdrop-filter: blur(16px);
}

.attachments-area {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    min-width: 180px;
    max-width: 320px;
}

.attachment-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    max-width: 320px;
}

.attachment-chip .label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-chip button {
    padding: 0.1rem 0.4rem;
    background: transparent;
    color: var(--muted-text);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.attachment-chip button:hover {
    color: var(--text);
    border-color: rgba(161, 120, 255, 0.35);
}

.attachment-chip--ready {
    border-color: rgba(65, 210, 122, 0.35);
}

.attachment-chip--processing {
    border-color: rgba(255, 200, 87, 0.35);
}

.attachment-chip--failed {
    border-color: rgba(255, 92, 92, 0.35);
}

.hidden {
    display: none !important;
}

#message-input {
    flex-grow: 1;
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    background: rgba(0, 0, 0, 0.35);
    color: var(--text);
}

#message-input:focus {
    outline: none;
    border-color: rgba(161, 120, 255, 0.45);
    box-shadow: 0 0 0 3px rgba(161, 120, 255, 0.2);
}

.session-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(161, 120, 255, 0.2);
}

/* Buttons */
.btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 650;
    letter-spacing: 0.01em;
    padding: 0.7rem 1rem;
    transition: transform 120ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease;
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(161, 120, 255, 0.22);
}

.btn-primary {
    border-color: rgba(161, 120, 255, 0.35);
    background: linear-gradient(135deg, rgba(161, 120, 255, 0.95), rgba(255, 122, 217, 0.75));
    box-shadow: 0 14px 34px rgba(161, 120, 255, 0.14);
}

.btn-primary:hover {
    opacity: 0.96;
}

.btn-secondary {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

.btn-secondary:hover {
    border-color: rgba(161, 120, 255, 0.35);
    background: rgba(255, 255, 255, 0.08);
}

.btn-ghost {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.1);
}

.btn-ghost:hover {
    border-color: rgba(161, 120, 255, 0.35);
    background: rgba(255, 255, 255, 0.04);
}

.btn-sm {
    padding: 0.42rem 0.62rem;
    font-weight: 600;
    font-size: 0.85rem;
}

/* Generic scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* Message enter animation */
.message--enter {
    animation: messageIn 180ms ease-out both;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typing dots */
.typing-dots {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.7);
    animation: dotPulse 900ms infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
    animation-delay: 120ms;
}
.typing-dots span:nth-child(3) {
    animation-delay: 240ms;
}

@keyframes dotPulse {
    0%,
    100% {
        transform: translateY(0);
        opacity: 0.45;
    }
    50% {
        transform: translateY(-3px);
        opacity: 0.95;
    }
}

/* Drop overlay */
.drop-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.55);
    border: 1px dashed rgba(161, 120, 255, 0.55);
    border-radius: var(--radius);
    margin: 0.75rem;
    backdrop-filter: blur(10px);
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--text);
    z-index: 5;
    animation: fadeIn 140ms ease-out both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Toasts */
.toast-container {
    position: fixed;
    top: 14px;
    right: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 20;
    width: min(380px, calc(100vw - 28px));
}

.toast {
    position: relative;
    padding: 0.75rem 2.2rem 0.75rem 0.9rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: rgba(12, 12, 16, 0.84);
    box-shadow: var(--shadow);
    animation: toastIn 160ms ease-out both;
    font-size: 0.92rem;
}

.toast--success {
    border-color: rgba(65, 210, 122, 0.35);
}
.toast--warning {
    border-color: rgba(255, 200, 87, 0.35);
}
.toast--error {
    border-color: rgba(255, 92, 92, 0.35);
}

.toast__close {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    color: var(--muted-text);
    cursor: pointer;
}

.toast__close:hover {
    color: var(--text);
    border-color: rgba(161, 120, 255, 0.35);
}

.toast--leaving {
    animation: toastOut 160ms ease-in both;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-6px);
    }
}

/* Skeletons */
.document-item--skeleton {
    position: relative;
    overflow: hidden;
}

.skeleton-line {
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    margin: 8px 0;
}

.skeleton-line--title {
    width: 70%;
    height: 12px;
}

.document-item--skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
    animation: shimmer 1.1s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* Responsive adjustments */
@media (max-width: 860px) {
    .chat-container {
        grid-template-columns: 1fr;
    }

    .chat-list {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* File manager gallery */
.file-manager__upload {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-manager__search {
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.35);
    padding: 0.6rem 0.75rem;
    color: var(--text);
    font-size: 0.92rem;
    outline: none;
}

.file-manager__search:focus {
    border-color: rgba(161, 120, 255, 0.45);
    box-shadow: 0 0 0 3px rgba(161, 120, 255, 0.18);
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.file-card {
    position: relative;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(0, 0, 0, 0.30);
    border-radius: var(--radius);
    padding: 0.65rem 0.65rem 0.6rem;
    cursor: pointer;
    transition: transform 140ms ease, border-color 160ms ease, background 160ms ease;
    color: var(--text);
}

.file-card:hover {
    transform: translateY(-1px);
    border-color: rgba(161, 120, 255, 0.35);
    background: rgba(0, 0, 0, 0.36);
}

.file-card--attached {
    border-color: rgba(65, 210, 122, 0.35);
}

.file-card--attached::after {
    content: 'Attached';
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 750;
    color: rgba(65, 210, 122, 0.95);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(65, 210, 122, 0.35);
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
}

.file-card__top {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 0.6rem;
    align-items: start;
}

.file-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: linear-gradient(135deg, rgba(161, 120, 255, 0.20), rgba(255, 122, 217, 0.12));
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.85);
}

.file-icon svg {
    width: 18px;
    height: 18px;
}

.file-card__title {
    min-width: 0;
}

.file-card__name {
    font-weight: 750;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-card__meta {
    margin-top: 0.1rem;
    font-size: 0.8rem;
    color: var(--muted-text);
}

.file-tooltip {
    position: absolute;
    inset: 0;
    transform: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 130ms ease;
    background: rgba(12, 12, 16, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.7rem 0.75rem;
    z-index: 15;
    color: var(--text);
    line-height: 1.35;
    overflow: auto;
}

.file-card:hover .file-tooltip,
.file-card:focus .file-tooltip,
.file-card:focus-within .file-tooltip {
    opacity: 1;
}

.file-tooltip__title {
    font-weight: 750;
    margin-bottom: 0.35rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-tooltip__line {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.88);
    margin: 0.15rem 0;
}

.file-tooltip__summary {
    margin: 0.5rem 0 0.55rem;
    padding: 0.55rem 0.6rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(0, 0, 0, 0.35);
    white-space: pre-wrap;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.86);
}

.file-tooltip__muted {
    color: var(--muted-text);
}

@media (max-width: 420px) {
    .file-grid {
        grid-template-columns: 1fr;
    }
}
