/* ========================================================================
   ========================= CSS VARIABLES ================================
   ======================================================================== */
:root {
    /* Typography */
    --heading-font: "Inter", sans-serif;
    --body-font: "Open Sans", sans-serif;
    --logo-font: "CeraRoundPro", sans-serif;
    --basic-size: 16px;

    /* Colors */
    --accent-color: #a0055a;
    --gradient-color: linear-gradient(55deg, #740343, #0a0128, #740343);
    --secondary-color: #f2f2f2d1;
    --dark-color: #151e2b;
    --border-color: #c2c8d0;
    --light-gray: #f5f5f5;
    --background-gray: #ececec;

}

/* ========================================================================
   ========================= FONTS & TYPOGRAPHY =========================
   ======================================================================== */
@font-face {
    font-family: 'CeraRoundPro';
    src: url('/fonts/CeraRoundProDEMO-Bold.otf') format('opentype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

/* ========================================================================
   ========================= BASE ELEMENTS ===============================
   ======================================================================== */
body {
    margin: 0;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #2A063D;
    font-family: var(--body-font);
    background-image: var(--gradient-color);
    background-attachment: fixed;
    background-size: cover;
    transition: height 0.3s ease-in-out;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Inter', serif;
    font-weight: 600;
}

#ideea-logo {
    font-family: var(--logo-font);
    font-size: calc(var(--basic-size) * 2.5);
    background: var(--accent-color);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
}

/* ========================================================================
   ========================= ANIMATIONS ===================================
   ======================================================================== */
@keyframes gradientAnimation {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* ========================================================================
   ========================= SVG ELEMENTS ================================
   ======================================================================== */
svg {
    -webkit-tap-highlight-color: transparent;
    outline: none;
    background: transparent;
    touch-action: manipulation;
}

/* ========================================================================
   ========================= FLATPICKR OVERRIDES ==========================
   ======================================================================== */
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.selected:focus,
.flatpickr-day.selected:hover {
    background: var(--accent-color) !important;
    border-color: var(--accent-color) !important;
    color: #fff !important;
}

.flatpickr-day.today:not(.selected) {
    border-color: var(--accent-color) !important;
    color: inherit;
}

/* ========================================================================
   ========================= MAIN LAYOUT =================================
   ======================================================================== */
#app-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
}

/* ========================================================================
   ========================= SIDEBAR (ASIDE) =============================
   ======================================================================== */
aside {
    height: 100vh;
    min-width: 250px;
    width: 30%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: width 0.28s ease, min-width 0.28s ease, max-width 0.28s ease;
}

#aside-collapse-toggle {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.95);
    padding: 0;
    cursor: pointer;
    opacity: 0.88;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#aside-collapse-toggle:hover,
#aside-collapse-toggle:focus-visible {
    opacity: 1;
    transform: translateY(-1px);
}

#aside-collapse-toggle i {
    font-size: calc(var(--basic-size) * 1.25);
}

#aside-header {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ========================================================================
   ========================= SIDEBAR WIDGETS =============================
   ======================================================================== */
#widgets,
#chat-list-wrapper,
#aside-footer {
    display: flex;
    flex-direction: column;
    justify-content: start;
    padding-left: 10%;
    padding-right: 10%;
}

.widget {
    display: flex;
    flex-direction: row;
    justify-content: center;
    color: rgba(255, 255, 255, 0.951);
    align-items: center;
    font-size: calc(var(--basic-size) * 1.375);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 10px;
    border-radius: 30px;
    cursor: pointer;
    position: relative;
    background: transparent;
    overflow: hidden;
    margin-bottom: 10px;
    text-align: center;
    transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.widget:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    box-shadow: none;
}

.widget i {
    margin: 0px 10px;
}

.widget.user-widget {
    justify-content: space-between;
    border: none;
}

/* ========================================================================
   ========================= LOGIN WIDGET ================================
   ======================================================================== */
#login-widget {
    flex-direction: column;
    background: linear-gradient(55deg, rgba(255, 255, 255, 0.164) 0%, rgba(255, 255, 255, 0.0) 60%);
    padding: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#login-widget .widget-text h3 {
    margin: 10px 0px;
    font-size: calc(var(--basic-size) * 1.5);
    font-weight: 600;
}

#login-widget .widget-text p {
    margin-bottom: 30px;
    font-size: calc(var(--basic-size) * 1.25);
    font-weight: 300;
}

#login-widget .login-button {
    margin: 10px 0px;
    width: 90%;
    align-self: center;
    height: calc(var(--basic-size) * 2);
}

/* ========================================================================
   ========================= USER ELEMENTS ===============================
   ======================================================================== */
.user-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    font-size: calc(var(--basic-size) * 1.375);
    width: 85%;
    overflow: hidden;
    white-space: nowrap;
    mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 90%, rgba(0, 0, 0, 0));
    mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 90%, rgba(0, 0, 0, 0));
    -webkit-mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 90%, rgba(0, 0, 0, 0));
}

.user-info .fa-ellipsis {
    margin-bottom: -4px;
}

.user-img {
    width: calc(var(--basic-size) * 1.7);
    height: calc(var(--basic-size) * 1.7);
    object-fit: cover;
    border-radius: 50%;
    background-color: white;
    margin-right: 5px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.15), 0px 2px 5px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

/* ========================================================================
   ========================= ACCENT WIDGETS ==============================
   ======================================================================== */
.widget-accent {
    background: white;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
    font-weight: 600;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.15), 0px 2px 5px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.widget-accent svg {
    fill: var(--accent-color);
    width: calc(var(--basic-size) * 1.375);
    margin-right: 10px;
}

.widget-accent:hover {
    background: var(--accent-color);
    color: white;
    box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.2), 0px 3px 6px rgba(0, 0, 0, 0.15);
}

.widget-accent:hover svg {
    fill: white;
}

/* ========================================================================
   ========================= CHAT LIST ===================================
   ======================================================================== */
.aside-delimeter-text {
    color: white;
    font-size: calc(var(--basic-size) * 1.5);
    font-weight: 600;
}

#chat-list-wrapper::-webkit-scrollbar {
    width: 6px;
}

#chat-list-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

#chat-list-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

#chat-list-wrapper {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    /* padding-right: 10px; */
    padding-bottom: 10px;
    margin-bottom: 0;
    margin-top: 10px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 90%, rgba(0, 0, 0, 0));
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 90%, rgba(0, 0, 0, 0));
}

.conversation-link {
    display: block;
    width: 95%;
    color: rgba(255, 255, 255, 0.951);
    font-size: calc(var(--basic-size) * 1.25);
    cursor: pointer;
    background: transparent;
    padding: 5px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 20px;
    font-weight: 400;
}

#aside-footer {
    padding-top: 10px;
    padding-bottom: 5px;
    flex-shrink: 0;
    z-index: 10;
}

/* ========================================================================
   ========================= MAIN CONTENT AREA ===========================
   ======================================================================== */
#main-stage {
    width: 100%;
    min-width: 70%;
    margin: var(--basic-size);
    height: calc(100% - 2 * var(--basic-size));
    border-radius: 20px;
    background-color: rgb(255, 255, 255);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    overflow: hidden;
    /* Ensure it is the offset parent for absolute positioned children */
}

/* ========================================================================
   ========================= PROMPT AREA =================================
   ======================================================================== */
#prompt-area {
    display: none;
    flex-direction: column;
    gap: 8px;
    width: 50%;
    max-width: 1200px;
    margin: auto 0px 25px 0px;
    background: transparent;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#prompt-area.initial-state {
    margin-bottom: auto;
    margin-top: -2vh;
    /* Redus de la -5vh pentru a evita suprapunerea pe desktop */
    z-index: 10;
}

#prompt-area.initial-state .prompt-input-container {
    border-radius: 20px;
    /* Rotunjim toate colțurile în starea inițială */
}

#prompt-area.no-transition,
#prompt-area.instant-move {
    transition: none !important;
}

@media (max-width: 768px) {
    #prompt-area {
        width: 95%;
        margin: 10px auto;
    }

    #prompt-area.initial-state {
        width: 95%;
        margin-top: -2vh;
        /* Mai sus și pe mobil */
        margin-bottom: auto;
    }

    #prompt-area.initial-state .prompt-input-container {
        border-radius: 20px;
    }
}

/* Chat Initial State Welcome UI */
.chat-welcome-container {
    text-align: center;
    margin-bottom: 30px;
    display: none;
    animation: fadeIn 0.8s ease-out;
}

.chat-welcome-container.instant-hide {
    transition: none !important;
    display: none !important;
}

#main-stage.chat-initial-state {
    justify-content: center;
}

#main-stage.chat-initial-state .chat-welcome-container {
    display: block;
}

#main-stage.canvas-open .chat-welcome-container {
    display: none !important;
}

#main-stage.chat-initial-state #dialog-window {
    flex-grow: 0;
    margin-top: auto;
}

.chat-welcome-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 10px;
    text-align: center;
}

.chat-welcome-subtitle {
    font-size: 16px;
    color: #666;
}

.chat-suggestions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* Forțăm toate cele 4 sugestii pe un singur rând pe desktop */
    gap: 12px;
    width: 100%;
    max-width: 1100px;
    /* Creștem lățimea maximă pentru a lăsa loc sugestiilor în linie */
    margin-top: 30px;
}

.suggestion-chip {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 8px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #4a5568;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.suggestion-chip:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
    color: #2d3748;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.suggestion-chip i {
    display: none !important;
}

@media (max-width: 768px) {
    .chat-welcome-container {
        padding-bottom: 20px;
        justify-content: center;
        padding-top: 10px;
        min-height: 250px;
        /* Reducem min-height pentru a ridica totul */
    }

    .chat-welcome-title {
        font-size: 26px;
        color: #f5f5f5;
        margin-bottom: 5px;
    }

    .chat-welcome-subtitle {
        color: var(--background-gray);
    }

    .chat-suggestions-grid {
        grid-template-columns: 1fr;
        padding: 0 15px;
        gap: 12px;
        margin-top: 0px;
        width: 100%;
        box-sizing: border-box;
    }

    .suggestion-chip {
        padding: 10px 20px;
        background: #fff;
        border: 1px solid #e2e8f0;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }

    .suggestion-chip span {
        font-weight: 500;
        line-height: 1.3;
    }

}

/* Logica bazată pe înălțime pentru sugestii pe mobil */
@media screen and (max-width: 768px) and (max-height: 650px) {
    .chat-suggestions-grid .suggestion-chip:nth-child(n+4) {
        display: none;
    }
}

@media screen and (max-width: 768px) and (max-height: 600px) {
    .chat-suggestions-grid .suggestion-chip:nth-child(n+3) {
        display: none;
    }
}

@media screen and (max-width: 768px) and (max-height: 500px) {
    .chat-suggestions-grid .suggestion-chip:nth-child(n+2) {
        display: none;
    }
}

/* ========================================================================
   ==================== LEGAL SEARCH CONTAINER ===========================
   ======================================================================== */
/* ========================================================================
   ========================= LEGAL SEARCH STYLES =========================
   ======================================================================== */



/* Banner de notificare pentru limitele atinse */
.limit-notification-banner {
    display: none;
    width: calc(100% - 40px);
    max-width: 800px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1); /* Umbră mai fină */
    padding: 16px 20px;
    margin: 0 auto 15px auto; /* Margine jos pentru spațiere față de prompt */
    position: relative; /* Schimbat din absolute */
    z-index: 100;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.3s ease; /* Tranziție simplă de opacitate */
}

.limit-notification-banner.visible {
    display: block;
    opacity: 1;
    animation: fadeInSmooth 0.4s ease-out;
}

@keyframes fadeInSmooth {
    from {
        opacity: 0;
        transform: translateY(10px); /* Apare ușor de jos în sus */
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.limit-banner-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    position: relative;
}

.limit-banner-title {
    font-family: var(--heading-font);
    font-weight: 700;
    font-size: 15px;
    color: #151e2b;
}

.limit-banner-desc {
    flex: 1;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
    min-width: 0;
}

.limit-banner-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.limit-banner-action {
    padding: 10px 20px;
    background: #23252a;
    color: #ffffff;
    border: none;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--heading-font);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.limit-banner-action-secondary {
    background: #ffffff;
    color: #23252a;
    border: 1px solid #d1d5db;
}

.limit-banner-action:hover {
    background: #000000;
    transform: translateY(-1px);
}

.limit-banner-action-secondary:hover {
    background: #f8fafc;
    border-color: #9ca3af;
    color: #111827;
}

.limit-banner-action:active {
    transform: translateY(0);
}

.limit-banner-close {
    cursor: pointer;
    font-size: 24px;
    color: #9ca3af;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s ease;
    margin-left: auto;
    position: absolute;
    top: -6px;
    right: 0px;
}

.limit-banner-close:hover {
    color: #374151;
}

/* Containerul central */
.prompt-input-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    border-radius: 28px;
    background-color: white;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.08);
}

.prompt-input-container-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}

.prompt-left-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Chat Warning Text */
.chat-maintenance-banner {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0 0 10px 0;
    box-sizing: border-box;
    padding: 12px 16px;
    border: 1px solid rgba(184, 93, 0, 0.22);
    border-radius: 16px;
    background: linear-gradient(180deg, #fff4db 0%, #ffe8bf 100%);
    color: #7a4300;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    text-align: center;
    box-shadow: 0 10px 25px rgba(122, 67, 0, 0.08);
}

.chat-warning-text {
    display: none;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.5);
    text-align: center;
    margin-top: 8px;
    padding: 0 12px;
    line-height: 1.4;
}

#prompt-area:not(.initial-state) .chat-warning-text {
    display: block;
}

@media (max-width: 768px) {
    .chat-maintenance-banner {
        width: 100%;
        margin: 0 0 8px 0;
        padding: 10px 12px;
        border-radius: 14px;
        font-size: 13px;
    }

    .chat-warning-text {
        display: none !important;
    }
}

/* Attachments UI */
#attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
    max-width: 1200px;
    padding: 0 6px;
    position: relative;
    z-index: 1;
    background: transparent;
}

/* Stiluri pentru atașamente în zona de prompt (cu wrap) */
.attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    max-height: 150px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2px;
    /* Ascundem scrollbar-ul dar păstrăm funcționalitatea */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE și Edge */
}

/* Item-urile din zona de prompt pot să se comprime */
.attachments-list .attachment-item {
    flex-shrink: 1;
}

/* Ascundem scrollbar-ul în Chrome, Safari și Opera */
.attachments-list::-webkit-scrollbar {
    display: none;
}

/* Wrapper pentru mesaje cu atașamente */
.message-with-attachments {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: fit-content;
}

/* Wrapper pentru mesaje de utilizator cu atașamente */
.message-with-attachments.user-message-wrapper {
    align-self: flex-end;
    margin-right: 30px;
    max-width: 70%;
}

/* Wrapper pentru mesaje AI cu atașamente */
.message-with-attachments.ai-message-wrapper {
    align-self: flex-start;
}

/* Mesajele în wrapper nu mai au nevoie de margin-bottom sau aliniament */
.message-with-attachments .message {
    margin-bottom: 0;
    align-self: auto;
    width: fit-content;
    max-width: 100%;
}

.message-with-attachments .user-message {
    margin-right: 0;
    align-self: flex-end;
}

.message-with-attachments .ai-message {
    align-self: flex-start;
}

/* Wrapper pentru atașamente cu săgeți */
.message-attachments-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
}

/* Container pentru atașamente în mesaje cu scroll */
.message-attachments-list {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    /* Ascundem scrollbar-ul */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE și Edge */
    flex: 1;
    /* justify-content: end; */
}

.message-attachments-list::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, Opera */
}

/* Săgeți pentru scroll */
.attachments-scroll-arrow {
    display: none;
    /* Ascuns implicit, se afișează prin JS când e necesar */
    position: relative;
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #e0e0e0;
    color: #5f6368;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
    z-index: 3;
    flex-shrink: 0;
    outline: none;
    padding: 0;
}

.attachments-scroll-arrow:hover {
    background: #ffffff;
    color: #202124;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
    transform: scale(1.08);
    border-color: #d0d0d0;
}

.attachments-scroll-arrow:active {
    transform: scale(0.96);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.attachments-scroll-arrow.left-arrow {
    margin-right: -8px;
}

.attachments-scroll-arrow.right-arrow {
    margin-left: -8px;
}

.attachments-list .attachment-item,
.message-attachments-list .attachment-item {
    position: relative;
}

/* Item-urile din mesaje nu trebuie să se comprime */
.message-attachments-list .attachment-item {
    flex-shrink: 0;
}

/* Dacă există un singur atașament în mesaj, aliniază-l la dreapta */
.message-attachments-list .attachment-item:only-child {
    margin-left: auto;
}

/* Stiluri pentru imagini - pătrate cu colțuri rotunjite */
.attachments-list .attachment-item.attachment-image,
.message-attachments-list .attachment-item.attachment-image {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #dadce0;
    background: #f8f9fa;
    box-sizing: border-box;
}

.attachment-image-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.attachment-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Overlay pentru încărcare imagini */
.attachment-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(32, 33, 36, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    backdrop-filter: blur(2px);
}

/* Stiluri pentru fișiere document - dreptunghiulare */
.attachments-list .attachment-item.attachment-file,
.message-attachments-list .attachment-item.attachment-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #f8f9fa;
    border: 1px solid #dadce0;
    max-width: 260px;
    min-width: 180px;
    width: 220px;
    height: 72px;
    box-sizing: border-box;
}

.attachment-file-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.3px;
}

.attachment-file-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.attachment-file-name {
    font-size: 12px;
    font-weight: 400;
    color: #202124;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 1px;
    line-height: 1.3;
}

.attachment-file-meta {
    font-size: 10px;
    color: #5f6368;
    line-height: 1.3;
}

.attachment-file-loader {
    color: #1a73e8;
    font-size: 14px;
    flex-shrink: 0;
}

/* Buton remove (doar pentru zona de prompt) */
.attachments-list .attachment-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(32, 33, 36, 0.65);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    padding: 0;
    transition: all 0.15s ease;
    z-index: 10;
    opacity: 0.9;
}

.attachments-list .attachment-remove:hover {
    background: rgba(32, 33, 36, 0.85);
    opacity: 1;
    transform: scale(1.05);
}

.attachments-list .attachment-item.attachment-file .attachment-remove {
    position: static;
    background: transparent;
    color: #5f6368;
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

.attachments-list .attachment-item.attachment-file .attachment-remove:hover {
    background: #f1f3f4;
    color: #d93025;
    opacity: 1;
    border-radius: 50%;
}

/* Hover effect pentru atașamente în mesaje (fără buton remove) */
.message-attachments-list .attachment-item:hover {
    opacity: 0.85;
    transition: opacity 0.2s;
}

/* Stiluri pentru starea de încărcare */
.attachment-item.attachment-file.uploading {
    opacity: 0.7;
}

.attachment-item.attachment-image.uploading {
    opacity: 1;
}

#attach-button-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 10px;
    position: relative;
}

/* Tooltip pentru butonul de atașare */
.attach-tooltip {
    visibility: hidden;
    background: #111827;
    color: #f8fafc;
    text-align: center;
    padding: 8px 12px;
    border-radius: 10px;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translate(-50%, 4px);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    width: max-content;
    max-width: min(280px, 72vw);
    white-space: normal;
    z-index: 1300;
    pointer-events: none;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.28);
}

.attach-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #111827 transparent transparent transparent;
}

@media (hover: hover) and (pointer: fine) {
    #attach-button-wrapper:not(.is-attach-dropdown-open):hover .attach-tooltip,
    #attach-button-wrapper:not(.is-attach-dropdown-open):focus-within .attach-tooltip {
        visibility: visible;
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

#attach-button-wrapper.is-attach-dropdown-open .attach-tooltip {
    visibility: hidden;
    opacity: 0;
    transform: translate(-50%, 4px);
}

/* Buton attach: gri, fără background; hover: fundal gri deschis și icon mai închis */
#attach-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: calc(var(--basic-size) * 2.1);
    width: calc(var(--basic-size) * 2.1);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    appearance: none;
    user-select: none;
    -webkit-user-select: none;
    background: transparent;
    padding: 12px;
}

#attach-button i {
    font-size: calc(var(--basic-size) * 1.5);
    color: #888888;
    /* gri inițial */
    transition: color 0.15s ease;
}

#attach-button:hover {
    background: #f0f0f0;
    /* gri deschis */
}

#attach-button:hover i {
    color: #333333;
    /* icon mai închis la hover */
}

#attach-button:focus {
    outline: none;
}

#attach-button:disabled,
#attach-button[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.58;
}

#attach-button:disabled:hover,
#attach-button[aria-disabled="true"]:hover {
    background: transparent;
}

.attach-dropdown {
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    min-width: 230px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.18);
    padding: 6px;
    z-index: 1200;
}

.attach-dropdown button {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 10px 12px;
    border-radius: 8px;
    color: #111827;
    font-size: 14px;
    font-family: var(--body-font);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.attach-dropdown button:hover {
    background: #f3f4f6;
}

.attach-dropdown-divider {
    height: 1px;
    margin: 6px 4px;
    background: linear-gradient(90deg, rgba(203, 213, 225, 0), rgba(203, 213, 225, 0.95), rgba(203, 213, 225, 0));
}

.attach-dropdown-mode-section {
    padding: 2px 4px 4px;
}

.attach-dropdown-section-label {
    padding: 6px 8px 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
}

.attach-dropdown-mode-buttons {
    display: flex;
    gap: 6px;
}

.attach-dropdown-mode-btn {
    flex: 1 1 0;
    width: auto !important;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    background: transparent !important;
    color: #64748b !important;
    border: 1px solid transparent;
    border-radius: 999px;
    box-shadow: none;
}

.attach-dropdown-mode-btn[aria-pressed="true"] {
    background: transparent !important;
    color: #0f172a !important;
    border-color: rgba(203, 213, 225, 0.95);
    box-shadow: none;
}

.attach-dropdown-mode-btn i {
    color: #64748b;
    transition: color 0.18s ease;
}

.attach-dropdown-mode-btn[aria-pressed="true"] i {
    color: var(--accent-color);
}

.attach-dropdown-mode-btn:hover {
    background: transparent !important;
    color: #0f172a !important;
    border-color: rgba(203, 213, 225, 0.72);
}

.attach-dropdown-mode-btn[data-locked="true"] {
    color: #94a3b8 !important;
    cursor: pointer;
}

.attach-dropdown-mode-btn[data-locked="true"]::after {
    content: "\f023";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 11px;
    color: #94a3b8;
}

/* Textarea în interiorul containerului */
#prompt {
    font-family: var(--font-family);
    resize: none;
    max-height: 300px;
    width: 100%;
    font-size: calc(var(--basic-size) * 1.375);
    border: none;
    outline: none;
    color: var(--text-color);
    overflow: hidden;
    display: block;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) var(--scroll-track);
    align-self: center;
    padding: 0px;
}

#prompt:empty:before {
    content: attr(data-placeholder);
    color: gray;
    pointer-events: none;
    display: block;
}

#send-button-wrapper {
    padding: 0px;
    align-self: flex-end;
}

#send-button {
    background-color: var(--accent-color);
    color: white;
    fill: white;
    text-align: center;
    background-attachment: fixed;
    background-size: cover;
    border: none;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    height: calc(var(--basic-size) * 2.1);
    width: calc(var(--basic-size) * 2.1);
    box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.15), 0px 3px 6px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    margin-right: 1rem;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

#send-button:hover {
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2), 0px 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

#send-button:disabled {
    background-color: var(--dark-color);
    cursor: not-allowed;
    opacity: 0.6;
    pointer-events: none;
}

#send-button:disabled:hover {
    box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.15), 0px 3px 6px rgba(0, 0, 0, 0.1);
    transform: none;
}

#send-button:focus {
    outline: none;
}

#send-button:active,
#send-button:focus {
    box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.15), 0px 3px 6px rgba(0, 0, 0, 0.1) !important;
    transform: none !important;
}

.filesystem-modal-content {
    max-width: 1080px;
    width: min(96vw, 1080px);
    max-height: 88vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    margin: 0 auto;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25);
    padding: 18px;
}

#filesystem-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10010;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
}

.filesystem-subtitle {
    font-size: 13px;
    color: var(--dark-color);
    margin: 0 0 12px 0;
}

.filesystem-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.filesystem-breadcrumb {
    flex: 1;
    font-size: 13px;
    color: #4b5563;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filesystem-breadcrumb button {
    border: none;
    background: transparent;
    color: #2563eb;
    cursor: pointer;
    font-size: 13px;
}

#filesystem-search-input {
    flex: 1;
    min-width: 240px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 8px 10px;
}

.filesystem-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.filesystem-upload-status {
    margin: 0 0 10px 0;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #dbeafe;
    background: #eff6ff;
    color: #1e3a8a;
    font-size: 13px;
}

.filesystem-upload-status.is-success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.filesystem-upload-status.is-warning {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.filesystem-upload-status.is-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.filesystem-privacy-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 8px;
    font-size: 13px;
}

.filesystem-table-wrap {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: auto;
    min-height: 320px;
    max-height: 50vh;
}

.filesystem-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.filesystem-table th,
.filesystem-table td {
    border-bottom: 1px solid #f1f5f9;
    padding: 10px;
    font-size: 13px;
    text-align: left;
}

.filesystem-name-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filesystem-open-item {
    border: none;
    background: transparent;
    color: #0f172a;
    cursor: pointer;
    text-align: left;
    padding: 0;
}

.filesystem-actions-col {
    width: 56px;
    text-align: center !important;
}

.filesystem-row-actions-cell {
    width: 56px;
    text-align: center;
    position: relative;
}

.filesystem-row-actions {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.filesystem-actions-trigger {
    width: 32px;
    height: 32px;
    border: 1px solid #dbe1ea;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.filesystem-actions-trigger:hover,
.filesystem-actions-trigger[aria-expanded="true"] {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

.filesystem-row-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14);
    padding: 6px 0;
    display: none;
    z-index: 30;
}

.filesystem-row-menu.is-open {
    display: block;
}

.filesystem-row-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: transparent;
    text-align: left;
    color: #0f172a;
    font-size: 13px;
    cursor: pointer;
}

.filesystem-row-menu-item:hover {
    background: #f8fafc;
}

.filesystem-row-menu-item i {
    width: 14px;
    text-align: center;
    color: #64748b;
}

.filesystem-row-menu-item.is-danger {
    color: #b91c1c;
}

.filesystem-row-menu-item.is-danger i {
    color: #b91c1c;
}

.filesystem-chip {
    margin-left: 6px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1e3a8a;
    font-size: 11px;
    padding: 2px 6px;
}

#filesystem-empty-state {
    margin: 14px 0;
    text-align: center;
    color: #64748b;
}

.filesystem-empty-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.filesystem-empty-title {
    font-weight: 700;
    color: #1e293b;
}

.filesystem-footer-note {
    margin-top: 10px;
    font-size: 12px;
    color: #6b7280;
}

@media (max-width: 768px) {
    #filesystem-modal {
        padding: 10px;
        align-items: center;
        justify-content: center;
    }

    .filesystem-modal-content {
        width: 100%;
        max-width: none;
        max-height: calc(100dvh - 20px);
        padding: 14px;
        border-radius: 14px;
    }

    .filesystem-subtitle {
        font-size: 12px;
        margin-bottom: 10px;
    }

    .filesystem-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .filesystem-breadcrumb {
        white-space: normal;
        word-break: break-word;
    }

    #filesystem-search-input {
        width: 100%;
        min-width: 0;
    }

    .filesystem-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .filesystem-privacy-toggle {
        grid-column: 1 / -1;
        margin-right: 0;
    }

    #filesystem-new-folder-button,
    #filesystem-upload-files-button,
    #filesystem-upload-folder-button,
    #filesystem-delete-selected-button,
    #filesystem-attach-selected-button {
        width: 100%;
        min-width: 0;
    }

    .filesystem-table-wrap {
        min-height: 220px;
        max-height: 44vh;
    }

    .filesystem-table th,
    .filesystem-table td {
        padding: 8px;
        font-size: 12px;
    }

    .filesystem-name-cell {
        align-items: flex-start;
    }

    .filesystem-open-item {
        white-space: normal;
        word-break: break-word;
    }
}

@media (max-width: 480px) {
    #filesystem-modal {
        padding: 6px;
    }

    .filesystem-modal-content {
        max-height: calc(100dvh - 12px);
        padding: 12px;
        border-radius: 12px;
    }

    .filesystem-actions {
        grid-template-columns: 1fr;
    }

    .filesystem-table th:nth-child(3),
    .filesystem-table td:nth-child(3),
    .filesystem-table th:nth-child(4),
    .filesystem-table td:nth-child(4) {
        display: none;
    }

    .filesystem-footer-note {
        font-size: 11px;
    }
}

/* ========================================================================
   ========================= DIALOG WINDOW ===============================
   ======================================================================== */
#dialog-window {
    width: 50%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-grow: 1;
}

#main-stage.legal-search-stage {
    align-items: stretch;
}

#dialog-window.legal-search-dialog-window {
    width: 100%;
    max-width: none;
    min-width: 0;
    align-self: stretch;
    box-sizing: border-box;
}

/* Bara cu acțiuni similară cu „toolbox drawer" */
.prompt-toolbox {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 0 6px;
}

.chat-processing-toggle {
    position: relative;
    display: inline-flex;
}

.chat-processing-toggle-trigger,
#canvas-create-button {
    appearance: none;
    border: 1px solid rgba(226, 232, 240, 0.95);
    background: rgba(255, 255, 255, 0.94);
    color: #0f172a;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: calc(var(--basic-size) * 0.95);
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-processing-toggle-trigger:hover,
#canvas-create-button:hover {
    background: #f8fafc;
    border-color: rgba(203, 213, 225, 0.95);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.chat-processing-toggle-trigger:focus-visible,
#canvas-create-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.chat-processing-toggle-icon,
.chat-processing-toggle-caret {
    color: #64748b;
}

.chat-processing-toggle-value {
    color: #0f172a;
    line-height: 1;
}

.chat-processing-toggle-caret {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.chat-processing-toggle[data-open="true"] .chat-processing-toggle-caret {
    transform: rotate(180deg);
}

.chat-processing-toggle-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    min-width: 180px;
    padding: 6px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
    z-index: 1200;
}

.chat-processing-toggle-option {
    width: 100%;
    appearance: none;
    border: none;
    background: transparent;
    border-radius: 10px;
    padding: 10px 12px;
    color: #334155;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: background 0.18s ease, color 0.18s ease;
}

.chat-processing-toggle-option:hover {
    background: #f8fafc;
    color: #0f172a;
}

.chat-processing-toggle-option[data-selected="true"] {
    background: #f1f5f9;
    color: #0f172a;
}

.chat-processing-toggle-option-check {
    font-size: 12px;
    color: var(--accent-color);
    opacity: 0;
    transition: opacity 0.18s ease;
}

.chat-processing-toggle-option[data-selected="true"] .chat-processing-toggle-option-check {
    opacity: 1;
}

.chat-processing-toggle-option[data-locked="true"] {
    color: #64748b;
    cursor: pointer;
}

.chat-processing-toggle-option[data-locked="true"] .chat-processing-toggle-option-check {
    opacity: 1;
    color: #94a3b8;
}

.chat-processing-toggle-option[data-locked="true"] .chat-processing-toggle-option-check::before {
    content: "\f023";
}

.chat-processing-auth-notice {
    margin: 6px 4px 2px;
    padding: 9px 10px;
    border-radius: 10px;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    line-height: 1.35;
}

.chat-processing-auth-notice[hidden] {
    display: none;
}

.chat-processing-auth-notice a {
    color: var(--accent-color);
    font-weight: 700;
    text-decoration: none;
}

.chat-processing-auth-notice a:hover {
    text-decoration: underline;
}

.chat-processing-auth-notice--mobile {
    margin: 8px 0 0;
}

@media (min-width: 769px) {
    .attach-dropdown-mode-section,
    .attach-dropdown-divider {
        display: none;
    }
}

.toolbox-btn {
    appearance: none;
    background: transparent;
    color: #727676;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: calc(var(--basic-size) * 1);
    cursor: pointer;
    border: none;
    font-weight: 600;
    font-family: var(--font-family);
    transition: all 0.2s ease;
}

.toolbox-btn:hover,
.toolbox-btn.active {
    background-color: var(--secondary-color) !important;
    color: var(--dark-color) !important;
}

.toolbox-btn:active {
    transform: translateY(1px);
}

.toolbox-btn.active i {
    color: var(--accent-color) !important;
}

/* Starea disabled pentru butonul asistentului juridic */
.toolbox-btn:disabled,
.toolbox-btn.limit-reached {
    opacity: 0.5;
    cursor: not-allowed;
    background: transparent !important;
    color: #a0a0a0 !important;
    pointer-events: none;
}

.toolbox-btn:disabled i,
.toolbox-btn.limit-reached i {
    color: #a0a0a0 !important;
}

/* Pentru accesibilitate - permitem hover pentru tooltip dar nu pentru click */
.toolbox-btn.limit-reached {
    pointer-events: auto;
}

.toolbox-btn.limit-reached:hover {
    background: transparent !important;
}

#canvas-create-button.active {
    background: #f8fafc !important;
    color: #0f172a !important;
    border-color: rgba(203, 213, 225, 0.95) !important;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

#canvas-create-button:hover {
    background: #f8fafc !important;
    color: #0f172a !important;
}

.canvas-close-btn:focus-visible,
.canvas-icon-btn:focus-visible,
.canvas-header-version-select:focus-visible,
.canvas-toolbar button:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

#main-stage {
    --canvas-shell-width: 52%;
    --canvas-chat-width: 48%;
}

#main-stage.canvas-open,
#main-stage.legal-doc-panel-open {
    display: grid;
    grid-template-columns: minmax(320px, var(--canvas-chat-width)) minmax(360px, var(--canvas-shell-width));
    grid-template-rows: auto minmax(0, 1fr) auto;
    column-gap: 12px;
    align-items: stretch;
    min-height: 0;
    overflow: hidden;
}

#main-stage.canvas-open > *,
#main-stage.legal-doc-panel-open > * {
    min-height: 0;
}

#main-stage.canvas-open #mobile-header-wrapper,
#main-stage.canvas-open #limit-notification-banner,
#main-stage.canvas-open #mobile-bottom-bar,
#main-stage.canvas-open #overlay,
#main-stage.legal-doc-panel-open #mobile-header-wrapper,
#main-stage.legal-doc-panel-open #limit-notification-banner,
#main-stage.legal-doc-panel-open #mobile-bottom-bar,
#main-stage.legal-doc-panel-open #overlay {
    grid-column: 1 / -1;
}

#main-stage.canvas-open #dialog-window,
#main-stage.legal-doc-panel-open #dialog-window {
    grid-column: 1;
    grid-row: 2;
    width: 100% !important;
    max-width: none;
    margin: 0 !important;
    min-width: 0;
}

#main-stage.canvas-open #prompt-area,
#main-stage.legal-doc-panel-open #prompt-area {
    grid-column: 1;
    grid-row: 3;
    width: 95% !important;
    max-width: none;
    margin: 0 auto 14px auto !important;
    min-width: 0;
}

#canvas-splitter {
    position: absolute;
    top: 12px;
    bottom: 12px;
    left: calc(var(--canvas-chat-width) - 6px);
    width: 12px;
    cursor: col-resize;
    z-index: 35;
    display: none;
}

#canvas-splitter::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 0;
    width: 2px;
    height: 100%;
    background: rgba(75, 85, 99, 0.25);
    border-radius: 999px;
}

#main-stage.canvas-open #canvas-splitter,
#main-stage.legal-doc-panel-open #canvas-splitter {
    display: block;
}

#canvas-shell,
#legal-doc-side-panel {
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 0; /* Fix pentru grid item growing indefinitely */
    max-width: 100%;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08); /* Lighter border */
    border-radius: 16px; /* Slightly more rounded */
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06); /* Softer shadow */
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 30;
    transition: box-shadow 0.2s ease, opacity 0.2s ease;
}

#main-stage.canvas-open #canvas-shell,
#main-stage.legal-doc-panel-open #legal-doc-side-panel {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: stretch;
    height: 100%;
    max-height: 100%;
    min-height: 0;
}

#legal-doc-side-panel[hidden] {
    display: none !important;
}

.legal-doc-panel-info[hidden],
.legal-doc-panel-search-card[hidden],
.legal-doc-panel-pdf-view[hidden],
.legal-doc-panel-html-view[hidden],
.legal-doc-panel-text-view[hidden] {
    display: none !important;
}

#legal-doc-side-panel {
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.legal-doc-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex: 0 0 auto;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
}

.legal-doc-panel-header-main {
    min-width: 0;
}

#legal-doc-panel-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    color: #111827;
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

#legal-doc-panel-meta {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.35;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.legal-doc-panel-header-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.legal-doc-panel-header-actions .legal-doc-panel-close-btn {
    margin-left: 4px;
}

.legal-doc-panel-icon-btn,
.legal-doc-panel-close-btn {
    border: none;
    background: transparent;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    color: #4b5563;
}

.legal-doc-panel-icon-btn:hover,
.legal-doc-panel-close-btn:hover,
.legal-doc-panel-icon-btn.is-active {
    background: #eef2f7;
    color: #111827;
}

.legal-doc-panel-info {
    flex: 0 0 auto;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    color: #334155;
    font-size: 13px;
    line-height: 1.45;
}

.legal-doc-panel-info-row {
    display: grid;
    grid-template-columns: minmax(72px, 0.32fr) minmax(0, 1fr);
    align-items: start;
    column-gap: 8px;
    row-gap: 2px;
    margin-bottom: 7px;
}

.legal-doc-panel-info-row:last-child {
    margin-bottom: 0;
}

.legal-doc-panel-info-label {
    color: #7c8798;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.legal-doc-panel-info-value {
    min-width: 0;
    color: #172033;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.legal-doc-panel-info a {
    color: #2563eb;
    text-decoration: none;
}

.legal-doc-panel-search-card {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
}

.legal-doc-panel-search-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.legal-doc-panel-search-box {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 2px 8px 2px 10px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    background: #f8fafc;
}

.legal-doc-panel-search-field {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    color: #94a3b8;
}

#legal-doc-panel-search-input {
    width: 100%;
    min-width: 0;
    border: 0;
    padding: 0;
    height: 30px;
    font-size: 13px;
    color: #111827;
    background: transparent;
}

#legal-doc-panel-search-input:focus {
    outline: none;
}

.legal-doc-panel-search-box:focus-within {
    border-color: #cbd5e1;
    box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.08);
    background: #fff;
}

.legal-doc-panel-search-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legal-doc-panel-search-actions button {
    border: 1px solid #dbe3ef;
    background: #fff;
    border-radius: 10px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    color: #475569;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.legal-doc-panel-search-actions button:hover {
    background: #eef2f7;
    border-color: #cbd5e1;
    color: #111827;
}

.legal-doc-panel-search-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    background: #f8fafc;
}

.legal-doc-panel-search-status {
    min-width: 42px;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
}

.legal-doc-panel-pdf-view,
.legal-doc-panel-html-view,
.legal-doc-panel-text-view {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.legal-doc-panel-pdf-status {
    padding: 8px 14px;
    color: #64748b;
    font-size: 12px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
}

.legal-doc-panel-pdf-status:empty {
    display: none;
}

.legal-doc-panel-pdf-container {
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.legal-doc-panel-html-view {
    background: #fff;
}

.legal-doc-panel-html-view iframe {
    width: 100%;
    height: 100%;
    min-height: 0;
    flex: 1 1 auto;
    border: 0;
    background: #fff;
}

#legal-doc-panel-pdf-container .legal-doc-pdf-viewer-shell {
    height: 100%;
    width: 100%;
    flex: 1 1 auto;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
    box-sizing: border-box;
}

#legal-doc-side-panel .legal-doc-pdf-browser-toolbar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 8px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin: 0;
    min-height: 54px;
    padding: 8px 12px;
}

#legal-doc-side-panel .legal-doc-pdf-browser-toolbar__group {
    gap: 6px;
}

#legal-doc-side-panel .legal-doc-pdf-browser-toolbar__group--end {
    justify-content: flex-end;
}

#legal-doc-side-panel .legal-doc-pdf-browser-button {
    min-height: 32px;
    border-color: transparent;
    box-shadow: none;
}

#legal-doc-side-panel .legal-doc-pdf-browser-icon-button {
    width: 32px;
}

#legal-doc-side-panel .legal-doc-pdf-page-indicator {
    min-width: 62px;
    justify-content: center;
    padding: 0 4px;
    color: #111827;
    background: transparent;
    border: 0;
    border-radius: 8px;
    font-weight: 700;
}

#legal-doc-side-panel .legal-doc-pdf-page-nav {
    border-color: transparent;
    background: transparent;
    color: #475569;
}

#legal-doc-side-panel .legal-doc-pdf-page-nav:hover {
    background: #eef2f7;
    border-color: transparent;
    color: #111827;
}

#legal-doc-side-panel .legal-doc-pdf-page-nav:disabled {
    cursor: not-allowed;
    opacity: 0.35;
    background: transparent;
    color: #94a3b8;
}

#legal-doc-side-panel .legal-doc-pdf-browser-toolbar__group--center {
    justify-content: center;
}

#legal-doc-side-panel .legal-doc-pdf-page-indicator input {
    width: 34px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #111827;
    font: inherit;
    text-align: right;
}

#legal-doc-side-panel .legal-doc-pdf-page-indicator input:focus {
    outline: 2px solid rgba(37, 99, 235, 0.25);
    background: #fff;
}

#legal-doc-side-panel .legal-doc-pdf-page-indicator input::-webkit-outer-spin-button,
#legal-doc-side-panel .legal-doc-pdf-page-indicator input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

#legal-doc-side-panel .legal-doc-pdf-zoom-indicator {
    min-width: 58px;
    min-height: 32px;
}

#legal-doc-side-panel .legal-doc-pdf-browser-body,
#legal-doc-side-panel .legal-doc-pdf-viewer-shell.is-thumbnails-collapsed .legal-doc-pdf-browser-body {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
}

#legal-doc-side-panel .legal-doc-pdf-browser-main,
#legal-doc-side-panel .legal-doc-pdf-viewer-container {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

#legal-doc-side-panel .legal-doc-pdf-viewer-container {
    position: absolute;
    inset: 0;
    overflow: auto;
    padding: 18px 14px 30px;
    background: #f5f7f9;
    scrollbar-gutter: stable;
}

#legal-doc-side-panel .pdfViewer {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding-bottom: 0;
}

#legal-doc-side-panel .pdfViewer .page {
    max-width: 100%;
    box-sizing: border-box;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12), 0 1px 2px rgba(15, 23, 42, 0.08);
}

#legal-doc-side-panel .pdfViewer .canvasWrapper {
    max-width: 100%;
    overflow: visible;
}

#legal-doc-side-panel .textLayer .highlight {
    background: rgba(250, 204, 21, 0.45);
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.18);
}

#legal-doc-side-panel .textLayer .highlight.selected {
    background: rgba(250, 204, 21, 0.45);
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.18);
}

#legal-doc-side-panel .textLayer .highlight.legal-doc-pdf-highlight-selected {
    background: rgba(245, 158, 11, 0.78);
    box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.42), 0 0 0 3px rgba(245, 158, 11, 0.18);
}

#legal-doc-side-panel.is-compact-panel .legal-doc-panel-header {
    flex-wrap: wrap;
    gap: 8px;
}

#legal-doc-side-panel.is-compact-panel .legal-doc-panel-header-main {
    flex: 1 1 100%;
}

#legal-doc-side-panel.is-compact-panel .legal-doc-panel-header-actions {
    width: 100%;
    justify-content: flex-end;
}

#legal-doc-side-panel.is-compact-panel .legal-doc-panel-info-row {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 3px;
}

#legal-doc-side-panel.is-compact-panel .legal-doc-panel-search-card {
    grid-template-columns: minmax(0, 1fr);
}

#legal-doc-side-panel.is-compact-panel .legal-doc-panel-search-actions {
    justify-content: flex-end;
}

#legal-doc-side-panel.is-compact-panel .legal-doc-pdf-browser-toolbar {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    min-height: 88px;
}

#legal-doc-side-panel.is-compact-panel .legal-doc-pdf-browser-toolbar__group {
    width: 100%;
    justify-content: center;
}

#legal-doc-side-panel.is-compact-panel .legal-doc-pdf-viewer-container {
    padding-left: 10px;
    padding-right: 10px;
}

body.legal-doc-panel-focus-mode #legal-doc-panel-title {
    -webkit-line-clamp: 2;
}

.legal-doc-panel-text-view {
    padding: 16px;
    overflow: auto;
    background: #fff;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.legal-doc-panel-empty {
    margin: 18px;
    padding: 14px;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: #fff;
    color: #475569;
    font-size: 13px;
    line-height: 1.5;
}

.legal-doc-panel-empty a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.canvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: #fff;
}

.canvas-header-main {
    min-width: 0;
}

.canvas-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

#canvas-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    outline: none;
}

.canvas-sync-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #94a3b8;
}

.canvas-sync-dot.sync-working {
    background: #f59e0b;
    animation: canvasPulse 1.2s infinite;
}

.canvas-sync-dot.sync-saved {
    background: #16a34a;
}

.canvas-sync-dot.sync-error {
    background: #dc2626;
}

.canvas-sync-dot.sync-idle {
    background: #64748b;
}

@keyframes canvasPulse {
    0% { opacity: 0.5; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0.5; transform: scale(0.9); }
}

.canvas-sync-text {
    font-size: 11px;
    color: #6b7280;
    margin-top: 3px;
}

.canvas-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.canvas-header-version-select {
    width: 134px;
    height: 38px;
    padding: 0 32px 0 12px;
    border: 1px solid #dbe3ee;
    border-radius: 7px;
    color: #334155;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 10px center / 16px;
    appearance: none;
    -webkit-appearance: none;
    font: 500 13px var(--body-font);
    cursor: pointer;
}

.canvas-header-version-select:hover:not(:disabled) { border-color: #b9c7d8; background-color: #f8fafc; }
.canvas-header-version-select:disabled { color: #94a3b8; cursor: not-allowed; }

.canvas-icon-btn,
.canvas-close-btn {
    border: none;
    background: transparent;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    color: #4b5563;
}

.canvas-icon-btn:hover,
.canvas-close-btn:hover {
    background: #eef2f7;
}

.canvas-info-popover {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid #eceff3;
    background: #f8fafc;
    font-size: 12px;
    color: #475569;
}

.canvas-info-popover[hidden] {
    display: none !important;
}

.canvas-meta-row {
    white-space: nowrap;
}

.canvas-retry-btn {
    margin-left: auto;
    border: 1px solid #fecaca;
    background: #fff;
    color: #991b1b;
    border-radius: 8px;
    padding: 5px 8px;
    cursor: pointer;
}

.canvas-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.canvas-toolbar button,
.canvas-toolbar .canvas-toolbar-select {
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 10px;
    padding: 0 12px;
    height: 36px;
    font-size: 13px;
    cursor: pointer;
    color: #475569;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-family: var(--body-font);
}

.canvas-toolbar .canvas-toolbar-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    padding-right: 32px;
    max-width: 140px;
}

.canvas-toolbar button:hover,
.canvas-toolbar .canvas-toolbar-select:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.canvas-toolbar button:active,
.canvas-toolbar .canvas-toolbar-select:active {
    transform: translateY(0);
}

.canvas-toolbar-divider {
    width: 1px;
    height: 24px;
    margin: 0 8px;
    background: #e2e8f0;
    align-self: center;
}

.canvas-toolbar .canvas-export-btn {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #334155;
    font-weight: 500;
}

.canvas-toolbar .canvas-export-btn:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.canvas-import-menu {
    position: relative;
    display: inline-flex;
}

.canvas-document-menu {
    position: relative;
    display: inline-flex;
}

.canvas-toolbar .canvas-document-action-btn {
    gap: 7px;
    background: #fff;
    border-color: #dbe3ee;
    color: #334155;
    font-weight: 500;
}

.canvas-toolbar .canvas-document-action-btn:hover,
.canvas-toolbar .canvas-document-action-btn[aria-expanded="true"] {
    background: #f8fafc;
    border-color: #b9c7d8;
    color: #1e293b;
}

.canvas-toolbar .canvas-export-primary {
    color: #fff;
    background: #9d0759;
    border-color: #9d0759;
}

.canvas-toolbar .canvas-export-primary:hover,
.canvas-toolbar .canvas-export-primary[aria-expanded="true"] {
    color: #fff;
    background: #85044a;
    border-color: #85044a;
}

.canvas-import-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 230px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.18);
    padding: 6px;
    z-index: 40;
}

.canvas-action-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 238px;
    padding: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.18);
    z-index: 40;
}

.canvas-import-dropdown button {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    justify-content: flex-start;
    padding: 10px 12px;
    border-radius: 8px;
    color: #111827;
    font-size: 14px;
    font-family: var(--body-font);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.canvas-import-dropdown button:hover {
    background: #f3f4f6;
}

.canvas-action-dropdown button {
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #334155;
    font: 500 13px var(--body-font);
    text-align: left;
    justify-content: flex-start;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.canvas-action-dropdown button:hover:not(:disabled) { background: #f3f4f6; }
.canvas-action-dropdown button:disabled { color: #94a3b8; cursor: not-allowed; }
.canvas-action-dropdown button i { width: 16px; color: #475569; text-align: center; }

.canvas-import-dropdown button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: transparent;
}

.canvas-toolbar .canvas-export-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f8fafc;
    transform: none;
    box-shadow: none;
}

.canvas-toolbar .canvas-document-action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.canvas-toolbar button i {
    font-size: 14px;
}

.canvas-editor {
    display: flex;
    flex-direction: column;
    flex: 1 1 0; /* Important: flex-basis 0 to allow shrinking below content size */
    min-height: 0; /* Crucial for Firefox and nested flex containers */
    overflow-y: auto;
    padding: 32px 36px;
    cursor: text;
    position: relative;
    scrollbar-gutter: stable;
}

.canvas-ai-progress {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
    min-height: 44px;
    padding: 8px 14px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
}

.canvas-ai-progress[hidden] {
    display: none;
}

.canvas-ai-progress-indicator {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border: 2px solid #93c5fd;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: canvasAiProgressSpin 0.9s linear infinite;
}

.canvas-ai-progress-title {
    font-size: 12px;
    font-weight: 700;
    color: #1e3a5f;
}

.canvas-ai-progress-stage {
    margin-top: 1px;
    font-size: 12px;
    color: #64748b;
}

.canvas-ai-drafting .canvas-prosemirror {
    cursor: default;
}

.canvas-ai-drafting .canvas-prosemirror a {
    cursor: pointer;
}

@keyframes canvasAiProgressSpin {
    to { transform: rotate(360deg); }
}

.canvas-editor.canvas-import-drag-over {
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.08) 0%, rgba(37, 99, 235, 0.02) 100%);
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.45);
}

.canvas-prosemirror {
    flex: 1;
    min-height: 100%;
    outline: none;
    line-height: 1.55;
    font-family: var(--canvas-user-font-family, "Times New Roman");
    font-size: var(--canvas-user-font-size, 14px);
}

.canvas-prosemirror h1,
.canvas-prosemirror h2,
.canvas-prosemirror h3 {
    margin: 0.3em 0 0.6em;
}

.canvas-prosemirror ul,
.canvas-prosemirror ol {
    margin: 0 0 0.7em 1.4em;
}

.canvas-prosemirror a {
    color: #1d4ed8;
    text-decoration: underline;
}

.canvas-prosemirror img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.canvas-prosemirror p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    float: left;
    color: #adb5bd;
    pointer-events: none;
    height: 0;
}

.canvas-prosemirror p {
    margin: 0 0 0.7em;
}

body.canvas-focus-mode #dialog-window,
body.canvas-focus-mode #prompt-area,
body.canvas-focus-mode #mobile-header-wrapper,
body.canvas-focus-mode #canvas-splitter,
body.canvas-focus-mode #limit-notification-banner {
    display: none !important;
}

body.canvas-focus-mode #canvas-shell {
    position: fixed;
    top: 10px;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto !important;
    max-width: none;
    z-index: 1200;
}

body.legal-doc-panel-focus-mode #dialog-window,
body.legal-doc-panel-focus-mode #prompt-area,
body.legal-doc-panel-focus-mode #mobile-header-wrapper,
body.legal-doc-panel-focus-mode #canvas-splitter,
body.legal-doc-panel-focus-mode #limit-notification-banner {
    display: none !important;
}

body.legal-doc-panel-focus-mode #legal-doc-side-panel {
    position: fixed;
    top: 10px;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto !important;
    max-width: none;
    z-index: 1200;
}

body.legal-doc-panel-focus-mode #legal-doc-panel-pdf-view,
body.legal-doc-panel-focus-mode #legal-doc-panel-html-view {
    width: min(100%, 1320px);
    max-width: calc(100vw - 72px);
    align-self: center;
    margin-top: 8px;
}

body.legal-doc-panel-focus-mode #legal-doc-panel-html-view {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

body.legal-doc-panel-focus-mode #legal-doc-panel-html-view iframe {
    border-radius: inherit;
}

body.legal-doc-panel-focus-mode #legal-doc-panel-pdf-container {
    width: 100%;
    max-width: 100%;
    align-self: stretch;
}

body.legal-doc-panel-focus-mode #legal-doc-panel-info,
body.legal-doc-panel-focus-mode #legal-doc-panel-search-card {
    width: min(100%, 1320px);
    max-width: calc(100vw - 72px);
    align-self: center;
    box-sizing: border-box;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

body.legal-doc-panel-focus-mode #legal-doc-panel-info {
    margin-top: 12px;
}

body.legal-doc-panel-focus-mode #legal-doc-panel-search-card {
    margin-top: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

body.legal-doc-panel-focus-mode #legal-doc-panel-search-card[hidden] + #legal-doc-panel-pdf-view,
body.legal-doc-panel-focus-mode #legal-doc-panel-info[hidden] + #legal-doc-panel-search-card {
    margin-top: 12px;
}

body.legal-doc-panel-focus-mode #legal-doc-panel-search-card .legal-doc-panel-search-box {
    min-height: 34px;
    border-radius: 9px;
    background: #fff;
}

body.legal-doc-panel-focus-mode #legal-doc-panel-search-card .legal-doc-panel-search-actions button {
    width: 32px;
    height: 32px;
    border-radius: 9px;
}

body.canvas-focus-mode #main-stage {
    background: transparent;
}

@media (max-width: 1200px) {
    #main-stage.canvas-open,
    #main-stage.legal-doc-panel-open {
        grid-template-columns: minmax(300px, var(--canvas-chat-width)) minmax(320px, var(--canvas-shell-width));
    }
}

@media (max-width: 768px) {
    #share-chat-button .btn-text {
        display: none;
    }
    #share-chat-button i {
        margin-right: 0 !important;
    }
    #canvas-create-button {
        display: none !important;
    }
    #canvas-shell,
    #legal-doc-side-panel,
    #canvas-splitter {
        display: none !important;
    }
    #main-stage.canvas-open #dialog-window,
    #main-stage.legal-doc-panel-open #dialog-window,
    #main-stage.legal-doc-panel-open #prompt-area,
    #main-stage.canvas-open #prompt-area {
        width: 95%;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 1023px) {
    /* iOS Safari auto-zooms focused contenteditable elements below 16px. */
    .canvas-prosemirror {
        font-size: 16px;
    }

    #canvas-create-button {
        display: flex !important;
    }

    #legal-doc-side-panel,
    #canvas-splitter {
        display: none !important;
    }

    #canvas-shell { display: none !important; }

    #attach-dropdown #canvas-create-button {
        width: 100%;
        min-height: 40px;
        padding: 10px 12px;
        border: 0;
        border-radius: 8px;
        background: transparent !important;
        box-shadow: none !important;
        color: #111827 !important;
        font-size: 14px;
        justify-content: flex-start;
    }

    #attach-dropdown #canvas-create-button:hover,
    #attach-dropdown #canvas-create-button.active {
        background: #f3f4f6 !important;
        border-color: transparent !important;
    }

    body.canvas-mobile-open {
        overflow: hidden;
        overscroll-behavior: none;
    }

    body.canvas-mobile-open #main-stage.canvas-open {
        display: block;
        overflow: visible;
    }

    body.canvas-mobile-open #main-stage.canvas-open #canvas-shell {
        position: fixed;
        inset: 0;
        display: flex !important;
        width: 100%;
        min-width: 0;
        max-width: none;
        height: 100dvh;
        min-height: 0;
        max-height: 100dvh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
        transform: none;
        transition: none;
        z-index: 2000;
    }

    body.canvas-mobile-open #main-stage.canvas-open #dialog-window,
    body.canvas-mobile-open #main-stage.canvas-open #prompt-area,
    body.canvas-mobile-open #main-stage.canvas-open #mobile-header-wrapper,
    body.canvas-mobile-open #main-stage.canvas-open #mobile-bottom-bar,
    body.canvas-mobile-open #main-stage.canvas-open #overlay,
    body.canvas-mobile-open #main-stage.canvas-open #limit-notification-banner,
    body.canvas-mobile-open #main-stage.canvas-open #canvas-splitter {
        display: none !important;
    }

    body.canvas-mobile-open #main-stage.canvas-open .canvas-header {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        grid-template-rows: auto auto;
        align-items: center;
        z-index: 2;
        padding: calc(10px + env(safe-area-inset-top)) 10px 10px;
        gap: 7px 8px;
    }

    body.canvas-mobile-open #main-stage.canvas-open .canvas-header-main {
        grid-column: 2 / -1;
        grid-row: 1;
        min-width: 0;
        text-align: left;
    }

    body.canvas-mobile-open #main-stage.canvas-open #canvas-title { font-size: 14px; }

    body.canvas-mobile-open #main-stage.canvas-open .canvas-title-row {
        justify-content: flex-start;
    }

    body.canvas-mobile-open #main-stage.canvas-open .canvas-sync-text {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    body.canvas-mobile-open #main-stage.canvas-open #canvas-sync-status,
    body.canvas-mobile-open #main-stage.canvas-open .canvas-sync-dot {
        display: none;
    }

    body.canvas-mobile-open #main-stage.canvas-open .canvas-header-actions {
        display: contents;
    }

    body.canvas-mobile-open #main-stage.canvas-open .canvas-header-version-select {
        grid-column: 1 / span 2;
        grid-row: 2;
        width: 100%;
        height: 34px;
        padding-left: 8px;
        padding-right: 24px;
        font-size: 12px;
    }

    body.canvas-mobile-open #main-stage.canvas-open #canvas-toolbar,
    body.canvas-mobile-open #main-stage.canvas-open #canvas-info-button,
    body.canvas-mobile-open #main-stage.canvas-open #canvas-focus-button,
    body.canvas-mobile-open #main-stage.canvas-open #canvas-info-popover {
        display: none !important;
    }

    .canvas-mobile-actions {
        position: relative;
        display: inline-flex;
        grid-column: 4;
        grid-row: 2;
        justify-self: end;
    }

    .canvas-mobile-actions-button {
        height: 34px;
        padding: 0 8px;
        border: 1px solid #dbe3ee;
        border-radius: 7px;
        background: #fff;
        color: #334155;
        font: 600 12px var(--body-font);
    }

    .canvas-mobile-actions-dropdown {
        position: fixed;
        top: calc(env(safe-area-inset-top) + 96px);
        right: 8px;
        z-index: 2002;
        width: min(280px, calc(100vw - 16px));
        padding: 6px;
        border: 1px solid #dbe3ee;
        border-radius: 10px;
        background: #fff;
        box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
    }

    .canvas-mobile-actions-dropdown button {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        min-height: 40px;
        padding: 8px 10px;
        border: 0;
        border-radius: 7px;
        background: transparent;
        color: #334155;
        font: 500 13px var(--body-font);
        text-align: left;
    }

    .canvas-mobile-actions-dropdown button:hover { background: #f1f5f9; }
    .canvas-mobile-actions-dropdown button:disabled { color: #94a3b8; }
    .canvas-mobile-back-icon, .canvas-mobile-back-label { display: inline; }

    .canvas-mobile-copy-button {
        display: inline-flex;
        grid-column: 3;
        grid-row: 2;
        align-items: center;
        justify-content: center;
        gap: 6px;
        width: 96px;
        height: 34px;
        padding: 0 9px;
        border: 1px solid #dbe3ee;
        border-radius: 8px;
        background: #fff;
        color: #334155;
        font: 600 12px var(--body-font);
        cursor: pointer;
    }

    .canvas-mobile-copy-button:hover:not(:disabled) { background: #f8fafc; }
    .canvas-mobile-copy-button:disabled { color: #94a3b8; }
    .canvas-mobile-copy-button:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }

    .canvas-close-btn {
        grid-column: 1;
        grid-row: 1;
        display: inline-flex;
        align-items: center;
        gap: 5px;
        width: auto;
        min-width: 34px;
        padding: 0 7px;
        font: 600 12px var(--body-font);
    }

    .canvas-close-btn > .fa-times { display: none; }

    @media (max-width: 359px) {
        .canvas-close-btn { padding: 0; }
        .canvas-mobile-back-label { display: none; }
        .canvas-header-version-select { min-width: 0; }
    }

    @media (max-width: 374px) {
        .canvas-mobile-copy-button {
            width: 34px;
            min-width: 34px;
            padding: 0;
        }

        .canvas-mobile-copy-label { display: none; }
    }

    body.canvas-mobile-open #main-stage.canvas-open .canvas-editor {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
        scrollbar-gutter: auto;
    }
}

@media (min-width: 1024px) {
    .canvas-mobile-actions,
    .canvas-mobile-copy-button,
    .canvas-mobile-back-icon,
    .canvas-mobile-back-label { display: none; }
}

/* ========================================================================
   ========================= LEGAL ASSISTANT POPOVER =====================
   ======================================================================== */
.legal-assistant-wrapper {
    position: relative;
    display: inline-block;
}

.legal-popover {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background-color: #2d2d2d;
    color: white;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    z-index: 1000;
    min-width: 280px;
    max-width: 320px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.legal-popover.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
    pointer-events: auto;
}

/* Pseudo-element invizibil pentru a umple gap-ul între buton și popover */
.legal-popover::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 12px;
    background: transparent;
}

.legal-popover-arrow {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #2d2d2d;
}

.legal-popover-content {
    padding: 16px;
}

.legal-popover-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #ffffff;
    font-family: var(--heading-font);
}

.legal-popover-desc {
    font-size: 13px;
    line-height: 1.5;
    color: #d0d0d0;
    margin-bottom: 12px;
}

.legal-popover-limit {
    font-size: 14px;
    font-weight: 600;
    color: #4CAF50;
    margin-bottom: 14px;
    padding: 8px 12px;
    background-color: rgba(76, 175, 80, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
}

.legal-popover-limit i {
    color: #4CAF50;
}

.legal-upgrade-btn {
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--accent-color), #c7167a);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--heading-font);
}

.legal-upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(160, 5, 90, 0.4);
}

.legal-upgrade-btn:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .legal-popover {
        position: fixed;
        top: 50%;
        left: 50%;
        bottom: auto;
        transform: translate(-50%, -50%) scale(0.95);
        width: 85%;
        max-width: 340px;
        margin: 0;
        z-index: 9999;
        box-shadow: 0 15px 50px rgba(0, 0, 0, 0.5);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .legal-popover.visible {
        transform: translate(-50%, -50%) scale(1);
    }

    .legal-popover-arrow {
        display: none;
    }
}

/* 
   Personalizare Scrollbar pentru #dialog-window
   Vizibil doar pe desktop, discret și adaptat temelor.
*/
@media (min-width: 769px) {
    #dialog-window::-webkit-scrollbar {
        width: 6px;
    }

    #dialog-window::-webkit-scrollbar-track {
        background: transparent;
    }

    #dialog-window::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.1);
        border-radius: 10px;
        transition: background 0.3s ease;
    }

    #dialog-window::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.2);
    }

    /* Suport pentru Dark Mode */
    [data-theme="dark"] #dialog-window::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
    }

    [data-theme="dark"] #dialog-window::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.3);
    }
}

/* Ascundere scrollbar pe mobil pentru o experiență nativă mai curată */
@media (max-width: 768px) {
    #dialog-window {
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }
    #dialog-window::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }
}

.source-name-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    max-width: 60%;
    padding-right: 10px;
    mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 90%, rgba(0, 0, 0, 0));
    -webkit-mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) 90%, rgba(0, 0, 0, 0));
}

.active {
    background-color: var(--accent-color) !important;
    color: white !important;
    transform: scale(0.95) !important;
    transition: transform 0.1s ease !important;
}

.source-logo {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: transparent;
    padding: 5px;
}

/* ========================================================================
   ========================= ANIMATIONS & EFFECTS ========================
   ======================================================================== */
@keyframes shake {
    0% {
        transform: translate(0);
    }

    10%,
    20% {
        transform: translate(-5px, 0);
    }

    30%,
    50%,
    70%,
    90% {
        transform: translate(5px, 0);
    }

    40%,
    60%,
    80% {
        transform: translate(-5px, 0);
    }

    100% {
        transform: translate(0);
    }
}

.shake-animation {
    animation: shake 0.6s;
}

/* ========================================================================
   ========================= MOBILE ELEMENTS =============================
   ======================================================================== */
.conversation-list {
    display: none;
}

#mobile-header-wrapper {
    display: none;
}

#chat-mobile-header {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    padding: 15px 30px;
    display: none;
    box-shadow: 0 6px 30px 0 rgba(0, 0, 0, 0.25), 0 2px 6px 0 rgba(0, 0, 0, 0.15);
}

#chat-mobile-header i {
    background-color: white;
    padding: calc(var(--basic-size)* 1);
    border-radius: 50%;
    cursor: pointer;
    height: calc(var(--basic-size)* 1.5);
    width: calc(var(--basic-size)* 1.5);
    font-size: 20px;
    color: var(--dark-color);
}

#chat-mobile-header svg {
    background-color: white;
    padding: calc(var(--basic-size)* 0.7);
    border-radius: 50%;
    cursor: pointer;
    height: calc(var(--basic-size)* 2);
    width: calc(var(--basic-size)* 2);
    font-size: 20px;
    color: var(--dark-color);
}

#menu-icon {
    text-align: center;
}

#chat-title {
    color: white;
    font-size: calc(var(--basic-size) * 1.375);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 65%;
    text-align: center;
}

/* ========================================================================
   ========================= IMAGE ELEMENTS ==============================
   ======================================================================== */
.image-container {
    background: transparent;
    border-radius: 20px;
}

.image-container img {
    width: 100%;
    height: 100%;
    display: block;
    opacity: 0;
    transition: opacity 0.5s;
}

.image-container img.loaded {
    opacity: 1;
}

/* ========================================================================
   ========================= MINI BROWSER ===============================
   ======================================================================== */
#mini-browser {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #fff;
    z-index: 110000;
    box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
    display: none;
}

#mini-browser .top-bar {
    height: 50px;
    background-color: #333;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
}

#mini-browser .top-bar button {
    background: none;
    color: #fff;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

#mini-browser .bottom-bar {
    height: calc(var(--basic-size) * 4);
    background-color: #333;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 0;
    width: 100%;
}

#mini-browser .bottom-bar button {
    background: none;
    color: #fff;
    border: none;
    font-size: calc(var(--basic-size) * 1.25);
    cursor: pointer;
    padding: 10px 20px;
}

#mini-browser iframe {
    width: 100%;
    height: calc(100vh - 50px);
    border: none;
}

/* ========================================================================
   ========================= LOADER & SPINNER ===========================
   ======================================================================== */
.loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}


/* ========================================================================
   ========================= BACK TO TOP BUTTON ==========================
   ======================================================================== */
#back-to-top {
    position: fixed;
    right: calc(var(--basic-size) * 5);
    bottom: calc(var(--basic-size) * 4);
    width: calc(var(--basic-size) * 4);
    height: calc(var(--basic-size) * 4);
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
    z-index: 9999;
}

#back-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
    background: rgba(0, 0, 0, 0.9);
}

#back-to-top i {
    font-size: calc(var(--basic-size) * 1.8);
}

#back-to-top:active {
    transform: translateY(0);
}

#back-to-top.show {
    display: flex;
    opacity: 1;
}

@media (max-width: 768px) {
    #back-to-top {
        display: none !important;
        right: 12px;
        bottom: 12px;
        width: 40px;
        height: 40px;
    }
}

/* ========================================================================
   ========================= LINKS & INTERACTIONS ========================
   ======================================================================== */
.source-link {
    cursor: pointer;
}

/* ========================================================================
   ========================= MODALS & OVERLAYS ==========================
   ======================================================================== */
.open {
    max-height: 100% !important;
    opacity: 1 !important;
}

.generic-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 110000;
    justify-content: center;
    align-items: center;
}

.generic-modal.open {
    display: flex;
}

.generic-modal-content {
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    max-width: 650px;
    width: 95%;
    max-height: 90vh;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    position: relative;
}

.generic-modal-content::-webkit-scrollbar {
    display: none;
}


.generic-modal-close {
    position: absolute;
    top: calc(var(--basic-size) * 1.5);
    right: calc(var(--basic-size) * 1.5);
    font-size: calc(var(--basic-size) * 2.5);
    width: calc(var(--basic-size) * 2.5);
    height: calc(var(--basic-size) * 2.5);
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--dark-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

.generic-modal-close:hover {
    border-radius: 50%;
    background: var(--secondary-color);
    transition: background 0.2s;
}

.pwa-ios-guide__header {
    padding-right: calc(var(--basic-size) * 2);
}

.pwa-ios-guide__title {
    font-size: calc(var(--basic-size) * 1.8);
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 6px;
}

.pwa-ios-guide__subtitle {
    font-size: calc(var(--basic-size) * 1.1);
    color: rgba(0, 0, 0, 0.65);
    line-height: 1.35;
    margin-bottom: calc(var(--basic-size) * 1.5);
}

.pwa-ios-guide__steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: calc(var(--basic-size) * 1.1);
}

.pwa-ios-guide__step {
    display: flex;
    align-items: flex-start;
    gap: calc(var(--basic-size) * 1);
    padding: calc(var(--basic-size) * 1);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.03);
}

.pwa-ios-guide__icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.06);
    color: var(--dark-color);
    flex: 0 0 auto;
}

.pwa-ios-guide__icon svg {
    display: block;
}

.pwa-ios-guide__text {
    font-size: calc(var(--basic-size) * 1.1);
    color: var(--dark-color);
    line-height: 1.35;
}

.pwa-highlight {
    position: relative;
}

.pwa-highlight::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 16px;
    border: 2px solid rgba(116, 3, 67, 0.55);
    opacity: 0;
    animation: pwaPulse 1.6s ease-out infinite;
    pointer-events: none;
}

@keyframes pwaPulse {
    0% {
        transform: scale(0.92);
        opacity: 0.0;
    }
    20% {
        opacity: 0.9;
    }
    100% {
        transform: scale(1.18);
        opacity: 0.0;
    }
}

@keyframes pwaSheetIn {
    from {
        transform: translateY(14px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media screen and (max-width: 768px) {
    .generic-modal.generic-modal--bottom-sheet {
        align-items: flex-end;
    }

    .generic-modal.generic-modal--bottom-sheet .generic-modal-content {
        width: 100%;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        padding: calc(var(--basic-size) * 1.25);
        max-height: 80vh;
        overflow: auto;
    }

    .generic-modal.generic-modal--legal-search-help .generic-modal-content {
        padding: 56px 16px 20px;
        max-height: min(78vh, 640px);
    }

    .generic-modal.generic-modal--legal-doc-info .generic-modal-content {
        padding: 56px 18px calc(env(safe-area-inset-bottom, 0px) + 56px);
        max-height: min(78vh, 640px);
    }

    .generic-modal.generic-modal--legal-doc-actions .generic-modal-content {
        padding: 56px 18px calc(env(safe-area-inset-bottom, 0px) + 56px);
        max-height: min(78vh, 640px);
    }

    .generic-modal.generic-modal--legal-doc-view-switcher .generic-modal-content {
        padding: 56px 18px calc(env(safe-area-inset-bottom, 0px) + 56px);
        max-height: min(78vh, 640px);
    }

    .generic-modal.generic-modal--legal-search-help .generic-modal-close,
    .generic-modal.generic-modal--legal-doc-info .generic-modal-close,
    .generic-modal.generic-modal--legal-doc-actions .generic-modal-close,
    .generic-modal.generic-modal--legal-doc-view-switcher .generic-modal-close {
        top: 12px;
        right: 12px;
        width: 38px;
        height: 38px;
        font-size: 22px;
        background: #f1f5f9;
        border-radius: 999px;
        color: #475569;
        z-index: 2;
    }

    .generic-modal.generic-modal--bottom-sheet.open .generic-modal-content {
        animation: pwaSheetIn 180ms ease-out;
    }
}

/* ========================================================================
   ========================= DROPDOWN MENUS ==============================
   ======================================================================== */
#user-widget-wrapper {
    position: relative;
}

.dropdown-menu {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 8px 0;
    z-index: 1;
    position: absolute;
    bottom: 60px;
    width: 100%;
    opacity: 0;
    transform: scaleY(0.95);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.dropdown-menu.show {
    opacity: 1;
    transform: scaleY(1);
    pointer-events: auto;
}



.menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 16px;
    background: none;
    border: none;
    text-align: left;
    font-size: calc(var(--basic-size) * 1.25);
    color: #333;
    cursor: pointer;
    transition: background 0.2s;
    font-family: var(--font-family);
    text-decoration: none;
    line-height: 1.3;
}

.menu-item i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.menu-item:hover {
    background: #f0f0f0;
}

.menu-divider {
    margin: 6px 0;
    border: none;
    border-top: 1px solid #eee;
}

.logout {
    color: #d33;
}

h2 {
    font-size: 20px;
    margin-bottom: 20px;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.tag.selected {
    background: var(--dark-color);
    color: white;
}

/* ========================================================================
   ========================= DOT PULSE LOADER ============================
   ======================================================================== */
.dot-pulse-wrapper {
    display: flex;
    justify-content: center;
    padding: 10px;
    transition: all 0.3s ease-in-out;
    min-width: 50px;
}

.dot-pulse {
    position: relative;
    left: -9999px;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 9999px 0 0 -5px;
    animation: dot-pulse 1.5s infinite linear;
    animation-delay: 0.25s;
}

.dot-pulse::before,
.dot-pulse::after {
    content: "";
    display: inline-block;
    position: absolute;
    top: 0;
    width: 10px;
    height: 10px;
    border-radius: 5px;
    background-color: var(--accent-color);
    color: var(--accent-color);
}

.dot-pulse::before {
    box-shadow: 9984px 0 0 -5px;
    animation: dot-pulse-before 1.5s infinite linear;
    animation-delay: 0s;
}

.dot-pulse::after {
    box-shadow: 10014px 0 0 -5px;
    animation: dot-pulse-after 1.5s infinite linear;
    animation-delay: 0.5s;
}

@keyframes dot-pulse-before {
    0% {
        box-shadow: 9984px 0 0 -5px;
    }

    30% {
        box-shadow: 9984px 0 0 2px;
    }

    60%,
    100% {
        box-shadow: 9984px 0 0 -5px;
    }
}

@keyframes dot-pulse {
    0% {
        box-shadow: 9999px 0 0 -5px;
    }

    30% {
        box-shadow: 9999px 0 0 2px;
    }

    60%,
    100% {
        box-shadow: 9999px 0 0 -5px;
    }
}

@keyframes dot-pulse-after {
    0% {
        box-shadow: 10014px 0 0 -5px;
    }

    30% {
        box-shadow: 10014px 0 0 2px;
    }

    60%,
    100% {
        box-shadow: 10014px 0 0 -5px;
    }
}

.login-button {
    text-decoration: none;
}

/* ========================================================================
   ========================= NOTIFICATIONS ===============================
   ======================================================================== */
.notification-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    z-index: 9999;
    pointer-events: none;
}

.notification {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--light-gray);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 1rem 1.5rem;
    margin: 0 auto;
    width: calc(100% - 4rem);
    max-width: 600px;
    pointer-events: all;
    transition: transform 0.4s ease, opacity 0.4s ease;
    opacity: 0;
    transform: translateY(-30px);
    gap: 12px;
    position: relative;
    border: 1px solid rgba(0,0,0,0.05);
}

.notification.show {
    opacity: 1;
    transform: translateY(0);
}

.notification .icon {
    flex-shrink: 0;
    font-size: 1.4rem;
    border-radius: 50%;
    width: calc(var(--basic-size) * 2.5);
    height: calc(var(--basic-size) * 2.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.notification.success .icon {
    background-color: #2ecc71;
}

.notification.info .icon {
    background-color: #3498db;
}

.notification.warning .icon {
    background-color: #f1c40f;
}

.notification.alert .icon {
    background-color: #e74c3c;
}

.notification .message {
    flex: 1;
    font-size: 1rem;
    color: var(--dark-color);
    /* background-color: var(--light-gray); */
    padding: 0px;
}

.notification .close-btn {
    background: none;
    border: none;
    font-size: calc(var(--basic-size) * 2);
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s ease;
}

.notification .close-btn:hover {
    color: #000;
}

/* ========================================================================
   ========================= STATE ELEMENTS ==============================
   ======================================================================== */
.inactive {
    background-color: var(--border-color) !important;
    color: var(--dark-color) !important;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.08);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.inactive:hover {
    background-color: var(--dark-color);
    color: white !important;
    box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.2), 0px 3px 6px rgba(0, 0, 0, 0.15);
}

/* ========================================================================
   ========================= PLACEHOLDER ELEMENTS ========================
   ======================================================================== */
.placeholder {
    animation: pulse 1.5s infinite;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.image-placeholder {
    animation: pulse 1.5s infinite;
    background: #ccc;
    border-radius: 8px;
    opacity: 1 !important;
    /* asigură afișarea placeholder-ului când img are opacity 0 implicit */
}

.text-placeholder {
    animation: pulse 1.5s infinite;
    height: 15px;
    background: #ccc;
    border-radius: 4px;
}

.text-placeholder.short {
    width: 50%;
}

.text-placeholder.long {
    width: 80%;
}

@keyframes pulse {
    0% {
        background-color: #ccc;
    }

    50% {
        background-color: #ddd;
    }

    100% {
        background-color: #ccc;
    }
}

/* ========================================================================
   ========================= TIME ELEMENTS ===============================
   ======================================================================== */
.published-time {
    font-size: calc(var(--basic-size) * 1.1);
    color: var(--dark-color);
    margin-top: 5px;
    font-weight: 400;
    line-height: calc(var(--basic-size) * 1.5);
}

/* ========================================================================
   ========================= SETTINGS ====================================
   ======================================================================== */
#settings-wrapper {
    height: 70vh;
    min-height: 500px;
    display: flex;
    flex-direction: column;
}

#settings-wrapper::-webkit-scrollbar {
    width: 6px;
}

#settings-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

#settings-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

#settings {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#settings .content {
    flex: 1;
    overflow-y: auto;
    padding-right: 20px;
    margin-right: -10px;
}

#settings .content::-webkit-scrollbar {
    width: 6px;
}

#settings .content::-webkit-scrollbar-track {
    background: transparent;
}

#settings .content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    transition: background 0.3s ease;
}

#settings .content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Suport pentru Dark Mode în Setări */
[data-theme="dark"] #settings .content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] #settings .content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Stiluri pentru butoanele de categorie din sidebar */
#settings .sidebar {
    display: flex;
    flex-direction: row;
    width: 97%;
    margin-bottom: 24px;
    background-color: #f3f4f6;
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}

#settings .sidebar button {
    flex: 1;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    padding: 10px;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

#settings .sidebar button:hover {
    color: #111827;
    background-color: rgba(255, 255, 255, 0.5);
}

#settings .sidebar button.active-settings {
    background-color: #fff;
    color: #111827;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Stiluri utilitare pentru input-uri și label-uri în toate secțiunile */
.setting {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    display: block;
}

.setting-input, 
.setting-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background-color: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.setting-input:focus, 
.setting-textarea:focus {
    outline: none;
    border-color: #111827;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.05);
}

.setting-textarea {
    min-height: 100px;
    resize: vertical;
}

.btn-dark {
    background-color: #111827;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-dark:hover {
    background-color: #1f2937;
}

.btn-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

/* Stiluri pentru checkbox-uri */
.setting input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

.section {
    display: none;
}

@keyframes sectionFadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.section.active-settings {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    color: var(--dark-color) !important;
    font-size: calc(var(--basic-size) * 1.25);
    font-weight: 400;
    line-height: calc(var(--basic-size) * 1.5);
    background-color: white !important;
    animation: sectionFadeIn 0.3s ease-out forwards;
}

/* Structurare mai clară pentru conținutul secțiunii de setări */
#settings .content .section {
    gap: 16px;
}

/* Card-based settings layout */
.settings-group {
    margin-bottom: 24px;
}

.group-title {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    padding-left: 4px;
}

.settings-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease;
}

/* ========================================================================
   ========================= LEGAL SEARCH PAGE ============================
   ======================================================================== */
.legal-search-page,
#legal-doc-view {
    --legal-search-page-max-width: 1160px;
}

.legal-search-page {
    width: 100%;
    max-width: var(--legal-search-page-max-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    color: var(--dark-color);
}

.legal-search-header {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legal-search-title-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.legal-search-title {
    margin: 0;
    font-size: 34px;
    line-height: 1.2;
    color: #151e2b;
}

.legal-search-subtitle {
    margin: 0;
    max-width: 720px;
    font-size: 15px;
    line-height: 1.6;
    color: #5b6574;
}

.legal-search-desktop-help-trigger {
    display: none;
}

.legal-search-shell,
.legal-search-results-toolbar,
.legal-search-pagination {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 22px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.legal-search-shell {
    background: transparent;
    border: 0;
    padding: 0;
    box-shadow: none;
}

.legal-search-main-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.legal-search-content-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
}

.legal-search-filters-panel {
    width: auto;
    min-width: 0;
    max-width: none;
    height: auto;
    align-self: flex-start;
    flex: none;
    display: none;
    overflow: visible;
    border: 1px solid var(--border-color);
}

.legal-search-filters-title {
    margin: 0;
    font-size: 18px;
    line-height: 1.35;
    color: #151e2b;
}

.legal-search-filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.legal-search-reset-filters-shell {
    width: 100%;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(-8px);
    pointer-events: none;
    transition: max-height 0.26s ease, opacity 0.2s ease, transform 0.2s ease;
}

.legal-search-reset-filters-shell.is-visible {
    max-height: 36px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.legal-search-reset-filters-button {
    appearance: none;
    width: 100%;
    height: 36px;
    max-height: 36px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 10px;
    background: #ffffff;
    color: #1f2937;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    font-size: 15px;
    font-weight: 700;
    font-family: var(--body-font);
    line-height: 1;
    cursor: pointer;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
    transition: border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.legal-search-reset-filters-button:hover {
    border-color: #d7dee8;
    color: #0f172a;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.legal-search-reset-filters-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.16), 0 8px 18px rgba(15, 23, 42, 0.08);
}

.legal-search-reset-filters-button i {
    font-size: 13px;
}

.legal-search-apply-filters-button {
    width: 100%;
    min-height: 38px;
    height: 38px;
    border: 0;
    border-radius: 8px;
    background: #070b10;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    font-family: var(--body-font);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    margin-top: 12px;
}

.legal-search-apply-filters-button:hover {
    background: #111827;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.16);
}

.legal-search-apply-filters-button:active {
    transform: translateY(1px);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
}

.legal-search-apply-filters-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.2), 0 8px 18px rgba(15, 23, 42, 0.12);
}

.legal-search-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.legal-search-searchbar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.legal-search-query-field {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 56px;
    padding: 10px 18px;
    border: 1px solid var(--border-color);
    border-radius: 28px;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.legal-search-query-field:focus-within {
    border-color: rgba(148, 163, 184, 0.52);
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.12);
}

.legal-search-query-icon {
    align-self: flex-start;
    padding-top: 8px;
    color: #727676;
    font-size: 15px;
}

.legal-search-query-input {
    flex: 1;
    display: block;
    width: 100%;
    min-height: 24px;
    max-height: 168px;
    border: none;
    background: transparent;
    color: #151e2b;
    font-size: 15px;
    line-height: 1.55;
    font-family: var(--body-font);
    resize: none;
    overflow-y: hidden;
    padding: 8px 0;
    margin: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
}

.legal-search-query-input:focus {
    outline: none;
}

.legal-search-query-input::placeholder {
    color: #8a94a6;
}

.legal-search-query-input::-webkit-scrollbar {
    width: 6px;
}

.legal-search-query-input::-webkit-scrollbar-track {
    background: transparent;
}

.legal-search-query-input::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    transition: background 0.3s ease;
}

.legal-search-query-input::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

.legal-search-query-clear {
    display: none;
}

[data-theme="dark"] .legal-search-query-input::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .legal-search-query-input::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.legal-search-submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 148px;
    min-height: 40px;
    border: none;
    border-radius: 999px;
    padding: 0 22px;
    background: #111318;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 18px rgba(17, 19, 24, 0.14);
}

.legal-search-submit-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(17, 19, 24, 0.18);
}

.legal-search-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.legal-search-mode-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-right: auto;
}

.legal-search-mode-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 999px;
    background: #ffffff;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-family);
    color: #4a5568;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.legal-search-mode-pill:hover {
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.4);
}

.legal-search-mode-pill[aria-pressed="true"] {
    background: rgba(241, 245, 249, 0.9);
    border-color: rgba(148, 163, 184, 0.5);
    color: #151e2b;
}

.legal-search-mode-pill:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.12);
}

.legal-search-settings-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 999px;
    background: #ffffff;
    color: #151e2b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.legal-search-settings-button:hover,
.legal-search-settings-button[aria-expanded="true"] {
    border-color: rgba(148, 163, 184, 0.48);
    background: #f8fafc;
}

.legal-search-settings-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.12);
}

.legal-search-advanced {
    padding: 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 18px;
    background: #fbfcfd;
}

.legal-search-advanced-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 16px;
    column-gap: 8px;
}

.legal-search-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legal-search-field-label {
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
}

.legal-search-field-input {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 12px;
    background: #ffffff;
    color: #151e2b;
    font-size: 14px;
    box-sizing: border-box;
}

.legal-search-field-input:focus {
    outline: none;
    border-color: rgba(148, 163, 184, 0.52);
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.12);
}

.legal-search-court-select {
    position: relative;
}

.legal-search-court-trigger {
    width: 100%;
    justify-content: space-between;
    padding: 0 16px;
    border-radius: 12px;
}

.legal-search-court-menu {
    left: 0;
    right: auto;
    width: 100%;
    min-width: 0;
    padding: 8px;
}

.legal-search-court-option {
    min-height: 44px;
}

.legal-search-results-section {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

.legal-search-results-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: nowrap;
    min-width: 0;
    padding: 16px 22px;
    border-radius: 14px;
}

.legal-search-results-count {
    min-width: 0;
    margin: 0;
    color: var(--dark-color);
    font-size: 16px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.legal-search-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    flex: 0 0 auto;
}

@media (max-width: 1024px), (max-height: 519px) {
    #legal-search-active-filters,
    .legal-search-active-filters,
    .legal-search-results-toolbar {
        display: none;
    }
}

.legal-search-results-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

.legal-search-pagination {
    padding: 16px 22px;
    border-radius: 14px;
}

.legal-search-view-mode {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
}

.legal-search-view-mode-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 9px;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.legal-search-view-mode-button:hover {
    background: #ffffff;
    border-color: rgba(203, 213, 225, 0.95);
    color: #0f172a;
}

.legal-search-view-mode-button.is-active {
    background: #eef2f7;
    color: #0f172a;
    border-color: rgba(203, 213, 225, 0.95);
    box-shadow: none;
}

.legal-search-view-mode-button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.legal-search-view-mode-button i {
    font-size: 13px;
}

.legal-search-results-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #151e2b;
}

.legal-search-sort {
    position: relative;
    display: flex;
    align-items: center;
}

.legal-search-favorites-toggle[aria-pressed="true"] {
    background: #111318;
    border-color: #111318;
    color: #ffffff;
    box-shadow: 0 10px 18px rgba(17, 19, 24, 0.12);
}

.legal-search-favorites-toggle[aria-pressed="true"] .legal-search-sort-trigger-icon {
    color: #f8d66d;
}

.legal-search-sort-trigger {
    appearance: none;
    border: 1px solid rgba(226, 232, 240, 0.95);
    background: #ffffff;
    color: #334155;
    border-radius: 12px;
    min-height: 42px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--body-font);
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.legal-search-sort-trigger:hover,
.legal-search-sort-trigger[aria-expanded="true"] {
    background: #f8fafc;
    border-color: rgba(203, 213, 225, 0.95);
    color: #0f172a;
}

.legal-search-sort-trigger:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.12);
}

.legal-search-sort-trigger-icon,
.legal-search-sort-trigger-caret {
    font-size: 12px;
    color: #64748b;
}

.legal-search-sort-trigger-caret {
    transition: transform 0.18s ease;
}

.legal-search-sort-trigger[aria-expanded="true"] .legal-search-sort-trigger-caret {
    transform: rotate(180deg);
}

.legal-search-sort-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    padding: 6px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
    z-index: 20;
}

.legal-search-sort-option {
    width: 100%;
    appearance: none;
    border: none;
    background: transparent;
    border-radius: 10px;
    padding: 10px 12px;
    color: #334155;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--body-font);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: background 0.18s ease, color 0.18s ease;
}

.legal-search-sort-option:hover {
    background: #f8fafc;
    color: #0f172a;
}

.legal-search-sort-option[aria-checked="true"] {
    color: #0f172a;
}

.legal-search-sort-option-check {
    font-size: 12px;
    color: #64748b;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.legal-search-sort-option[aria-checked="true"] .legal-search-sort-option-check {
    opacity: 1;
}

.legal-search-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.legal-search-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid rgba(226, 232, 240, 0.95);
    color: #5b6574;
    font-size: 12px;
    font-weight: 600;
}

.legal-search-filter-pill-label {
    display: inline-flex;
    align-items: center;
}

.legal-search-filter-pill-remove {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
    color: #475569;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.legal-search-filter-pill-remove:hover {
    background: rgba(100, 116, 139, 0.22);
    color: #151e2b;
    transform: scale(1.05);
}

.legal-search-filter-pill-remove:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.35);
    outline-offset: 2px;
}

.legal-search-results-list {
    --legal-search-results-fade-size: 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    transition: opacity 0.18s ease, filter 0.18s ease;
}

.legal-search-results-list.is-refreshing {
    opacity: 0.62;
    filter: saturate(0.9);
}

.legal-search-result-card {
    padding: 18px 20px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
    transition: box-shadow 0.2s ease;
}

.legal-search-result-card:hover {
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.07);
}

.legal-search-result-topline,
.legal-search-result-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.legal-search-result-topline {
    flex-wrap: wrap;
}

.legal-search-result-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid rgba(226, 232, 240, 0.95);
    color: #475569;
    font-size: 12px;
    font-weight: 600;
}

.legal-search-result-date {
    font-size: 13px;
    color: #64748b;
}

.legal-search-result-title {
    margin: 14px 0 10px;
    font-size: 18px;
    line-height: 1.35;
    color: #151e2b;
}

.legal-search-result-summary {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.6;
    color: #000000;
}

.legal-search-result-summary.is-collapsed {
    max-height: 200px;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 82%, transparent 100%);
}

.legal-search-result-summary.is-expanded {
    max-height: none;
    overflow: visible;
    -webkit-mask-image: none;
    mask-image: none;
}

.legal-search-result-summary > :first-child {
    margin-top: 0;
}

.legal-search-result-summary > :last-child {
    margin-bottom: 0;
}

.legal-search-term-highlight {
    padding: 0;
    background: yellow;
    /* text-decoration-line: underline;
    text-decoration-style: solid;
    text-decoration-color: rgba(74, 85, 104, 0.55);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px; */
    color: inherit;
}

.legal-search-summary-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: -4px 0 16px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #151e2b;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
}

.legal-search-summary-toggle::before {
    content: "";
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: transform 0.18s ease;
}

.legal-search-summary-toggle[aria-expanded="true"]::before {
    transform: rotate(180deg);
}

.legal-search-summary-toggle[hidden] {
    display: none;
}

.legal-search-summary-toggle:hover {
    color: #000;
}

.legal-search-summary-toggle:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.35);
    outline-offset: 3px;
    border-radius: 8px;
}

.legal-search-result-meta {
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: nowrap;
    min-width: 0;
    padding-top: 14px;
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    font-size: 13px;
    color: #5b6574;
}

.legal-search-result-meta-text {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.legal-search-result-meta-item {
    min-width: 0;
    max-width: 32%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 0 1 auto;
}

.legal-search-result-meta-item:nth-of-type(2) {
    max-width: 46%;
}

.legal-search-result-meta-separator {
    flex: 0 0 auto;
    color: #94a3b8;
}

.legal-search-result-meta strong {
    color: #151e2b;
}

.legal-search-result-meta-badge {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    padding: 4px 10px;
    border: 1px solid rgba(21, 30, 43, 0.12);
    border-radius: 999px;
    background: #f8fafc;
    color: #151e2b;
    font-weight: 600;
}

.legal-search-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.legal-search-result-action {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: #ffffff;
    color: #151e2b;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    font-family: var(--body-font);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.legal-search-result-action:hover {
    transform: translateY(-1px);
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.48);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
}

.legal-search-result-action-primary {
    background: #111318;
    border-color: #111318;
    color: #ffffff;
    box-shadow: 0 10px 18px rgba(17, 19, 24, 0.14);
}

.legal-search-result-action-primary:hover {
    background: #0b0d11;
    border-color: #0b0d11;
}

.legal-search-result-action-favorite {
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 999px;
    padding: 0 16px;
    min-height: 38px;
    background: transparent;
    color: #151e2b;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--body-font);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: none;
}

.legal-search-result-action-favorite::before {
    content: "";
    width: 13px;
    height: 16px;
    flex: 0 0 13px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.legal-search-result-action-favorite:hover {
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.48);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.legal-search-result-action-favorite.is-active,
.legal-search-result-action-favorite.is-active:hover {
    background: transparent;
    color: #151e2b;
    border-color: rgba(148, 163, 184, 0.32);
    box-shadow: none;
    transform: none;
}

.legal-search-result-action-favorite.is-active::before {
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.ai-stream-error {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.ai-stream-retry-button::before {
    width: 15px;
    height: 15px;
    flex-basis: 15px;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16'/%3E%3Cpath d='M3 21v-5h5'/%3E%3Cpath d='M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8'/%3E%3Cpath d='M16 8h5V3'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16'/%3E%3Cpath d='M3 21v-5h5'/%3E%3Cpath d='M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8'/%3E%3Cpath d='M16 8h5V3'/%3E%3C/svg%3E") center / contain no-repeat;
}

.ai-stream-retry-button:disabled {
    cursor: default;
    opacity: 0.72;
    transform: none;
    box-shadow: none;
}

.legal-search-empty-state {
    padding: 28px 20px;
    border: 1px dashed rgba(148, 163, 184, 0.35);
    border-radius: 18px;
    text-align: center;
    background: #fbfbfc;
}

.legal-search-empty-state:not([hidden]) {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.legal-search-empty-title {
    margin: 0 0 8px;
    font-size: 18px;
    color: #151e2b;
}

.legal-search-empty-copy,
.legal-search-load-status {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #5b6574;
}

.legal-search-empty-help {
    margin-top: 16px;
}

.legal-search-help-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #5b6574;
    font: inherit;
    line-height: 1.5;
    cursor: pointer;
    transition: color 0.18s ease, transform 0.18s ease;
}

.legal-search-help-trigger:hover,
.legal-search-help-trigger:focus-visible {
    color: #324153;
    transform: translateY(-1px);
}

.legal-search-help-trigger:focus-visible {
    outline: none;
}

.legal-search-help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.legal-search-help-modal {
    display: grid;
    gap: 16px;
    color: #243142;
}

.legal-search-help-modal h3 {
    margin: 0;
    font-size: 22px;
    line-height: 1.3;
    color: #151e2b;
}

.legal-search-help-modal p {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
    color: #4c5a6c;
}

.legal-search-help-list {
    margin: 0;
    padding-left: 20px;
    color: #314052;
    font-size: 14px;
    line-height: 1.7;
}

.legal-search-help-example {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 16px;
    background: linear-gradient(180deg, #f8fafc 0%, #f2f5f8 100%);
}

.legal-search-help-example-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #637186;
}

.legal-search-help-example-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
    color: #1f2b38;
}

.legal-search-help-example-button {
    justify-self: flex-start;
    min-width: 0;
    width: auto;
}

.legal-search-help-example-button:hover,
.legal-search-help-example-button:focus-visible {
    outline: none;
}

.legal-search-load-status {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 22px;
}

.legal-search-load-status:empty {
    display: none;
}

.legal-search-load-status.is-info {
    color: #5b6574;
}

.legal-search-load-status.is-loading {
    color: #324153;
}

.legal-search-load-status.is-error {
    color: #a04343;
}

.legal-search-load-status.is-loading::before {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 999px;
    border: 2px solid rgba(50, 65, 83, 0.2);
    border-top-color: currentColor;
    animation: legal-search-status-spin 0.8s linear infinite;
    flex: 0 0 auto;
}

.legal-search-sentinel {
    width: 100%;
    height: 1px;
}

.legal-search-pagination {
    display: none;
}

@keyframes legal-search-status-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 1024px) {
    .legal-search-advanced-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1025px) and (min-height: 520px) {
    #dialog-window.legal-search-dialog-window {
        overflow: hidden;
    }

    .legal-search-page {
        --legal-search-page-max-width: none;
    }

    .legal-search-page {
        gap: 20px;
        max-width: none;
        min-width: 0;
        height: 100%;
        min-height: 0;
        padding: 0 10px;
        box-sizing: border-box;
        overflow: hidden;
        display: grid;
        grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
        grid-template-rows: auto auto minmax(0, 1fr);
        column-gap: 18px;
        row-gap: 20px;
    }

    .legal-search-header {
        grid-column: 1 / -1;
        grid-row: 1;
        gap: 6px;
    }

    .legal-search-title-row {
        justify-content: space-between;
    }

    .legal-search-title {
        font-size: 32px;
    }

    .legal-search-desktop-help-trigger {
        appearance: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        min-height: 36px;
        padding: 0 16px;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        background: #ffffff;
        color: #1f2937;
        font-family: var(--body-font);
        font-size: 14px;
        font-weight: 700;
        line-height: 1;
        cursor: pointer;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
        transition: border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease, transform 0.18s ease;
    }

    .legal-search-desktop-help-trigger:hover,
    .legal-search-desktop-help-trigger:focus-visible {
        border-color: #cbd5e1;
        color: #0f172a;
        box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
        transform: translateY(-1px);
    }

    .legal-search-desktop-help-trigger:focus-visible {
        outline: none;
        box-shadow: 0 0 0 3px rgba(176, 0, 90, 0.14), 0 6px 16px rgba(15, 23, 42, 0.08);
    }

    .legal-search-desktop-help-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 16px;
        height: 16px;
        border: 1.5px solid #64748b;
        border-radius: 999px;
        color: #64748b;
        font-size: 10px;
        font-weight: 800;
        line-height: 1;
    }

    .legal-search-shell {
        grid-column: 2;
        grid-row: 2;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
    }

    .legal-search-form {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: stretch;
        gap: 12px;
    }

    .legal-search-searchbar {
        min-width: 0;
    }

    .legal-search-query-field {
        align-items: center;
        min-height: 38px;
        padding: 0 18px;
        border-radius: 14px;
    }

    .legal-search-query-icon {
        align-self: center;
        padding-top: 0;
    }

    .legal-search-query-input {
        padding: 0;
    }

    .legal-search-query-clear {
        flex: 0 0 auto;
        align-self: center;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        padding: 0;
        border: 1px solid rgba(203, 213, 225, 0.7);
        border-radius: 999px;
        background: rgba(248, 250, 252, 0.75);
        color: #64748b;
        font-size: 15px;
        font-weight: 600;
        line-height: 1;
        cursor: pointer;
        box-shadow: none;
        transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    }

    .legal-search-query-clear[hidden] {
        display: none;
    }

    .legal-search-query-clear:hover {
        background: rgba(226, 232, 240, 0.85);
        border-color: rgba(148, 163, 184, 0.78);
        color: #0f172a;
    }

    .legal-search-query-clear:focus-visible {
        outline: none;
        box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.1);
    }

    .legal-search-query-clear span {
        display: block;
        transform: translateY(-1px);
    }

    .legal-search-actions {
        align-items: stretch;
        justify-content: flex-end;
        flex-wrap: nowrap;
        gap: 12px;
    }

    .legal-search-shell .legal-search-settings-button {
        display: none;
    }

    .legal-search-submit-button {
        min-width: 136px;
        min-height: 38px;
        border-radius: 12px;
    }

    .legal-search-main-layout {
        display: contents;
    }

    .legal-search-content-column {
        grid-column: 2;
        grid-row: 3;
        gap: 14px;
        height: 100%;
        min-height: 0;
    }

    .legal-search-filters-panel {
        grid-column: 1;
        grid-row: 2 / span 2;
        display: flex;
        flex-direction: column;
        gap: 18px;
        min-width: 0;
        position: static;
        align-self: stretch;
        height: 100%;
        min-height: 0;
        max-height: none;
        box-sizing: border-box;
        padding: 22px;
        border: 1px solid var(--border-color);
        border-radius: 14px;
        background: #ffffff;
        box-shadow: 0 10px 26px rgba(15, 23, 42, 0.04);
        overflow-y: auto;
        margin-top: 0;
    }

    .legal-search-advanced--sidebar {
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .legal-search-advanced--sidebar .legal-search-advanced-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .legal-search-advanced--sidebar .legal-search-field {
        gap: 7px;
    }

    .legal-search-advanced--sidebar .legal-search-field + .legal-search-field {
        margin-top: 16px;
        padding-top: 16px;
        border-top: 1px solid rgba(226, 232, 240, 0.95);
    }

    .legal-search-advanced--sidebar .legal-search-field.legal-search-field--date-to {
        margin-top: 8px;
        padding-top: 0;
        border-top: 0;
    }

    .legal-search-advanced--sidebar .legal-search-field-label {
        color: #1f2937;
    }

    .legal-search-advanced--sidebar .legal-search-court-select {
        position: static;
    }

    .legal-search-advanced--sidebar .legal-search-court-trigger {
        display: none;
    }

    .legal-search-advanced--sidebar .legal-search-court-menu {
        position: static;
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        transform: none;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .legal-search-advanced--sidebar .legal-search-court-option {
        position: relative;
        display: grid;
        grid-template-columns: 18px minmax(0, 1fr);
        align-items: center;
        gap: 8px;
        min-height: 20px;
        padding: 0;
        border-radius: 0;
        font-size: 14px;
        line-height: 1.35;
        text-align: left;
    }

    .legal-search-advanced--sidebar .legal-search-court-option::before {
        content: "";
        width: 14px;
        height: 14px;
        border: 1.5px solid #94a3b8;
        border-radius: 3px;
        background: #ffffff;
        box-sizing: border-box;
    }

    .legal-search-advanced--sidebar .legal-search-court-option[aria-checked="true"]::before {
        border-color: var(--accent-color);
        background: var(--accent-color);
    }

    .legal-search-advanced--sidebar .legal-search-court-option > span:first-child {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .legal-search-advanced--sidebar .legal-search-court-option .legal-search-sort-option-check {
        position: absolute;
        left: 3px;
        top: 50%;
        display: flex;
        width: 9px;
        height: 9px;
        align-items: center;
        justify-content: center;
        color: #ffffff;
        font-size: 8px;
        line-height: 1;
        opacity: 0;
        transform: translateY(-50%);
        pointer-events: none;
    }

    .legal-search-advanced--sidebar .legal-search-court-option[aria-checked="true"] .legal-search-sort-option-check {
        opacity: 1;
    }

    .legal-search-advanced--sidebar .legal-search-court-option::marker {
        display: none;
    }

    .legal-search-advanced--sidebar .legal-search-field-input,
    .legal-search-advanced--sidebar .legal-search-court-trigger {
        min-height: 38px;
        border-radius: 8px;
    }

    .legal-search-advanced--sidebar .legal-search-field-input {
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .legal-search-results-section {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        box-sizing: border-box;
        gap: 16px;
    }

    .legal-search-results-panel {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        gap: 16px;
    }

    .legal-search-results-toolbar {
        padding: 0;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    #legal-search-pagination {
        padding: 0;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .legal-search-results-list:not(:empty) {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-mask-image: linear-gradient(
            to bottom,
            #000 0,
            #000 calc(101% - var(--legal-search-results-fade-size)),
            transparent 100%
        );
        mask-image: linear-gradient(
            to bottom,
            #000 0,
            #000 calc(101% - var(--legal-search-results-fade-size)),
            transparent 100%
        );
        padding: 5px 0px 0px 0px;
    }

    .legal-search-pagination:not([hidden]) {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        color: #334155;
        font-size: 14px;
    }

    .legal-search-pagination-pages {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
    }

    .legal-search-pagination-page,
    .legal-search-pagination-arrow {
        appearance: none;
        width: 36px;
        height: 36px;
        border: 0;
        border-radius: 999px;
        background: transparent;
        color: #334155;
        font-family: var(--body-font);
        font-size: 14px;
        font-weight: 700;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    }

    .legal-search-pagination-page:hover,
    .legal-search-pagination-arrow:hover {
        background: #f8fafc;
        color: #0f172a;
    }

    .legal-search-pagination-page:focus-visible,
    .legal-search-pagination-arrow:focus-visible {
        outline: none;
        box-shadow: 0 0 0 3px rgba(176, 0, 90, 0.16);
    }

    .legal-search-pagination-page.is-active {
        background: var(--accent-color);
        color: #ffffff;
        box-shadow: 0 10px 18px rgba(176, 0, 90, 0.22);
    }

    .legal-search-pagination-page:disabled,
    .legal-search-pagination-arrow:disabled {
        cursor: default;
        opacity: 0.48;
        box-shadow: none;
    }

    .legal-search-pagination-page.is-active:disabled {
        opacity: 1;
    }

    .legal-search-pagination-ellipsis {
        min-width: 28px;
        text-align: center;
        color: #64748b;
        font-weight: 700;
    }

    .legal-search-page-size {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        margin-left: auto;
        color: #334155;
        font-size: 14px;
        font-weight: 600;
        white-space: nowrap;
    }

    .legal-search-page-size select {
        min-width: 62px;
        height: 38px;
        padding: 0 30px 0 12px;
        border: 1px solid rgba(226, 232, 240, 0.95);
        border-radius: 10px;
        background: #ffffff;
        color: #334155;
        font-family: var(--body-font);
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
    }

    .legal-search-page-size select:focus-visible {
        outline: none;
        box-shadow: 0 0 0 3px rgba(176, 0, 90, 0.14);
    }

    .legal-search-results-toolbar {
        gap: 10px;
    }

    .legal-search-toolbar-actions {
        gap: 10px;
    }

    .legal-search-active-filters {
        display: none;
    }

    .legal-search-sort-trigger {
        min-height: 38px;
        border-radius: 8px;
    }

    .legal-search-empty-state {
        flex: 1 1 auto;
        border-radius: 12px;
    }
}

@media (min-width: 1025px) and (max-width: 1780px) and (min-height: 520px) {
    .legal-search-page {
        grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
    }

    aside.legal-search-filters-panel {
        width: 100%;
        max-width: 260px;
    }
}

@media (min-width: 1025px) and (max-height: 724px) {
    #main-stage.legal-search-stage {
        margin: 8px;
        height: calc(100% - 16px);
        border-radius: 18px;
    }

    .legal-search-page {
        gap: 12px;
        padding: 0 8px;
        grid-template-columns: minmax(0, 230px) minmax(0, 1fr);
        row-gap: 12px;
        column-gap: 14px;
    }

    .legal-search-header {
        margin: 10px 0 2px;
        gap: 4px;
    }

    @media (max-height: 719px) {
        header.legal-search-header {
            display: none;
        }
    }

    .legal-search-title {
        font-size: 28px;
        line-height: 1.12;
    }

    .legal-search-subtitle {
        font-size: 13px;
        line-height: 1.35;
    }

    .legal-search-form {
        gap: 10px;
    }

    .legal-search-query-field {
        min-height: 34px;
        padding: 0 14px;
        border-radius: 12px;
        gap: 10px;
    }

    .legal-search-query-input {
        font-size: 14px;
        line-height: 1.35;
    }

    .legal-search-submit-button {
        min-width: 118px;
        min-height: 34px;
        padding: 0 18px;
        border-radius: 10px;
    }

    .legal-search-content-column,
    .legal-search-results-section,
    .legal-search-results-panel,
    .legal-search-results-list {
        gap: 10px;
    }

    .legal-search-filters-panel {
        gap: 12px;
        padding: 14px;
        border-radius: 12px;
    }

    .legal-search-filters-title {
        font-size: 16px;
    }

    .legal-search-advanced--sidebar .legal-search-field + .legal-search-field {
        margin-top: 8px;
        padding-top: 8px;
    }

    .legal-search-advanced--sidebar .legal-search-field.legal-search-field--date-to {
        margin-top: 4px;
    }

    .legal-search-advanced--sidebar .legal-search-field-label,
    .legal-search-advanced--sidebar .legal-search-court-option,
    .legal-search-field-input {
        font-size: 12px;
    }

    .legal-search-advanced--sidebar .legal-search-field-input,
    .legal-search-advanced--sidebar .legal-search-court-trigger {
        min-height: 32px;
    }

    .legal-search-advanced--sidebar .legal-search-court-menu {
        gap: 7px;
    }

    .legal-search-advanced--sidebar .legal-search-court-option {
        min-height: 18px;
        line-height: 1.25;
    }

    .legal-search-reset-filters-button {
        height: 34px;
        max-height: 34px;
        font-size: 13px;
    }

    .legal-search-apply-filters-button {
        min-height: 28px;
        height: 28px;
        font-size: 13px;
    }

    .legal-search-results-count,
    .legal-search-results-title {
        font-size: 14px;
    }

    .legal-search-sort-trigger,
    .legal-search-view-mode-button,
    .legal-search-page-size select {
        min-height: 34px;
    }

    .legal-search-view-mode-button,
    .legal-search-pagination-page,
    .legal-search-pagination-arrow {
        width: 34px;
        height: 34px;
    }

    .legal-search-result-card {
        padding: 12px 16px;
        border-radius: 12px;
    }

    .legal-search-result-badge {
        min-height: 24px;
        padding: 0 10px;
        font-size: 11px;
    }

    .legal-search-result-date,
    .legal-search-result-meta {
        font-size: 12px;
    }

    .legal-search-result-title {
        margin: 9px 0 7px;
        font-size: 16px;
        line-height: 1.25;
    }

    .legal-search-result-summary {
        margin-bottom: 10px;
        font-size: 13px;
        line-height: 1.45;
    }

    .legal-search-result-summary.is-collapsed {
        max-height: 148px;
    }

    .legal-search-summary-toggle {
        margin-bottom: 10px;
    }

    .legal-search-result-meta {
        padding-top: 10px;
    }

    .legal-search-result-actions {
        gap: 8px;
        margin-top: 10px;
    }

    .legal-search-result-action,
    .legal-search-result-action-favorite {
        min-height: 34px;
        padding: 0 14px;
        font-size: 12px;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .legal-search-page {
        gap: 18px;
    }

    .legal-search-header {
        margin: 14px 0 4px;
        gap: 6px;
    }

    .legal-search-title {
        font-size: 30px;
        line-height: 1.15;
    }

    .legal-search-subtitle {
        font-size: 14px;
        line-height: 1.45;
    }

    .legal-search-form,
    .legal-search-main-layout,
    .legal-search-content-column {
        gap: 14px;
    }

    .legal-search-query-field {
        min-height: 48px;
        padding: 8px 16px;
        border-radius: 18px;
    }

    .legal-search-query-input {
        font-size: 14px;
        line-height: 1.4;
        padding: 4px 0;
    }

    .legal-search-actions {
        gap: 12px;
    }

    .legal-search-settings-button,
    .legal-search-submit-button {
        min-height: 38px;
    }

    .legal-search-result-card {
        padding: 16px 18px;
        border-radius: 14px;
    }

    .legal-search-result-title {
        margin: 10px 0 8px;
        font-size: 17px;
    }

    .legal-search-result-summary {
        margin-bottom: 12px;
        font-size: 13px;
        line-height: 1.5;
    }

    .legal-search-result-actions {
        margin-top: 12px;
    }
}

@media (min-width: 768px) and (max-width: 1200px) {
    .legal-doc-aside #legal-doc-reading-toggle {
        aspect-ratio: auto;
        flex: initial;
        width: 100%;
        padding: 0 16px;
        justify-content: flex-start;
    }

    .legal-doc-aside #legal-doc-reading-toggle span {
        display: inline;
    }
}

@media (max-width: 767px) {
    .legal-search-help-modal {
        gap: 14px;
    }

    .legal-search-help-modal h3 {
        padding-right: 40px;
        font-size: 28px;
        line-height: 1.18;
    }

    .legal-search-help-modal p,
    .legal-search-help-list,
    .legal-search-help-example-text {
        font-size: 16px;
        line-height: 1.55;
    }

    .legal-search-help-list {
        padding-left: 18px;
    }

    .legal-search-help-list li + li {
        margin-top: 8px;
    }

    .legal-search-help-example {
        gap: 10px;
        padding: 14px;
        border-radius: 18px;
    }

    .legal-search-page {
        gap: 18px;
    }

    .legal-search-title {
        font-size: 26px;
        color: #ffffff;
    }

    .legal-search-subtitle {
        color: #d7deea;
    }

    .legal-search-shell {
        padding: 18px;
        border-radius: 20px;
    }

    .legal-search-shell {
        padding: 0;
        border-radius: 0;
    }

    .legal-search-searchbar {
        flex-direction: column;
        align-items: stretch;
    }

    .legal-search-query-field {
        border-radius: 24px;
        align-items: center;
        min-height: 78px;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    .legal-search-query-icon {
        align-self: center;
        padding-top: 0;
    }

    .legal-search-query-input {
        padding: 0;
        line-height: 1.5;
    }

    .legal-search-help-trigger {
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 18px;
        align-items: center;
        gap: 10px;
        text-align: center;
    }

    .legal-search-help-icon {
        width: 18px;
        height: 18px;
        box-sizing: border-box;
        flex: 0 0 18px;
        line-height: 1;
    }

    .legal-search-help-example-button {
        display: inline-flex;
        width: 100%;
        min-width: 0;
        flex: 0 1 auto;
        padding: 12px 16px;
        justify-content: center;
        gap: 8px;
        justify-self: stretch;
        order: initial;
    }

    .legal-search-actions {
        align-items: stretch;
        gap: 12px;
        flex-wrap: nowrap;
    }

    .legal-search-submit-button {
        width: auto;
        min-width: 0;
        flex: 1 1 auto;
        order: 2;
        border: 1px solid rgba(148, 163, 184, 0.35);
        background: #ffffff;
        color: #151e2b;
        box-shadow: none;
    }

    .legal-search-submit-button:hover {
        background: #f8fafc;
        box-shadow: none;
    }

    #legal-search-load-status,
    #legal-search-load-status.is-info,
    #legal-search-load-status.is-loading {
        color: var(--light-gray);
    }

    .legal-search-results-toolbar,
    .legal-search-result-topline,
    .legal-search-result-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .legal-search-result-meta {
        flex-wrap: wrap;
    }

    .legal-search-result-meta-text {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        width: 100%;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .legal-search-result-meta-item {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        flex: 0 0 auto;
    }

    .legal-search-result-meta-separator {
        display: none;
    }

    .legal-search-advanced-grid {
        grid-template-columns: 1fr;
    }

    .legal-search-field {
        min-width: 0;
    }

    .legal-search-field-input {
        min-width: 0;
        max-width: 100%;
    }

    .legal-search-field-input[type="date"] {
        display: block;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        inline-size: 100%;
        min-inline-size: 0;
        -webkit-appearance: none;
        appearance: none;
        font-size: 16px;
        line-height: 1.2;
    }

    .legal-search-field-input[type="date"]::-webkit-date-and-time-value {
        text-align: left;
    }

    .legal-search-field-input[type="date"]::-webkit-calendar-picker-indicator {
        margin: 0;
    }

    .legal-search-settings-button {
        min-width: 44px;
        padding: 0;
        justify-content: center;
        gap: 0;
        flex: 0 0 44px;
        order: 1;
    }

    .legal-search-settings-button span {
        display: none;
    }

    .legal-search-mode-group {
        margin-right: 0;
        width: 100%;
        margin-bottom: 12px;
    }

    .legal-search-mode-pill {
        flex: 1 1 calc(50% - 5px);
    }

    .legal-search-results-toolbar {
        flex-direction: row;
        align-items: stretch;
        gap: 12px;
        flex-wrap: nowrap;
    }

    .legal-search-favorites-toggle,
    .legal-search-sort {
        flex: 1 1 0;
    }

    .legal-search-sort {
        min-width: 0;
    }

    .legal-search-sort-trigger {
        width: 100%;
        justify-content: center;
    }

    .legal-search-active-filters {
        display: none;
    }

}

/* Keep the legal search surface language consistent across the page. */
.legal-search-page .legal-search-shell,
.legal-search-page .legal-search-filters-panel,
.legal-search-page .legal-search-results-toolbar,
.legal-search-page .legal-search-pagination,
.legal-search-page .legal-search-query-field,
.legal-search-page .legal-search-mode-pill,
.legal-search-page .legal-search-settings-button,
.legal-search-page .legal-search-advanced,
.legal-search-page .legal-search-field-input,
.legal-search-page .legal-search-court-trigger,
.legal-search-page .legal-search-view-mode,
.legal-search-page .legal-search-view-mode-button,
.legal-search-page .legal-search-sort-trigger,
.legal-search-page .legal-search-sort-menu,
.legal-search-page .legal-search-sort-option,
.legal-search-page .legal-search-filter-pill,
.legal-search-page .legal-search-result-card,
.legal-search-page .legal-search-result-badge,
.legal-search-page .legal-search-empty-state,
.legal-search-page .legal-search-help-example,
.legal-search-page .legal-search-pagination-page,
.legal-search-page .legal-search-pagination-arrow,
.legal-search-page .legal-search-page-size select {
    border-radius: 12px;
}

.legal-search-page .legal-search-submit-button,
.legal-search-page .legal-search-apply-filters-button,
.legal-search-page .legal-search-reset-filters-button,
.legal-search-page .legal-search-result-meta-badge,
.legal-search-page .legal-search-result-action,
.legal-search-page .legal-search-result-action-favorite {
    border-radius: 999px;
}

.legal-doc-page {
    width: 100%;
    max-width: none;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
    color: #151e2b;
}

#legal-doc-view {
    --legal-doc-shell-max-width: var(--legal-search-page-max-width);
    display: flex;
    flex-direction: column;
    gap: 18px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.24s ease, transform 0.24s ease;
}

#legal-doc-view.is-ready {
    opacity: 1;
    transform: translateY(0);
}

#legal-doc-view.is-search-expanded {
    --legal-doc-shell-max-width: 100%;
}

#main-stage.legal-doc-stage {
    align-items: stretch;
}

#dialog-window.legal-doc-dialog-window {
    width: 100%;
    max-width: none;
    min-width: 0;
    align-self: stretch;
    box-sizing: border-box;
}

#main-stage.legal-doc-stage > #dialog-window,
#main-stage.legal-doc-stage > #dialog-window.legal-doc-dialog-window {
    width: 100%;
    max-width: none;
    min-width: 0;
    align-self: stretch;
    box-sizing: border-box;
}

#main-stage.legal-doc-stage #legal-doc-view,
#dialog-window.legal-doc-dialog-window #legal-doc-view {
    --legal-doc-shell-max-width: 100%;
}

#dialog-window.legal-doc-dialog-window #legal-doc-view {
    width: 100%;
    min-width: 0;
}

#legal-doc-view[hidden],
#legal-doc-toolbar[hidden],
#legal-doc-loading-shell[hidden],
#legal-doc-layout[hidden],
#legal-doc-badges[hidden],
#legal-doc-meta[hidden],
#legal-doc-search-panel[hidden],
#legal-doc-splitter[hidden],
#legal-doc-toolbar-more[hidden],
#legal-doc-view-switcher-menu[hidden],
#legal-doc-toolbar-overflow-menu[hidden],
#legal-doc-reading-layer[hidden],
.legal-doc-mobile-actions[hidden],
.legal-doc-side-action[hidden] {
    display: none !important;
}

.legal-doc-state-card,
.legal-doc-header,
.legal-doc-shell {
    width: min(100%, var(--legal-doc-shell-max-width));
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
    /* background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 24px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
    transition: width 0.28s ease, max-width 0.28s ease, transform 0.28s ease, box-shadow 0.28s ease; */
}

#main-stage.legal-doc-stage .legal-doc-state-card,
#main-stage.legal-doc-stage .legal-doc-header,
#main-stage.legal-doc-stage .legal-doc-shell,
#dialog-window.legal-doc-dialog-window .legal-doc-state-card,
#dialog-window.legal-doc-dialog-window .legal-doc-header,
#dialog-window.legal-doc-dialog-window .legal-doc-shell {
    width: 100%;
    max-width: none;
}

.legal-doc-state-card {
    padding: 44px 28px;
    text-align: center;
}

.legal-doc-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    background: #f8fafc;
    color: #151e2b;
    font-size: 24px;
}

.legal-doc-state-icon-error {
    background: #fff7ed;
    color: #c2410c;
}

.legal-doc-state-title {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.2;
}

.legal-doc-state-copy {
    margin: 0;
    color: #5b6574;
    font-size: 15px;
    line-height: 1.6;
}

.legal-doc-header {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.legal-doc-header-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.legal-doc-topline {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.legal-doc-back-link {
    display: none;
    align-items: center;
    gap: 10px;
    color: #334155;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.legal-doc-back-link:hover {
    color: #0f172a;
}

.legal-doc-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.legal-doc-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid rgba(226, 232, 240, 0.95);
    color: #334155;
    font-size: 12px;
    font-weight: 700;
}

.legal-doc-badge-muted {
    color: #64748b;
    font-weight: 600;
}

.legal-doc-title {
    margin: 0;
    font-size: 34px;
    line-height: 1.18;
}

.legal-doc-loading-copy {
    margin: 2px 0 0;
    color: #5b6574;
    font-size: 15px;
    line-height: 1.6;
    max-width: 640px;
}

.legal-doc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.legal-doc-meta-item {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    min-width: 150px;
    padding: 12px 14px;
    border-radius: 16px;
    background: #fbfcfd;
    border: 1px solid rgba(226, 232, 240, 0.95);
    color: #475569;
    font-size: 13px;
    line-height: 1.45;
}

.legal-doc-meta-item strong {
    color: #0f172a;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.legal-doc-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.legal-doc-view-switcher,
.legal-doc-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.legal-doc-toolbar-overflow {
    position: relative;
}

.legal-doc-view-switcher {
    position: relative;
}

.legal-doc-mobile-actions {
    position: relative;
    display: none;
}

.legal-doc-toolbar-overflow-trigger {
    display: none;
}

.legal-doc-view-tab,
.legal-doc-toolbar-button,
.legal-doc-search-close {
    appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: #ffffff;
    color: #151e2b;
    border-radius: 999px;
    min-height: 40px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 700;
    font-family: var(--body-font);
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.legal-doc-view-tab:hover,
.legal-doc-toolbar-button:hover:not(:disabled),
.legal-doc-search-close:hover,
.legal-doc-view-tab.is-active {
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.48);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
}

.legal-doc-view-tab.is-active {
    background: #111318;
    color: #ffffff;
    border-color: #111318;
}

.legal-doc-toolbar-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.legal-doc-toolbar-button:disabled {
    background: var(--light-gray);
    color: #64748b;
    border-color: var(--border-color);
    box-shadow: none;
    cursor: not-allowed;
    opacity: 1;
}

.legal-doc-toolbar-button:disabled i,
.legal-doc-toolbar-button:disabled span {
    opacity: 0.72;
}

.legal-doc-info-toggle {
    display: none;
}

.legal-doc-view-switcher-trigger,
.legal-doc-view-switcher-option {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    appearance: none;
    border: 1px solid rgba(226, 232, 240, 0.95);
    background: #ffffff;
    color: #334155;
    border-radius: 12px;
    min-height: 42px;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--body-font);
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.legal-doc-view-switcher-trigger:hover,
.legal-doc-view-switcher-trigger[aria-expanded="true"],
.legal-doc-view-switcher-option:hover {
    background: #f8fafc;
    border-color: rgba(203, 213, 225, 0.95);
    color: #0f172a;
}

.legal-doc-view-switcher-trigger:focus-visible,
.legal-doc-view-switcher-option:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.12);
}

.legal-doc-view-switcher-trigger i,
.legal-doc-view-switcher-option i {
    flex: 0 0 auto;
    margin-left: auto;
    font-size: 12px;
    color: #64748b;
}

.legal-doc-view-switcher-trigger i {
    transition: transform 0.18s ease;
}

.legal-doc-mobile-actions-trigger {
    min-width: 0;
}

#legal-doc-view-switcher-trigger {
    border-color: rgba(148, 163, 184, 0.32);
    background: #ffffff;
    border-radius: 999px;
}

#legal-doc-view-switcher-trigger:hover,
#legal-doc-view-switcher-trigger[aria-expanded="true"] {
    border-color: rgba(148, 163, 184, 0.48);
    background: #f8fafc;
}

.legal-doc-view-switcher-trigger[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.legal-doc-mobile-actions-trigger[aria-expanded="true"] i {
    transform: none;
}

.legal-doc-view-switcher-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 20;
    width: min(280px, calc(100vw - 32px));
    padding: 6px;
    border-radius: 14px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
    display: grid;
    gap: 4px;
}

.legal-doc-view-switcher-option {
    justify-content: space-between;
    border-radius: 10px;
    min-height: 40px;
    border: none;
    background: transparent;
    font-weight: 600;
}

.legal-doc-view-switcher-option i {
    opacity: 0;
}

.legal-doc-view-switcher-option.is-active {
    color: #0f172a;
}

.legal-doc-view-switcher-option.is-active i {
    opacity: 1;
}

.legal-doc-toolbar-overflow-menu {
    display: none;
}

.legal-doc-reading-layer {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    box-sizing: border-box;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 16px;
    padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
    background: rgba(241, 245, 249, 0.96);
    backdrop-filter: blur(12px);
}

.legal-citation-reading-host {
    position: fixed;
    inset: 0;
    z-index: 1200;
    pointer-events: none;
}

.legal-citation-reading-host > .legal-doc-page > #legal-doc-error,
.legal-citation-reading-host > .legal-doc-page > #legal-doc-view {
    display: none !important;
}

.legal-citation-reading-host .legal-doc-reading-layer {
    pointer-events: auto;
}

.legal-doc-reading-layer-state {
    width: min(100%, 520px);
    box-sizing: border-box;
    margin: min(18vh, 120px) auto 0;
    padding: 28px 24px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.14);
    text-align: center;
}

.legal-doc-reading-layer-state .legal-doc-state-icon {
    margin: 0 auto 14px;
}

.legal-doc-reading-layer-state h2 {
    margin: 0 0 8px;
    color: #111827;
    font-size: 20px;
    line-height: 1.25;
}

.legal-doc-reading-layer-state p {
    margin: 0;
    color: #475569;
    font-size: 15px;
    line-height: 1.55;
}

.legal-doc-reading-layer-state.is-error h2 {
    color: #991b1b;
}

.legal-doc-reading-layer__bar {
    width: min(100%, 1480px);
    box-sizing: border-box;
    margin: 0 auto;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
}

.legal-doc-reading-layer__bar .legal-doc-toolbar-button {
    min-height: 46px;
}

.legal-doc-reading-layer__content {
    position: relative;
    width: min(100%, 1480px);
    box-sizing: border-box;
    min-height: 0;
    margin: 0 auto;
}

body.legal-doc-pdf-reading-mode-active {
    overflow: hidden;
}

.legal-doc-reading-layer #legal-doc-pdf-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    min-height: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.legal-doc-reading-layer .legal-doc-document-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.legal-doc-reading-layer #legal-doc-text-view,
.legal-doc-reading-layer #legal-doc-summary-view,
.legal-doc-reading-layer #legal-doc-html-view {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 18px;
    border-radius: 22px;
    background: #ffffff;
}

.legal-doc-reading-layer #legal-doc-text-view .legal-doc-richtext,
.legal-doc-reading-layer #legal-doc-summary-view .legal-doc-richtext {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

#legal-doc-html-view iframe,
.legal-doc-reading-layer #legal-doc-html-frame {
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
    border: 0;
    border-radius: 16px;
    background: #ffffff;
}

.legal-doc-reading-layer #legal-doc-html-view .legal-doc-panel-header {
    display: none;
}

.legal-doc-reading-layer #legal-doc-pdf-view .legal-doc-panel-header {
    display: none;
}

.legal-doc-reading-layer #legal-doc-pdf-search-host {
    display: none !important;
}

.legal-doc-reading-layer #legal-doc-pdf-container {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
}

.legal-doc-reading-layer .legal-doc-pdf-viewer-shell {
    height: 100%;
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 24px;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
}

.legal-doc-reading-layer .legal-doc-pdf-viewer-container {
    padding: 12px 0 22px;
}

.legal-doc-toolbar-button.is-active,
.legal-doc-toolbar-button.is-active:hover {
    color: #151e2b;
    box-shadow: none;
    transform: none;
}

.legal-doc-shell {
    padding: 0px 28px;
    overflow: hidden;
}

.legal-doc-loading-shell {
    display: block;
}

.legal-doc-loading-panel {
    padding: 4px 2px;
}

.legal-doc-skeleton {
    position: relative;
    overflow: hidden;
    background: #eef2f7;
    border-radius: 16px;
}

.legal-doc-skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.72) 50%, rgba(255, 255, 255, 0) 100%);
    animation: legal-doc-skeleton-shimmer 1.5s ease-in-out infinite;
}

.legal-doc-skeleton-pill {
    width: 148px;
    max-width: 42%;
    height: 16px;
    border-radius: 999px;
}

.legal-doc-skeleton-line {
    height: 16px;
    margin-top: 16px;
}

.legal-doc-loading-line-lg {
    width: min(520px, 100%);
}

.legal-doc-loading-line-md {
    width: min(360px, 72%);
}

.legal-doc-skeleton-block {
    margin-top: 24px;
    min-height: 360px;
    border-radius: 22px;
}

@keyframes legal-doc-skeleton-shimmer {
    100% {
        transform: translateX(100%);
    }
}

.legal-doc-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
}

.legal-doc-layout.has-search-panel {
    grid-template-columns: minmax(0, var(--legal-doc-main-width, 68%)) 12px minmax(360px, calc(100% - var(--legal-doc-main-width, 68%) - 12px));
    align-items: stretch;
}

.legal-doc-layout.is-search-stacked {
    grid-template-columns: minmax(0, 1fr);
}

.legal-doc-main {
    min-width: 0;
    min-height: 0;
}

.legal-doc-inline-search-host {
    width: 100%;
    min-width: 0;
}

.legal-doc-splitter {
    position: relative;
    min-height: 100%;
    cursor: col-resize;
    touch-action: none;
    user-select: none;
}

.legal-doc-splitter::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 0;
    width: 2px;
    height: 100%;
    background: rgba(75, 85, 99, 0.22);
    border-radius: 999px;
}

.legal-doc-splitter::after {
    content: '';
    position: absolute;
    left: 1px;
    top: 50%;
    width: 10px;
    height: 68px;
    transform: translateY(-50%);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.34);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
}

body.legal-doc-resizing {
    cursor: col-resize;
    user-select: none;
}

.legal-doc-notice {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid rgba(226, 232, 240, 0.95);
    color: #334155;
    font-size: 14px;
    font-weight: 600;
}

.legal-doc-panel,
.legal-doc-search-panel {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.legal-doc-panel {
    padding: 18px;
}

.legal-doc-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
}

.legal-doc-panel-title {
    margin: 0 0 6px;
    font-size: 18px;
}

.legal-doc-panel-copy {
    margin: 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.55;
}

.legal-doc-richtext {
    color: #000000;
    font-size: 15px;
    line-height: 1.72;
}

.legal-doc-richtext > :first-child {
    margin-top: 0;
}

.legal-doc-richtext > :last-child {
    margin-bottom: 0;
}

.legal-doc-search-panel {
    display: flex;
    flex-direction: column;
    padding: 18px;
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 100%;
    max-height: var(--legal-doc-search-panel-target-height, none);
    min-width: 0;
    flex: 0 1 auto;
    align-self: stretch;
    box-sizing: border-box;
    position: sticky;
    top: 18px;
    overflow: hidden;
    opacity: 0;
    transform: translateX(14px);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.legal-doc-search-panel.is-inline-compact {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "field close"
        "summary summary";
    gap: 10px 12px;
    position: static;
    top: auto;
    height: auto;
    min-height: 0;
    max-height: none;
    margin: -4px 0 18px;
    padding: 14px;
    border-radius: 18px;
    border-color: rgba(226, 232, 240, 0.98);
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
    overflow: visible;
    opacity: 1;
    transform: none;
}

.legal-doc-search-panel.is-reading-overlay {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 3;
    width: min(420px, calc(100% - 32px));
    min-height: 0;
    height: auto;
    max-height: calc(100% - 32px);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 28px 60px rgba(15, 23, 42, 0.18);
    opacity: 1;
    transform: none;
    overflow: hidden;
}

#legal-doc-view.is-search-expanded .legal-doc-search-panel {
    opacity: 1;
    transform: translateX(0);
}

.legal-doc-search-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.legal-doc-search-panel-title {
    margin: 0;
    font-size: 18px;
}

.legal-doc-search-panel.is-inline-compact .legal-doc-search-panel-header {
    grid-area: close;
    justify-content: flex-end;
    margin: 0;
}

.legal-doc-search-panel.is-inline-compact .legal-doc-search-panel-title {
    display: none;
}

.legal-doc-search-panel.is-inline-compact .legal-doc-search-field {
    grid-area: field;
}

.legal-doc-search-panel.is-inline-compact .legal-doc-search-summary {
    grid-area: summary;
    margin: 0;
}

.legal-doc-search-panel.is-inline-compact .legal-doc-search-close {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.92);
}

.legal-doc-search-close {
    width: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.legal-doc-search-field {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: #ffffff;
    box-sizing: border-box;
}

.legal-doc-search-field:focus-within {
    border-color: rgba(148, 163, 184, 0.52);
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.12);
}

.legal-doc-search-field-icon {
    color: #64748b;
    font-size: 13px;
}

.legal-doc-search-input {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    border: none;
    background: transparent;
    color: #151e2b;
    font-size: 14px;
}

.legal-doc-search-input:focus {
    outline: none;
}

.legal-doc-search-status {
    flex: 0 0 auto;
    max-width: 100%;
    margin: 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.45;
}

.legal-doc-search-status:empty {
    display: none;
}

.legal-doc-search-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0 0;
}

.legal-doc-search-summary .legal-doc-search-status {
    margin: 0;
}

.legal-doc-search-nav {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.legal-doc-search-nav-button {
    min-height: 40px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.32);
    background: #ffffff;
    color: #0f172a;
    font-size: 13px;
    font-weight: 700;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.legal-doc-search-nav-button:hover:not(:disabled) {
    border-color: rgba(148, 163, 184, 0.52);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.legal-doc-search-nav-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.legal-doc-search-result {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    width: 100%;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    background: #fbfcfd;
    text-align: left;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.legal-doc-search-result:hover,
.legal-doc-search-result.is-active {
    transform: translateY(-1px);
    border-color: rgba(148, 163, 184, 0.52);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
}

.legal-doc-search-result-index {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #111318;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
}

.legal-doc-search-result-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.legal-doc-search-result-label {
    color: #0f172a;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.legal-doc-search-result-excerpt {
    color: #475569;
    font-size: 13px;
    line-height: 1.55;
}

.legal-doc-pdf-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.legal-doc-pdf-viewer-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    position: relative;
    min-height: 760px;
    height: auto;
    aspect-ratio: 1 / 1.414;
    max-height: 1120px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    overflow: hidden;
}

@media (max-height: 820px) and (min-width: 768px) {
    .legal-doc-pdf-viewer-shell {
        min-height: clamp(480px, calc(100dvh - 180px), 760px);
        aspect-ratio: auto;
    }
}

.legal-doc-pdf-browser-toolbar {
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 14px;
    min-height: 58px;
    padding: 10px 14px;
    border-bottom: 1px solid #e5e7eb;
    background: rgba(255, 255, 255, 0.98);
}

.legal-doc-pdf-browser-toolbar__group {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.legal-doc-pdf-browser-toolbar__group--center {
    justify-content: center;
}

.legal-doc-pdf-browser-toolbar__group--end {
    justify-content: flex-end;
}

.legal-doc-pdf-browser-button {
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #ffffff;
    color: #0f172a;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.legal-doc-pdf-browser-button:hover {
    border-color: #d7dce3;
    background: #f8fafc;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
}

.legal-doc-pdf-browser-icon-button {
    width: 38px;
    padding: 0;
    display: inline-grid;
    place-items: center;
}

.legal-doc-pdf-search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 14px;
    border-color: #e5e7eb;
}

.legal-doc-pdf-page-indicator,
.legal-doc-pdf-zoom-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 78px;
    min-height: 34px;
    color: #111827;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.legal-doc-pdf-page-indicator {
    gap: 5px;
}

.legal-doc-pdf-zoom-indicator {
    min-width: 62px;
    border-radius: 8px;
    background: var(--light-gray);
    color: var(--dark-color);
}

.legal-doc-pdf-browser-body {
    display: grid;
    grid-template-columns: 164px minmax(0, 1fr);
    min-height: 0;
}

.legal-doc-pdf-browser-main {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #f8fafc;
}

.legal-doc-pdf-thumbnails-panel {
    width: 164px;
    min-width: 164px;
    height: auto;
    max-width: none;
    min-height: 0;
    border-right: 1px solid #e5e7eb;
    background: #ffffff;
    overflow: hidden;
}

.legal-doc-pdf-viewer-shell.is-thumbnails-collapsed .legal-doc-pdf-browser-body {
    grid-template-columns: minmax(0, 1fr);
}

.legal-doc-pdf-viewer-shell.is-thumbnails-collapsed .legal-doc-pdf-thumbnails-panel {
    display: none;
}

@media (max-width: 1779px) {
    .legal-doc-pdf-viewer-shell.is-thumbnails-collapsed .legal-doc-pdf-browser-button[data-legal-pdf-action="toggle-thumbnails"] {
        display: none;
    }
}

.legal-doc-pdf-thumbnails-title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 14px;
    color: #111827;
    font-size: 13px;
    font-weight: 800;
    border-bottom: 1px solid #eef2f7;
}

.legal-doc-pdf-thumbnails {
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: calc(100% - 44px);
    overflow-y: auto;
    padding: 14px 12px 22px;
    scrollbar-gutter: stable;
}

.legal-doc-pdf-thumbnails-loading {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
}

.legal-doc-pdf-thumbnail {
    display: grid;
    justify-items: center;
    gap: 7px;
    width: 100%;
    padding: 8px 8px 7px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.legal-doc-pdf-thumbnail:hover,
.legal-doc-pdf-thumbnail.is-active {
    border-color: rgba(251, 191, 36, 0.45);
    color: var(--dark-color);
    box-shadow: 0 8px 18px var(--border-color);
}

.legal-doc-pdf-thumbnail canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

.legal-doc-pdf-thumbnail-label {
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.legal-doc-pdf-viewer-container {
    position: absolute;
    inset: 0;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    padding: 28px 0 34px;
    background: #f8fafc;
    scrollbar-gutter: stable;
}

.legal-doc-reading-layer .legal-doc-pdf-viewer-shell {
    height: 100%;
    aspect-ratio: auto;
    max-height: none;
}

.legal-doc-reading-layer .legal-doc-pdf-browser-body {
    min-height: 0;
}

#legal-doc-pdf-container .pdfViewer {
    padding-bottom: 28px;
}

#legal-doc-pdf-container .page {
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.12);
    transition: box-shadow 0.18s ease, outline-color 0.18s ease;
}

#legal-doc-pdf-container .page.legal-doc-pdf-page-active {
    box-shadow: 0 18px 45px rgba(245, 158, 11, 0.16);
    outline: 3px solid rgba(251, 191, 36, 0.45);
    outline-offset: 2px;
}

#legal-doc-pdf-container .textLayer .highlight {
    background: rgba(250, 204, 21, 0.45);
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.18);
}

#legal-doc-pdf-container .textLayer .highlight.selected {
    background: rgba(250, 204, 21, 0.45);
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.18);
}

#legal-doc-pdf-container .textLayer .highlight.legal-doc-pdf-highlight-selected {
    background: rgba(245, 158, 11, 0.72);
    box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.35);
}

.legal-doc-search-highlight {
    background: #fef08a;
    color: inherit;
    padding: 0;
}

.legal-doc-search-highlight.is-active {
    background: #fbbf24;
}

@media (max-width: 1100px) {
    .legal-doc-layout.has-search-panel {
        grid-template-columns: minmax(0, 1fr);
    }

    .legal-doc-splitter {
        display: none;
    }

    .legal-doc-layout.is-search-compact .legal-doc-search-nav {
        display: inline-flex;
    }

    .legal-doc-layout.is-search-compact .legal-doc-inline-search-host[hidden] {
        display: none !important;
    }
}

@media (max-width: 880px) {
    .legal-doc-header,
    .legal-doc-shell {
        padding: 18px;
        border-radius: 20px;
    }

    .legal-doc-shell {
        padding: 0;
    }

    .legal-doc-title {
        font-size: 28px;
    }

    .legal-doc-loading-copy {
        font-size: 14px;
    }

    .legal-doc-layout.has-search-panel {
        grid-template-columns: 1fr;
    }

    .legal-doc-search-panel,
    .legal-doc-search-panel.is-inline-compact {
        position: static;
        max-height: none;
    }

    .legal-doc-search-summary {
        flex-direction: column;
        align-items: stretch;
    }

    .legal-doc-search-summary .legal-doc-search-status {
        flex: 0 0 auto;
        width: 100%;
    }

    .legal-doc-search-nav {
        width: 100%;
    }

    .legal-doc-search-nav-button {
        flex: 1 1 0;
    }

    .legal-doc-search-panel.is-inline-compact {
        margin: -2px 0 16px;
        padding: 12px;
        border-radius: 16px;
    }

    .legal-doc-search-panel.is-inline-compact .legal-doc-search-panel-header {
        margin: 0;
    }

    .legal-doc-pdf-viewer-shell {
        min-height: 640px;
        max-height: none;
    }

    .legal-doc-pdf-browser-toolbar {
        grid-template-columns: auto 1fr auto;
        gap: 8px;
        padding: 8px 10px;
    }

    .legal-doc-pdf-browser-toolbar__group {
        gap: 6px;
    }

    .legal-doc-pdf-browser-body {
        grid-template-columns: 132px minmax(0, 1fr);
    }

    .legal-doc-pdf-thumbnails-panel {
        width: 132px;
        min-width: 132px;
    }

    .legal-doc-pdf-search-button span {
        display: none;
    }

    .legal-doc-pdf-search-button {
        width: 38px;
        padding: 0;
    }

    .legal-doc-pdf-thumbnails-title {
        padding: 0 10px;
    }

    .legal-doc-pdf-thumbnails-title span {
        display: none;
    }

    .legal-doc-pdf-thumbnail canvas {
        max-width: 92px;
    }

    .legal-doc-skeleton-block {
        min-height: 280px;
    }
}

@media (max-width: 1400px) {
    .legal-doc-toolbar {
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 12px;
    }

    .legal-doc-view-switcher {
        flex: 0 0 auto;
        width: fit-content;
        min-width: 86px;
        max-width: min(42vw, 220px);
        display: block;
    }

    .legal-doc-view-switcher-trigger {
        width: 100%;
        min-width: 0;
        max-width: none;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .legal-doc-view-switcher-menu {
        width: max-content;
        min-width: 100%;
        max-width: min(80vw, 220px);
    }

    .legal-doc-toolbar-actions {
        flex: 0 0 auto;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 8px;
    }

    .legal-doc-toolbar-actions > .legal-doc-toolbar-secondary-action {
        display: none !important;
    }

    .legal-doc-toolbar-button,
    .legal-doc-view-tab {
        justify-content: center;
    }

    .legal-doc-view-tab,
    #legal-doc-search-toggle,
    .legal-doc-toolbar-overflow-trigger {
        flex: 1 1 0;
        min-width: 0;
        padding: 0 12px;
    }

    #legal-doc-search-toggle span,
    .legal-doc-toolbar-overflow-trigger span {
        display: none;
    }

    #legal-doc-search-toggle,
    .legal-doc-toolbar-overflow-trigger {
        aspect-ratio: 1;
        flex: 0 0 42px;
        padding: 0;
    }

    .legal-doc-toolbar-overflow {
        flex: 0 0 42px;
    }

    .legal-doc-toolbar-overflow-trigger {
        display: inline-flex;
    }
}

@media (max-width: 767px) {
    .legal-doc-view-switcher {
        flex: 1 1 auto;
        min-width: 0;
        display: block;
    }

    .legal-doc-view-switcher-trigger {
        width: 100%;
        min-width: 0;
    }

    .legal-doc-view-switcher-menu {
        width: min(280px, calc(100vw - 32px));
        max-width: 100%;
    }
}

@media (max-width: 1200px) {
    .legal-doc-page {
        gap: 18px;
    }

    .legal-doc-loading-panel {
        padding: 18px;
    }

    #legal-doc-badges {
        display: none !important;
    }

    #legal-doc-pdf-view,
    #legal-doc-pdf-container,
    .legal-doc-pdf-viewer-shell,
    .legal-doc-pdf-viewer-container {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    #legal-doc-pdf-view,
    #legal-doc-pdf-container {
        overflow: hidden;
    }

    .legal-doc-topline {
        flex-direction: column;
        align-items: stretch;
    }

    .legal-doc-toolbar {
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 12px;
    }

    .legal-doc-view-switcher {
        flex: 1 1 auto;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
        gap: 8px;
    }

    .legal-doc-toolbar-actions {
        flex: 0 0 auto;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 8px;
    }

    .legal-doc-toolbar-actions > .legal-doc-toolbar-secondary-action {
        display: none !important;
    }

    .legal-doc-toolbar-button,
    .legal-doc-view-tab {
        justify-content: center;
    }

    .legal-doc-view-tab,
    #legal-doc-search-toggle,
    .legal-doc-toolbar-overflow-trigger {
        flex: 1 1 0;
        min-width: 0;
        padding: 0 12px;
    }

    #legal-doc-search-toggle span,
    .legal-doc-toolbar-overflow-trigger span {
        display: none;
    }

    #legal-doc-search-toggle,
    .legal-doc-toolbar-overflow-trigger {
        aspect-ratio: 1;
        flex: 0 0 42px;
        padding: 0;
    }

    .legal-doc-toolbar-overflow {
        flex: 0 0 42px;
    }

    .legal-doc-toolbar-overflow-trigger {
        display: inline-flex;
    }

    .legal-doc-meta {
        flex-direction: column;
    }

    .legal-doc-search-result {
        grid-template-columns: 30px minmax(0, 1fr);
        gap: 10px;
    }

    .legal-doc-search-result-index {
        width: 30px;
        height: 30px;
        border-radius: 10px;
    }

    .legal-doc-search-panel.is-inline-compact .legal-doc-search-summary {
        gap: 10px;
    }

    .legal-doc-search-panel.is-inline-compact {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .legal-doc-pdf-viewer-shell {
        min-height: 520px;
    }

    .legal-doc-pdf-browser-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .legal-doc-pdf-thumbnails-panel {
        display: none;
    }
}

@media (max-width: 1400px) {
    .legal-doc-toolbar-overflow-menu {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        z-index: 20;
        min-width: min(240px, calc(100vw - 32px));
        padding: 8px;
        border-radius: 16px;
        border: 1px solid rgba(226, 232, 240, 0.95);
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 20px 40px rgba(15, 23, 42, 0.14);
        display: grid;
        gap: 6px;
    }

    .legal-doc-toolbar-overflow-menu .legal-doc-toolbar-button {
        width: 100%;
        justify-content: flex-start;
        border-radius: 12px;
        min-height: 42px;
        padding: 0 14px;
        font-size: 14px;
        font-weight: 600;
    }
}

@media (max-width: 1399px) {
    .legal-doc-reading-layer {
        gap: 12px;
        padding: calc(env(safe-area-inset-top, 0px) + 12px) 12px calc(env(safe-area-inset-bottom, 0px) + 12px);
    }

    .legal-doc-reading-layer__bar {
        padding: 10px;
        border-radius: 18px;
    }
}

@media (min-width: 1400px) {
    .legal-doc-reading-layer {
        padding: calc(env(safe-area-inset-top, 0px) + 24px) 28px calc(env(safe-area-inset-bottom, 0px) + 24px);
    }

    .legal-doc-reading-layer__content,
    .legal-doc-reading-layer__bar {
        width: min(100%, 1560px);
    }

    .legal-doc-search-panel.is-reading-overlay {
        top: 20px;
        right: 20px;
        width: min(440px, calc(100% - 40px));
        max-height: calc(100% - 40px);
    }
}

@media (max-width: 767px) {
    #legal-search-settings-toggle {
        border-radius: 999px;
    }

    label.legal-search-query-field,
    article.legal-search-result-card {
        border-radius: 20px;
    }

    .legal-doc-pdf-browser-button[data-legal-pdf-action="toggle-thumbnails"] {
        display: none;
    }

    .legal-doc-reading-layer {
        gap: 10px;
        padding: calc(env(safe-area-inset-top, 0px) + 10px) 10px calc(env(safe-area-inset-bottom, 0px) + 10px);
    }

    .legal-doc-reading-layer__bar {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        gap: 8px;
        padding: 8px;
        border-radius: 16px;
    }

    .legal-doc-reading-layer__bar .legal-doc-toolbar-button {
        aspect-ratio: 1;
        flex: 0 0 44px;
        padding: 0;
        justify-content: center;
    }

    .legal-doc-reading-layer__bar .legal-doc-toolbar-button span {
        display: none;
    }

    .legal-doc-reading-layer__content {
        min-height: 0;
    }

    .legal-doc-reading-layer .legal-doc-pdf-viewer-shell {
        border: none;
        border-radius: 18px;
        background: #f8fafc;
    }

    .legal-doc-reading-layer .legal-doc-pdf-viewer-container {
        padding: 8px 0 18px;
    }

    .legal-doc-search-panel.is-reading-overlay {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
        max-height: calc(100% - 24px);
        border-radius: 18px;
    }
}

@media (max-width: 399px) {
    .legal-doc-reading-layer {
        padding-left: 8px;
        padding-right: 8px;
    }

    .legal-doc-reading-layer__bar {
        gap: 6px;
        padding: 7px;
        border-radius: 15px;
    }

    .legal-doc-reading-layer__bar .legal-doc-toolbar-button {
        flex-basis: 42px;
        min-height: 42px;
    }

    .legal-doc-toolbar {
        flex-wrap: nowrap;
        align-items: center;
    }

    .legal-doc-view-switcher,
    .legal-doc-toolbar-actions {
        width: auto;
    }

    .legal-doc-toolbar-actions {
        justify-content: flex-end;
    }

    .legal-doc-search-panel.is-inline-compact {
        padding: 12px;
    }

    .legal-doc-search-panel.is-inline-compact .legal-doc-search-summary {
        gap: 8px;
    }

    .legal-doc-search-nav {
        gap: 8px;
    }

    .legal-doc-search-nav-button {
        min-width: 0;
        padding: 0;
        gap: 0;
    }

    .legal-doc-search-nav-button span {
        display: none;
    }

    .legal-doc-search-nav-button i {
        margin: 0;
    }
}

/* Legal document layout refactor */
#legal-doc-view {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.legal-doc-header {
    padding: 24px 28px;
    gap: 18px;
}

.legal-doc-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
}

.legal-doc-heading-group {
    flex: 1 1 auto;
    min-width: 0;
}

.legal-doc-toolbar {
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
}

.legal-doc-toolbar-actions {
    align-items: center;
}

.legal-doc-toolbar-static {
    display: flex;
}

.legal-doc-layout,
.legal-doc-layout.has-search-panel,
.legal-doc-layout.is-search-stacked {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
    gap: 24px;
    align-items: start;
}

.legal-doc-main {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

.legal-doc-aside {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    height: auto;
    max-width: none;
    min-width: 0;
    overflow: visible;
    font-family: var(--body-font);
}

.legal-doc-side-card {
    padding: 18px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
    min-width: 0;
}

.legal-doc-side-card-header {
    margin-bottom: 16px;
}

.legal-doc-search-panel-anchor {
    min-width: 0;
}

.legal-doc-side-card-title {
    margin: 0;
    font-size: 18px;
    line-height: 1.35;
    text-transform: none;
    letter-spacing: normal;
    color: #151e2b;
}

.legal-doc-info-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.legal-doc-info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.legal-doc-info-label {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: normal;
    text-transform: none;
    color: #4a5568;
}

.legal-doc-info-value {
    font-size: 14px;
    line-height: 1.55;
    color: #0f172a;
    word-break: break-word;
}

.legal-doc-info-empty {
    font-size: 14px;
    line-height: 1.55;
    color: #64748b;
}

.legal-doc-info-modal .legal-doc-side-card-header {
    margin-bottom: 18px;
}

.legal-doc-actions-modal .legal-doc-side-card-header {
    margin-bottom: 18px;
}

.legal-doc-view-switcher-modal .legal-doc-side-card-header {
    margin-bottom: 18px;
}

.legal-doc-info-modal .legal-doc-info-list,
.legal-doc-actions-modal .legal-doc-action-list {
    gap: 16px;
}

.legal-doc-view-switcher-modal .legal-doc-view-switcher-modal-list {
    gap: 8px;
}

.legal-doc-view-switcher-modal .legal-doc-view-switcher-option {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 14px;
    border: 1px solid rgba(226, 232, 240, 0.98);
    background: #ffffff;
    color: #0f172a;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--body-font);
    justify-content: space-between;
}

.legal-doc-view-switcher-modal .legal-doc-view-switcher-option:hover {
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.42);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
}

.legal-doc-view-switcher-modal .legal-doc-view-switcher-option.is-active,
.legal-doc-view-switcher-modal .legal-doc-view-switcher-option.is-active:hover {
    border-color: rgba(15, 23, 42, 0.72);
    background: #f8fafc;
    box-shadow: none;
}

.legal-doc-view-switcher-modal .legal-doc-view-switcher-option i {
    opacity: 0;
    color: #0f172a;
}

.legal-doc-view-switcher-modal .legal-doc-view-switcher-option.is-active i {
    opacity: 1;
}

.legal-doc-info-item.is-skeleton .legal-doc-skeleton-line {
    width: 100%;
    margin-top: 0;
}

.legal-doc-action-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.legal-doc-side-action {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 14px;
    border: 1px solid rgba(226, 232, 240, 0.98);
    background: #ffffff;
    color: #0f172a;
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    font-family: var(--body-font);
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.legal-doc-side-action:hover {
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.42);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
}

.legal-doc-side-action.is-active,
.legal-doc-side-action.is-active:hover {
    border-color: rgba(15, 23, 42, 0.72);
    background: #f8fafc;
    box-shadow: none;
}

.legal-doc-document-panel {
    padding: 18px;
}

.legal-doc-panel-header-inline {
    margin-bottom: 14px;
}

.legal-doc-inline-search-host {
    margin-bottom: 14px;
}

.legal-doc-search-panel,
.legal-doc-search-panel.is-inline-compact {
    position: static;
    top: auto;
    width: 100%;
    min-height: 0;
    max-height: none;
    margin: 0;
    padding: 14px;
    border-radius: 18px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
    opacity: 1;
    transform: none;
    overflow: visible;
}

.legal-doc-search-panel.is-aside-card {
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.legal-doc-search-panel.is-aside-card .legal-doc-search-panel-header {
    display: none;
}

.legal-doc-search-panel.is-aside-card .legal-doc-search-summary {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.legal-doc-search-panel.is-aside-card .legal-doc-search-status {
    flex: 0 1 auto;
    width: auto;
    max-width: 100%;
}

.legal-doc-search-panel.is-aside-card .legal-doc-search-summary {
    align-items: stretch;
}

.legal-doc-search-panel.is-aside-card .legal-doc-search-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    gap: 10px;
}

.legal-doc-search-panel.is-aside-card .legal-doc-search-nav-button {
    width: 100%;
    min-width: 0;
    padding: 0 12px;
}

.legal-doc-search-panel.is-inline-compact {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
        "field close"
        "summary summary";
    gap: 10px 12px;
}

.legal-doc-search-panel.is-inline-compact .legal-doc-search-summary {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.legal-doc-toolbar-overflow,
#legal-doc-toolbar-more,
#legal-doc-toolbar-overflow-menu {
    display: none !important;
}

@media (min-width: 1201px) {
    #legal-doc-search-toggle {
        display: none !important;
    }
}

@media (max-width: 1200px) {
    .legal-doc-hero {
        flex-direction: column;
        align-items: stretch;
    }

    .legal-doc-toolbar {
        width: 100%;
        justify-content: space-between;
    }

    .legal-doc-layout,
    .legal-doc-layout.has-search-panel,
    .legal-doc-layout.is-search-stacked {
        grid-template-columns: minmax(0, 1fr);
    }

    .legal-doc-aside {
        position: static;
    }

    .legal-doc-action-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .legal-doc-aside #legal-doc-reading-toggle {
        aspect-ratio: auto;
        flex: initial;
        width: 100%;
        padding: 0 16px;
        justify-content: flex-start;
    }

    .legal-doc-aside #legal-doc-reading-toggle span {
        display: inline;
    }

}

@media (max-width: 767px) {
    #main-stage.legal-doc-stage {
        overflow-y: auto;
        overflow-x: hidden;
    }

    .legal-doc-header {
        padding: 18px;
    }

    .legal-doc-back-link {
        display: inline-flex;
        color: var(--light-gray);
    }

    .legal-doc-back-link:hover {
        color: #e2e8f0;
    }

    .legal-doc-title {
        color: #f8fafc;
    }

    .legal-doc-loading-copy {
        color: #e2e8f0;
    }

    .legal-doc-toolbar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
    }

    .legal-doc-view-switcher {
        flex: 0 0 auto;
        width: fit-content;
        min-width: 86px;
        max-width: min(62vw, 190px);
    }

    .legal-doc-view-switcher-trigger {
        width: 100%;
        min-width: 0;
        max-width: none;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .legal-doc-view-switcher-menu {
        left: 0;
        right: auto;
        width: max-content;
        min-width: 100%;
        max-width: min(62vw, 190px);
    }

    .legal-doc-view-switcher-option {
        white-space: nowrap;
    }

    .legal-doc-toolbar-actions {
        flex: 0 0 auto;
        margin-left: auto;
        justify-content: flex-end;
    }

    .legal-doc-mobile-actions {
        display: block;
        flex: 0 0 auto;
        order: 3;
    }

    #legal-doc-search-toggle {
        order: 2;
    }

    .legal-doc-mobile-actions-trigger {
        width: auto;
        min-width: 0;
        border-color: rgba(148, 163, 184, 0.32);
        border-radius: 999px;
        background: #ffffff;
        white-space: nowrap;
    }

    .legal-doc-info-toggle {
        display: inline-flex;
    }

    .legal-doc-info-toggle,
    .legal-doc-mobile-actions-trigger {
        aspect-ratio: 1;
        width: 42px;
        min-width: 42px;
        padding: 0;
        justify-content: center;
    }

    .legal-doc-info-toggle span,
    .legal-doc-mobile-actions-trigger span {
        display: none;
    }

    .legal-doc-info-toggle i,
    .legal-doc-mobile-actions-trigger i {
        margin-left: 0;
        font-size: 16px;
    }

    .legal-doc-mobile-actions-trigger i {
        color: var(--dark-color);
    }

    .legal-doc-info-card {
        display: none;
    }

    .legal-doc-search-card,
    #legal-doc-search-card,
    aside#legal-doc-aside {
        display: none !important;
    }

    .legal-doc-actions-card {
        display: none !important;
    }

    .legal-doc-page {
        gap: 10px;
    }

    #dialog-window.legal-doc-dialog-window {
        padding: 12px 0 calc(96px + env(safe-area-inset-bottom, 0px));
        flex-grow: 0;
        height: auto;
        min-height: 0;
        max-height: 100%;
        overflow-y: auto;
    }

    #main-stage.legal-doc-stage .legal-doc-shell,
    #dialog-window.legal-doc-dialog-window .legal-doc-shell {
        width: auto;
        margin-right: 8px;
        margin-left: 8px;
        padding-top: 0;
        padding-bottom: 0;
    }

    .legal-doc-pdf-viewer-shell {
        min-height: clamp(360px, 70dvh, 580px);
        height: clamp(360px, 70dvh, 580px);
        max-height: none;
        aspect-ratio: auto;
    }

    .legal-doc-action-list {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (min-width: 1025px) and (max-height: 724px) {
    #main-stage.legal-doc-stage {
        margin: 8px;
        height: calc(100% - 16px);
        border-radius: 18px;
    }

    #dialog-window.legal-doc-dialog-window {
        padding: 12px 14px 16px;
    }

    #legal-doc-view,
    .legal-doc-page {
        gap: 12px;
    }

    .legal-doc-header {
        padding: 10px 14px 8px;
        gap: 10px;
    }

    .legal-doc-hero {
        gap: 14px;
        align-items: center;
    }

    .legal-doc-title {
        font-size: 28px;
        line-height: 1.12;
    }

    .legal-doc-loading-copy {
        display: none;
    }

    .legal-doc-toolbar {
        gap: 10px;
    }

    .legal-doc-view-switcher,
    .legal-doc-toolbar-actions {
        gap: 8px;
    }

    .legal-doc-view-tab,
    .legal-doc-toolbar-button,
    .legal-doc-search-close {
        min-height: 34px;
        padding: 0 12px;
        font-size: 12px;
    }

    #legal-doc-view-switcher-trigger,
    #legal-doc-search-toggle,
    .legal-doc-toolbar-overflow-trigger {
        min-height: 36px;
        flex-basis: 36px;
    }

    .legal-doc-layout,
    .legal-doc-layout.has-search-panel,
    .legal-doc-layout.is-search-stacked {
        gap: 14px;
    }

    @media (min-width: 1201px) {
        .legal-doc-layout,
        .legal-doc-layout.has-search-panel,
        .legal-doc-layout.is-search-stacked {
            grid-template-columns: minmax(0, 1fr) minmax(270px, 300px);
        }
    }

    .legal-doc-main {
        gap: 12px;
    }

    .legal-doc-aside {
        gap: 12px;
    }

    .legal-doc-side-card {
        padding: 14px;
        border-radius: 14px;
    }

    .legal-doc-side-card-header {
        margin-bottom: 10px;
    }

    .legal-doc-side-card-title {
        font-size: 16px;
        line-height: 1.25;
    }

    .legal-doc-info-list {
        gap: 10px;
    }

    .legal-doc-info-item {
        gap: 3px;
    }

    .legal-doc-info-label {
        font-size: 12px;
        line-height: 1.3;
    }

    .legal-doc-info-value,
    .legal-doc-info-empty {
        font-size: 13px;
        line-height: 1.4;
    }

    .legal-doc-action-list {
        gap: 8px;
    }

    .legal-doc-side-action {
        min-height: 36px;
        padding: 0 12px;
        border-radius: 10px;
        gap: 9px;
        font-size: 13px;
    }

    .legal-doc-search-panel,
    .legal-doc-search-panel.is-inline-compact {
        padding: 12px;
        border-radius: 14px;
    }

    .legal-doc-search-panel.is-aside-card {
        padding: 0;
        border-radius: 0;
    }

    .legal-doc-search-field {
        min-height: 40px;
        padding: 0 12px;
        border-radius: 12px;
    }

    .legal-doc-search-input {
        font-size: 13px;
    }

    .legal-doc-search-summary {
        gap: 8px;
        margin-top: 10px;
    }

    .legal-doc-search-status {
        font-size: 12px;
        line-height: 1.35;
    }

    .legal-doc-search-panel.is-aside-card .legal-doc-search-nav {
        gap: 8px;
    }

    .legal-doc-search-nav-button {
        min-height: 34px;
        padding: 0 10px;
        border-radius: 10px;
        font-size: 12px;
    }

    .legal-doc-document-panel,
    .legal-doc-panel {
        padding: 14px;
        border-radius: 14px;
    }

    .legal-doc-panel-header,
    .legal-doc-panel-header-inline {
        margin-bottom: 10px;
    }

    .legal-doc-panel-title {
        margin-bottom: 3px;
        font-size: 16px;
    }

    .legal-doc-panel-copy {
        font-size: 12px;
        line-height: 1.35;
    }

    .legal-doc-pdf-viewer-shell {
        min-height: clamp(420px, calc(100dvh - 142px), 620px);
        height: clamp(420px, calc(100dvh - 142px), 620px);
        max-height: none;
        aspect-ratio: auto;
        border-radius: 10px;
    }

    .legal-doc-pdf-browser-toolbar {
        min-height: 44px;
        padding: 6px 10px;
        gap: 8px;
    }

    .legal-doc-pdf-browser-toolbar__group {
        gap: 7px;
    }

    .legal-doc-pdf-browser-button {
        min-height: 32px;
        font-size: 12px;
    }

    .legal-doc-pdf-browser-icon-button {
        width: 32px;
    }

    .legal-doc-pdf-page-indicator,
    .legal-doc-pdf-zoom-indicator {
        min-height: 30px;
        min-width: 58px;
        font-size: 12px;
    }

    .legal-doc-pdf-page-indicator {
        min-width: 62px;
    }

    .legal-doc-pdf-browser-body {
        grid-template-columns: 128px minmax(0, 1fr);
    }

    .legal-doc-pdf-thumbnails-panel {
        width: 128px;
        min-width: 128px;
    }

    .legal-doc-pdf-thumbnails-title {
        min-height: 36px;
        padding: 0 10px;
        font-size: 12px;
    }

    .legal-doc-pdf-thumbnails {
        gap: 10px;
        height: calc(100% - 36px);
        padding: 10px 8px 16px;
    }

    .legal-doc-pdf-thumbnail {
        gap: 5px;
        padding: 6px;
    }

    .legal-doc-pdf-thumbnail canvas {
        max-width: 86px;
    }

    .legal-doc-pdf-viewer-container {
        padding: 16px 0 24px;
    }
}

@media print {
    .legal-doc-header,
    #legal-doc-search-panel,
    #legal-doc-notice,
    .legal-doc-aside {
        box-shadow: none;
    }

    .legal-doc-toolbar,
    .legal-doc-back-link,
    #legal-doc-search-panel,
    .legal-doc-aside {
        display: none !important;
    }

    .legal-doc-page,
    .legal-doc-shell,
    .legal-doc-panel,
    .legal-doc-header {
        max-width: none;
        border: none;
        box-shadow: none;
        padding: 0;
    }

    .legal-doc-pdf-viewer-shell {
        min-height: 0;
        height: auto;
        border: none;
        background: transparent;
        overflow: visible;
    }

    .legal-doc-pdf-viewer-container {
        position: static;
        overflow: visible;
        padding: 0;
    }

    #legal-doc-pdf-container .page {
        break-inside: avoid;
        box-shadow: none;
    }
}

.settings-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* User Profile Card in Settings */
.user-profile-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.legal-search-page-loading {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 160px;
    color: #5b6574;
    font-size: 14px;
    font-weight: 600;
}

.legal-search-page-loading i {
    color: #324153;
}

.user-profile-card .user-info {
    width: auto;
    mask-image: none !important;
    -webkit-mask-image: none !important;
    overflow: visible;
    white-space: normal;
    gap: 15px;
}

.user-profile-card .user-avatar, 
.user-profile-card .user-avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 20px;
    flex-shrink: 0;
}

.user-profile-card .user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-profile-card .user-name {
    font-weight: 600;
    color: #111827;
    font-size: 16px;
}

.user-profile-card .user-email {
    font-size: 13px;
    color: #6b7280;
}

.btn-logout-integrated {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #374151;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout-integrated:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.btn-logout-integrated i {
    font-size: 14px;
}

@media (max-width: 640px) {
    .user-profile-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .btn-logout-integrated {
        width: 100%;
        justify-content: center;
    }
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

/* Theme Selector Grid */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.theme-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f9fafb;
}

.theme-swatch:hover {
    background: #f3f4f6;
}

.theme-swatch.selected {
    border-color: #111827;
    background: #fff;
    box-shadow: 0 0 0 1px #111827;
}

.theme-swatch.selected span {
    color: #111827;
    font-weight: 700;
}

.theme-preview {
    width: 100%;
    height: 40px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.05);
}

.theme-swatch span {
    font-size: 12px;
    font-weight: 500;
    color: #374151;
}

/* Subscription Card */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}

.setting-row:last-of-type {
    border-bottom: none;
}

.setting-row span {
    font-size: 14px;
    color: #6b7280;
}

.setting-row strong {
    font-size: 14px;
    color: #111827;
}

.small-text {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
    margin-top: 4px;
}

/* Danger Zone */
.danger-zone {
    border-color: #fecaca !important;
}

.danger-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
    gap: 16px;
}

.danger-item:last-child {
    border-bottom: none;
}

.danger-info strong {
    display: block;
    font-size: 15px;
    color: #111827;
}

.danger-info p {
    font-size: 13px;
    color: #6b7280;
    margin: 2px 0 0 0;
}

.btn-danger-text {
    background: none;
    border: none;
    color: #dc2626;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-danger-text:hover {
    background: #fef2f2;
}

.btn-secondary-outline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #374151;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary-outline:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.btn-danger-outline {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger-outline:hover {
    background: #fef2f2;
    border-color: #f87171;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .theme-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .action-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .action-row button {
        width: 100%;
        margin-top: 8px;
    }
}


/* ========================================================================
   ========================= CHOICES.JS ===================================
   ======================================================================== */
.choices__inner {
    box-sizing: border-box;
}

/* ========================================================================
   ========================= CONVERSATIONS ===============================
   ======================================================================== */
@keyframes conversationFadeIn {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.conversation-wrapper {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    align-items: center;
    border-radius: 30px;
    transition: background 0.3s ease-in-out;
    opacity: 0;
    animation: conversationFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.conversation-wrapper:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.conversation-wrapper .delete-conversation {
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: var(--secondary-color);
    font-size: calc(var(--basic-size) * 1.5);
    cursor: pointer;
    background-color: transparent;
    border: none;
    margin-right: 5px;
    opacity: 0;
    transform: scale(0.8) translateY(5px);
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.conversation-wrapper:hover .delete-conversation {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.conversation-wrapper .delete-conversation:hover {
    color: white;
}

.conversation-wrapper.current-chat {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.conversation-wrapper.current-chat .delete-conversation {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}


#notification-wrapper {
    z-index: 100001;
}

.notification.alert .buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 24px;
}

.notification.alert .btn-confirm,
.notification.alert .btn-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 32px;
    border: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.3px;
}

.notification.alert .btn-confirm {
    background-color: #111827;
    color: white;
    box-shadow: 0 4px 14px rgba(17, 24, 39, 0.2);
}

.notification.alert .btn-confirm:hover {
    background-color: #1f2937;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(17, 24, 39, 0.3);
}

.notification.alert .btn-cancel {
    background-color: #fff;
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

.notification.alert .btn-cancel:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
    color: #111827;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.alert-wrapper {
    display: flex;
    flex-direction: column;
}

.alert-wrapper .alert-content {
    display: flex;
    flex: 1;
    align-items: center;
}

.alert-wrapper .alert-content .icon {
    margin-right: 10px;
}



.opacity-change {
    animation: fadePulse 2s infinite;
    color: #000;
}

@keyframes fadePulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }

    100% {
        opacity: 1;
    }
}


/* ========================================================================
   ========================= STREAMING STATES ============================
   ======================================================================== */
.is-streaming {
    filter: blur(2px) brightness(0.95);
    transition: filter 0.3s, opacity 0.3s;
    opacity: 0.7;
}

.is-done {
    filter: none;
    opacity: 1;
}

@keyframes fadeInText {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.fade-in-chunk {
    animation: fadeInText 0.44s;
    display: inline;
}

/* ========================================================================
   ========================= MOBILE BOTTOM BAR ===========================
   ======================================================================== */
#mobile-bottom-bar {
    display: none;
}

/* ========================================================================
   ========================= CHAT MESSAGES ===============================
   ======================================================================== */
#dialog-window .message {
    font-family: 'Segoe UI', 'Open Sans', sans-serif;
}

#dialog-window article.message {
    padding: 10px 1.2em;
    margin-bottom: 1em;
    line-height: 1.6;
    color: #333;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

#dialog-window article.ai-message {
    padding: 10px 1.2em 45px 1.2em;
}

/* Animații elegante pentru mesajele din conversații */
.message-loading {
    opacity: 0;
    transform: translateY(20px);
    animation: messageFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.message-with-attachments.message-loading {
    opacity: 0;
    transform: translateY(20px);
    animation: messageFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes messageFadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    display: flex;
    flex-direction: column;
    justify-content: start;
    align-items: start;
    margin: 10px;
    font-size: calc(var(--basic-size) * 1.25);
    background-color: white;
    border-radius: 20px;
    box-sizing: border-box;
}

/* Copy button for messages */
.message {
    position: relative;
}


.message-copy-btn {
    position: absolute;
    background: rgba(0, 0, 0, 0);
    border: 1px solid #e5e7eb;
    color: #6b72809a;
    border-radius: 8px;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
    display: none;
}

article.ai-message>.message-copy-btn {
    bottom: 10px;
    left: 12px;
    top: auto;
    right: auto;
    display: inline-flex;
}

/* Indicator "Se scrie..." pentru streaming */
.streaming-indicator {
    position: absolute;
    bottom: 12px;
    left: 14px;
    font-size: 0.75rem;
    color: #9ca3af;
    opacity: 0.8;
    animation: streamingPulse 1.5s ease-in-out infinite;
    pointer-events: none;
    user-select: none;
    font-style: italic;
}

.agent-status-indicator {
    position: absolute;
    bottom: 30px;
    left: 14px;
    right: 14px;
    font-size: 0.75rem;
    color: #9ca3af;
    opacity: 0.9;
    pointer-events: none;
    user-select: none;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-status-badge {
    display: inline-flex;
    align-items: center;
    margin-top: 10px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

[data-message-status="interrupted"] .message-status-badge {
    background: rgba(234, 179, 8, 0.14);
    color: #854d0e;
}

[data-message-status="failed"] .message-status-badge {
    background: rgba(239, 68, 68, 0.12);
    color: #991b1b;
}

.tool-activity {
    margin-top: 10px;
    font-size: 14px;
    pointer-events: none;
    user-select: none;
    overflow-wrap: anywhere;
}

.tool-activity-text {
    display: block;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: calc(var(--basic-size) * 1.25);
    font-weight: 600;
    letter-spacing: 0.01em;
    color: rgba(71, 85, 105, 0.96);
    background-image: linear-gradient(110deg,
            rgba(71, 85, 105, 0.96) 0%,
            rgba(71, 85, 105, 0.96) 38%,
            rgba(255, 255, 255, 0.98) 50%,
            rgba(71, 85, 105, 0.96) 62%,
            rgba(71, 85, 105, 0.96) 100%);
    background-size: 220% 100%;
    background-position: 140% 50%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: toolActivityShimmer 1.9s linear infinite;
}

@keyframes streamingPulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

@keyframes toolActivityShimmer {
    0% {
        background-position: 140% 50%;
    }

    100% {
        background-position: -40% 50%;
    }
}

.message-copy-btn i {
    pointer-events: none;
}

.message-copy-btn:hover {
    background: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}

.message-copy-btn:active {
    transform: translateY(1px);
}


.user-message {
    align-self: flex-end;
    border-radius: 20px;
    background-color: var(--secondary-color);
    margin-right: 30px;
    max-width: 70%;
    width: fit-content;
}

.user-message .message-content {
    color: var(--dark-color);
    line-height: calc(var(--basic-size) * 1.5);
}

.user-message.user-message-collapsible {
    position: relative;
    --user-message-fade-height: 72px;
}

.user-message.user-message-collapsible .message-content {
    position: relative;
}

.user-message.user-message-collapsed .message-content {
    max-height: var(--user-message-collapsed-content-height, 245px);
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - var(--user-message-fade-height)), transparent 100%);
    mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - var(--user-message-fade-height)), transparent 100%);
}

.user-message.user-message-expanded .message-content {
    max-height: none;
    overflow: visible;
    -webkit-mask-image: none;
    mask-image: none;
}

.user-message-collapse-toggle {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 6px;
    border: 0;
    background: transparent;
    color: var(--dark-color);
    cursor: pointer;
    font: inherit;
    font-size: 0.9em;
    font-weight: 600;
    line-height: 1.2;
    margin-top: 14px;
    padding: 0;
}

.user-message-collapse-toggle i {
    display: inline-block;
    font-size: 0.78em;
    line-height: 1;
    transform: translateY(1px);
}

.user-message-collapse-toggle:hover,
.user-message-collapse-toggle:focus-visible {
    text-decoration: underline;
}

.message-text {
    white-space: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
    margin: 0px;
}

#dialog-window article.message:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
}


/* ========================================================================
   ========================= MODERN MESSAGE TABLES ========================
   ======================================================================== */
#dialog-window article.message table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.2em 0;
    font-family: 'Segoe UI', 'Open Sans', sans-serif;
    font-size: 0.95rem;
    color: #2d2d2d;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#dialog-window article.message th,
#dialog-window article.message td {
    padding: 0.75em 1em;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #eee;
}

#dialog-window article.message th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #111827;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

#dialog-window article.message tr:last-child td {
    border-bottom: none;
}

#dialog-window article.message tr:nth-child(even) {
    background-color: #fafbfc;
}

#dialog-window article.message tr:hover {
    background-color: #f1f5f9;
    transition: background-color 0.2s ease;
}


/* ========================================================================
   ========================= MESSAGE LISTS ===============================
   ======================================================================== */
#dialog-window article.message ul,
#dialog-window article.message ol {
    margin: 1em 0;
    padding-left: 1.5em;
    font-family: 'Segoe UI', 'Open Sans', sans-serif;
    color: #333;
}

#dialog-window article.message ul {
    list-style-type: disc;
    padding-left: 2em;
}

#dialog-window article.message ol {
    list-style-type: decimal;
}

#dialog-window article.message li {
    margin: 0.3em 0;
    line-height: 1.5;
    position: relative;
}

#dialog-window article.message li::marker {
    color: #888;
}

/* ========================================================================
   ========================= MESSAGE LINKS ===============================
   ======================================================================== */
#dialog-window article.message a {
    color: #222;
    text-decoration: dashed underline;
    text-underline-offset: 3px;
    font-weight: 500;
    transition: color 0.2s ease, text-decoration 0.2s ease;
    word-break: break-word;
}

#dialog-window article.message a:hover,
#dialog-window article.message a:focus {
    color: #000;
    text-decoration: underline;
}

#dialog-window article.message a:visited {
    color: #555;
}

/* ========================================================================
   ========================= MESSAGE TEXT ================================
   ======================================================================== */
#dialog-window article.message p {
    color: #333;
    line-height: 1.6;
    margin: 0.5em 0;
    word-wrap: break-word;
}

/* ========================================================================
   ========================= MESSAGE HEADINGS ============================
   ======================================================================== */
#dialog-window article.message h1,
#dialog-window article.message h2,
#dialog-window article.message h3,
#dialog-window article.message h4,
#dialog-window article.message h5,
#dialog-window article.message h6 {
    font-family: 'Segoe UI', 'Open Sans', sans-serif;
    color: #494949;
    margin-top: 1em;
    margin-bottom: 0.5em;
    line-height: 1.3;
}

#dialog-window article.message h1 {
    font-size: 1.8em;
}

#dialog-window article.message h2 {
    font-size: 1.6em;
}

#dialog-window article.message h3 {
    font-size: 1.4em;
}

#dialog-window article.message h4 {
    font-size: 1.2em;
}

#dialog-window article.message h5 {
    font-size: 1.1em;
}

#dialog-window article.message h6 {
    font-size: 1em;
}

/* ========================================================================
   ========================= MESSAGE FORMATTING ==========================
   ======================================================================== */
#dialog-window article.message strong {
    font-weight: 700;
    color: #222;
}

#dialog-window article.message em {
    font-style: italic;
    color: #555;
}

/* ========================================================================
   ========================= MESSAGE MEDIA ===============================
   ======================================================================== */
#dialog-window article.message img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0.8em 0;
    display: block;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#dialog-window article.message video {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0.8em 0;
    display: block;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* ========================================================================
   ========================= MESSAGE QUOTES ==============================
   ======================================================================== */
#dialog-window article.message blockquote {
    border-left: 4px solid #ccc;
    margin: 1em 0;
    padding: 0.5em 1em;
    background-color: #f9f9f9;
    color: #555;
    font-style: italic;
    border-radius: 4px;
}

/* ========================================================================
   ========================= MESSAGE RULES ===============================
   ======================================================================== */
#dialog-window article.message hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 1.5em 0;
}

/* ========================================================================
   ========================= SVG ICONS ===================================
   ======================================================================== */
svg#legal-search-bottom-icon {
    color: #656972;
    overflow: visible;
    transform: scale(1.12);
    transform-origin: center;
}

svg#legal-search-bottom-icon use {
    color: inherit;
}

#mobile-bottom-bar svg#legal-search-bottom-icon .legal-search-bottom-icon-base {
    color: #656972;
}

#mobile-bottom-bar svg#legal-search-bottom-icon .legal-search-bottom-icon-hammer {
    display: none;
    clip-path: polygon(53% 51%, 100% 51%, 100% 100%, 53% 100%);
    color: #000000;
}

#mobile-bottom-bar svg#legal-search-bottom-icon.is-active .legal-search-bottom-icon-hammer {
    display: block;
}

svg.new-chat-icon {
    width: calc(var(--basic-size) * 1.375);
    height: calc(var(--basic-size) * 1.375);
    margin-right: 8px;
    margin-bottom: -1px;
    filter: brightness(0) invert(1);
}

svg.legal-icon {
    width: calc(var(--basic-size) * 1.375);
    height: calc(var(--basic-size) * 1.375);
    margin-right: 8px;
    margin-bottom: -1px;
    color: rgba(255, 255, 255, 0.96);
}

svg.dots-horizontal-icon {
    width: calc(var(--basic-size) * 1.375);
    height: calc(var(--basic-size) * 1.375);
    margin-bottom: -2px;
    width: 18px;
}

/* ========================================================================
   ========================= LOGO ELEMENTS ===============================
   ======================================================================== */
#logo-wrapper {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 16px;
    flex: 0 0 auto;
    position: relative;
    padding: 30px 10%;
}

#logo-text {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--logo-font);
    font-size: calc(var(--basic-size) * 3);
    background: #ffffff;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    display: block;
    text-decoration: none;
}

@media (min-width: 769px) {
    html.aside-compact-initial #aside-panel {
        width: 80px;
        min-width: 80px;
        max-width: 80px;
        overflow: visible;
        z-index: 2;
        transition: none;
    }

    html.aside-compact-initial #widgets,
    html.aside-compact-initial #aside-footer {
        padding-left: 12px;
        padding-right: 12px;
    }

    html.aside-compact-initial #aside-header {
        overflow: visible;
    }

    html.aside-compact-initial #chat-list-wrapper,
    html.aside-compact-initial #login-widget,
    html.aside-compact-initial .widget .widget-text {
        display: none;
    }

    html.aside-compact-initial #aside-collapse-toggle {
        width: 32px;
        height: 32px;
        color: rgba(255, 255, 255, 0.951);
        opacity: 1;
        transform: none;
    }

    html.aside-compact-initial #logo-wrapper {
        justify-content: center;
        gap: 0;
    }

    html.aside-compact-initial #logo-text {
        display: none;
        position: static;
        transform: none;
    }

    html.aside-compact-initial .widget {
        justify-content: center;
        align-items: center;
        min-height: 42px;
        padding-left: 0;
        padding-right: 0;
        overflow: visible;
        border: none;
    }

    html.aside-compact-initial .widget svg,
    html.aside-compact-initial .widget-accent svg,
    html.aside-compact-initial .widget i,
    html.aside-compact-initial .new-chat-icon,
    html.aside-compact-initial .legal-icon {
        display: block;
        margin-right: auto;
        margin-left: auto;
    }

    html.aside-compact-initial .user-widget {
        justify-content: center;
        gap: 0;
    }

    html.aside-compact-initial .user-widget .user-info {
        display: none;
    }

    html.aside-compact-initial .user-widget .dots-horizontal-icon {
        margin-left: auto;
        margin-right: auto;
    }

    html.aside-compact-initial .user-info {
        width: auto;
        mask-image: none;
        -webkit-mask-image: none;
    }

    html.aside-compact-initial .user-img {
        margin-right: 0;
    }

    html.aside-compact-initial #login-widget-compact {
        display: flex !important;
        min-height: 42px;
    }

    html.aside-compact-initial #login-widget-compact span {
        display: none;
    }

    html.aside-compact-initial #login-widget-compact svg {
        width: calc(var(--basic-size) * 1.375);
        height: calc(var(--basic-size) * 1.375);
        margin-right: 0;
        fill: var(--accent-color);
    }

    #app-wrapper.aside-compact #aside-panel {
        width: 80px;
        min-width: 80px;
        max-width: 80px;
        overflow: visible;
        z-index: 2;
    }

    #app-wrapper.aside-compact #widgets,
    #app-wrapper.aside-compact #aside-footer {
        padding-left: 12px;
        padding-right: 12px;
    }

    #app-wrapper.aside-compact #aside-header {
        overflow: visible;
    }

    #app-wrapper.aside-compact #chat-list-wrapper,
    #app-wrapper.aside-compact #login-widget,
    #app-wrapper.aside-compact .widget .widget-text {
        display: none;
    }

    #app-wrapper.aside-compact #aside-collapse-toggle {
        width: 32px;
        height: 32px;
        color: rgba(255, 255, 255, 0.951);
        opacity: 1;
        transform: none;
    }

    #app-wrapper.aside-compact #logo-wrapper {
        justify-content: center;
        gap: 0;
    }

    #app-wrapper.aside-compact #logo-text {
        display: none;
        position: static;
        transform: none;
    }

    #app-wrapper.aside-compact .widget {
        justify-content: center;
        align-items: center;
        min-height: 42px;
        padding-left: 0;
        padding-right: 0;
        overflow: visible;
        border: none;
    }

    #app-wrapper.aside-compact .widget svg,
    #app-wrapper.aside-compact .widget-accent svg,
    #app-wrapper.aside-compact .widget i,
    #app-wrapper.aside-compact .new-chat-icon,
    #app-wrapper.aside-compact .legal-icon {
        display: block;
        margin-right: auto;
        margin-left: auto;
    }

    #app-wrapper.aside-compact .user-widget {
        justify-content: center;
        gap: 0;
    }

    #app-wrapper.aside-compact .user-widget .user-info {
        display: none;
    }

    #app-wrapper.aside-compact .user-widget .dots-horizontal-icon {
        margin-left: auto;
        margin-right: auto;
    }

    #app-wrapper.aside-compact .user-info {
        width: auto;
        mask-image: none;
        -webkit-mask-image: none;
    }

    #app-wrapper.aside-compact .user-img {
        margin-right: 0;
    }

    #app-wrapper.aside-compact #login-widget-compact {
        display: flex !important;
        min-height: 42px;
    }

    #app-wrapper.aside-compact #login-widget-compact span {
        display: none;
    }

    #app-wrapper.aside-compact #login-widget-compact svg {
        width: calc(var(--basic-size) * 1.375);
        height: calc(var(--basic-size) * 1.375);
        margin-right: 0;
        fill: var(--accent-color);
    }

    #app-wrapper.aside-compact #user-widget-wrapper .dropdown-menu {
        bottom: 0;
        left: calc(100% + 12px);
        width: 240px;
        transform-origin: left bottom;
    }

    #app-wrapper.aside-compact [data-tooltip]::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 12px);
        top: 50%;
        transform: translateY(-50%);
        padding: 7px 10px;
        border-radius: 999px;
        background: rgba(21, 30, 43, 0.96);
        color: #fff;
        font-size: 12px;
        line-height: 1;
        white-space: nowrap;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.16s ease;
    }

    #app-wrapper.aside-compact [data-tooltip]:hover::after,
    #app-wrapper.aside-compact [data-tooltip]:focus-visible::after {
        opacity: 1;
    }
}

/* ========================================================================
   ========================= CHOICES.JS TAGS =============================
   ======================================================================== */
.choices__list--multiple .choices__item {
    background-color: var(--dark-color);
    border: 1px solid var(--border-color);
}

.choices__list--multiple .choices__item.is-highlighted {
    background-color: var(--accent-color);
    color: white;
}

.choices[data-type*=select-multiple] .choices__button,
.choices[data-type*=text] .choices__button {
    background-color: var(--dark-color);
    color: white;
    border-left: 1px solid var(--border-color);
}

/* ========================================================================
   ========================= MESSAGE SOURCES =============================
   ======================================================================== */
.message-content {
    color: #333;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}

.message-content.stream-pulse {
    animation: streamPulse 0.15s ease-out;
}

@keyframes streamPulse {
    0% {
        filter: brightness(0.97);
    }

    50% {
        filter: brightness(1.03);
    }

    100% {
        filter: brightness(1);
    }
}

.message-sources-container {
    margin-top: 0;
    padding-left: 12px;
    padding-top: 0;
}

.message-sources-list {
    margin-top: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin-top 0.2s ease;
}

.message-sources-list.collapsed {
    max-height: 0;
    opacity: 0;
}

.message-sources-list.expanded {
    max-height: 500px;
    margin-top: 6px;
    opacity: 1;
}

.message-sources-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0;
}

.source-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: min(280px, 70vw);
    min-height: 22px;
    padding: 2px 7px 2px 8px;
    background: #f8fafc;
    border: 0;
    border-radius: 999px;
    text-decoration: none;
    color: #4a5568;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-size: 12px;
    line-height: 1.3;
}

#dialog-window article.message a.source-item {
    text-decoration: none;
}

.source-item:hover {
    background: #f1f5f9;
    color: var(--dark-color);
}

#dialog-window article.message a.source-item:hover,
#dialog-window article.message a.source-item:focus {
    text-decoration: none;
}

.message-sources-action-btn:focus-visible,
.source-item:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(160, 5, 90, 0.12);
}

.source-favicon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #e2e8f0;
}

.source-favicon.message-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.message-source-name {
    flex: 1 1 auto;
    font-weight: 500;
    color: inherit;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.external-link-icon {
    width: 11px;
    height: 11px;
    opacity: 0.58;
    flex-shrink: 0;
}

.message-action-btn[hidden] {
    display: none;
}

.message-actions .message-sources-action-btn {
    gap: 6px;
    padding: 8px 10px;
}

.message-actions .message-sources-action-btn.expanded {
    background: #e5e7eb;
    color: var(--text-primary);
}

.message-sources-action-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.message-action-label {
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
}

@media (max-width: 768px) {
    .message-actions .message-sources-action-btn {
        gap: 0;
        padding: 8px;
    }

    .message-sources-action-btn .message-action-label {
        display: none;
    }
}

.legal-citation-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: min(260px, 62vw);
    min-height: 22px;
    margin: 0 3px;
    padding: 2px 7px 2px 8px;
    border-radius: 999px;
    background: #f8fafc;
    border: 0;
    color: #4a5568;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: none;
    vertical-align: middle;
    white-space: nowrap;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.legal-citation-badge-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.legal-citation-badge::after {
    content: "";
    width: 12px;
    height: 12px;
    flex: 0 0 auto;
    opacity: 0.58;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6'/%3E%3Cpath d='M10 14 21 3'/%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h6v6'/%3E%3Cpath d='M10 14 21 3'/%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3C/svg%3E") center / contain no-repeat;
}

.legal-citation-badge:hover {
    background: #f1f5f9;
    color: var(--dark-color);
    text-decoration: none;
}

.legal-citation-badge:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(160, 5, 90, 0.12);
}

.legal-citation-badge.loading {
    opacity: 0.65;
    pointer-events: none;
}

.legal-citation-popover-backdrop {
    position: fixed;
    inset: 0;
    z-index: 110000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.28);
}

.legal-citation-popover {
    width: min(720px, 100%);
    max-height: min(78vh, 760px);
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.22);
    overflow: hidden;
}

.legal-citation-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #edf0f2;
}

.legal-citation-popover-title {
    min-width: 0;
    font-size: 15px;
    font-weight: 650;
    color: #212529;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.legal-citation-popover-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: #f1f3f5;
    color: #495057;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.legal-citation-popover-close:hover {
    background: #e9ecef;
}

.legal-citation-popover-body {
    padding: 16px;
    overflow: auto;
    color: #212529;
    font-size: 14px;
    line-height: 1.6;
}

.legal-citation-popover-body > :first-child {
    margin-top: 0;
}

.legal-citation-popover-body > :last-child {
    margin-bottom: 0;
}

.legal-citation-popover-body table {
    border-collapse: collapse;
    width: max-content;
    min-width: 100%;
}

.legal-citation-popover-body th,
.legal-citation-popover-body td {
    border: 1px solid #d7dde3;
    padding: 6px 8px;
    vertical-align: top;
}

.legal-citation-popover-body th {
    background: #f8f9fa;
    font-weight: 600;
}

.legal-citation-popover-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 12px 16px;
    border-top: 1px solid #edf0f2;
    background: #fafafa;
}

.legal-citation-source-url {
    color: var(--dark-color);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.legal-citation-source-url:hover {
    text-decoration: underline;
}

.legal-citation-download-url {
    color: var(--dark-color);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.legal-citation-download-url:hover {
    text-decoration: underline;
}

.legal-citation-attachment-meta {
    margin: 0 0 12px;
    color: #607080;
    font-size: 12px;
    line-height: 1.45;
}

@media (max-width: 768px) {
    .legal-citation-popover-backdrop {
        align-items: center;
        padding: calc(env(safe-area-inset-top, 0px) + 12px) 10px calc(env(safe-area-inset-bottom, 0px) + 10px);
    }

    .legal-citation-popover {
        width: 100%;
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 22px);
        border-radius: 16px 16px 0 0;
    }

    .legal-citation-popover-title {
        display: -webkit-box;
        white-space: normal;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .legal-citation-popover-header,
    .legal-citation-popover-footer {
        flex: 0 0 auto;
    }

    .legal-citation-popover-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        padding: 16px 16px 18px;
        overscroll-behavior: contain;
    }

    .legal-citation-badge {
        max-width: min(180px, 58vw);
    }
}

@keyframes message-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ========================================================================
   ========================= LONG TEXT CONTENT ===========================
   ======================================================================== */
.long-text {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    line-height: 1.6;
    color: #333;
    background-color: white;
    border-radius: 20px;
}

.last-updated {
    font-style: italic;
    color: #666;
    margin-bottom: 20px;
}

.contact-email {
    color: #3498db;
    text-decoration: none;
}

.contact-email:hover {
    text-decoration: underline;
}

.seo-page-dialog-window {
    padding: 24px;
}

.seo-info-page {
    max-width: 920px;
    padding: 32px;
    color: var(--dark-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.seo-info-hero {
    padding: 4px 0 12px;
}

.seo-info-kicker {
    color: var(--accent-color);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin: 0 0 10px;
    text-transform: uppercase;
}

.seo-info-page h1 {
    color: var(--dark-color);
    font-size: 32px;
    line-height: 1.2;
    margin: 0 0 16px;
}

.seo-info-page h2 {
    color: var(--dark-color);
    font-size: 24px;
    line-height: 1.25;
    margin: 0 0 12px;
}

.seo-info-page h3 {
    color: var(--dark-color);
    font-size: 17px;
    line-height: 1.3;
    margin: 0 0 8px;
}

.seo-info-page p,
.seo-info-page li {
    color: #4a5568;
    font-size: 16px;
    line-height: 1.65;
}

.seo-info-lead {
    max-width: 760px;
    font-size: 18px !important;
    color: #334155 !important;
    margin-bottom: 22px;
}

.seo-info-primary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-color);
    border-radius: 24px;
    color: #ffffff !important;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 20px;
    text-decoration: none;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.seo-info-primary-link:hover,
.seo-info-primary-link:focus {
    color: #ffffff !important;
    box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.16), 0px 4px 8px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.seo-info-section {
    border-top: 1px solid #e2e8f0;
    margin-top: 28px;
    padding-top: 24px;
}

.seo-info-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.seo-info-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.seo-info-card p {
    margin: 0;
}

.canvas-message-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 4px;
    padding: 4px 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--accent-color);
    font: 500 13px var(--body-font);
    cursor: pointer;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    text-align: left;
}

.canvas-message-card span {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.canvas-message-card > i {
    flex: 0 0 auto;
}

.canvas-message-card .fa-chevron-right {
    font-size: 10px;
}

.canvas-message-card:hover {
    color: #740343;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.canvas-message-card:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.canvas-prosemirror table {
    width: 100%;
    margin: 0 0 1em;
    border-collapse: collapse;
    table-layout: fixed;
}

.canvas-prosemirror th,
.canvas-prosemirror td {
    min-width: 80px;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    vertical-align: top;
    text-align: left;
}

.canvas-prosemirror th {
    background: #f1f5f9;
    color: #1e293b;
    font-weight: 600;
}

.canvas-prosemirror .selectedCell::after {
    position: absolute;
    inset: 0;
    z-index: 2;
    content: "";
    pointer-events: none;
    background: rgba(37, 99, 235, 0.12);
}

.canvas-prosemirror td,
.canvas-prosemirror th {
    position: relative;
}

.seo-info-card p + p {
    margin-top: 12px;
}

.seo-info-page a {
    color: var(--accent-color);
    font-weight: 600;
    text-decoration: none;
}

.seo-info-page a:hover,
.seo-info-page a:focus {
    text-decoration: underline;
}

.seo-info-fact-list {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    margin: 18px 0 20px;
    padding: 4px 18px;
}

.seo-info-fact-list div {
    display: grid;
    grid-template-columns: minmax(160px, 220px) 1fr;
    gap: 14px;
    border-top: 1px solid #e2e8f0;
    padding: 13px 0;
}

.seo-info-fact-list div:first-child {
    border-top: 0;
}

.seo-info-fact-list dt {
    color: var(--dark-color);
    font-weight: 700;
}

.seo-info-fact-list dd {
    color: #4a5568;
    margin: 0;
}

.seo-info-warning {
    background: linear-gradient(180deg, #fff4db 0%, #ffe8bf 100%);
    border: 1px solid rgba(184, 93, 0, 0.22);
    border-radius: 16px;
    color: #7a4300;
    padding: 18px;
}

.seo-info-warning h2,
.seo-info-warning p {
    color: #7a4300;
}

.seo-info-faq details {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    margin-top: 12px;
    padding: 14px 16px;
}

.seo-info-faq summary {
    color: var(--dark-color);
    cursor: pointer;
    font-weight: 700;
}

.seo-info-faq details p {
    margin: 12px 0 2px;
}

.seo-info-footer {
    border-top: 1px solid #e2e8f0;
    margin-top: 28px;
    padding-top: 24px;
}

.seo-info-social-links {
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
    margin: 14px 0 0;
}

.seo-info-social-links a {
    color: var(--accent-color);
    font-weight: 600;
    text-decoration: none;
}

.seo-info-social-links a:hover,
.seo-info-social-links a:focus {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .seo-page-dialog-window {
        padding: 14px;
    }

    .seo-info-page {
        padding: 22px;
    }

    .seo-info-page h1 {
        font-size: 28px;
    }

    .seo-info-card-grid {
        grid-template-columns: 1fr;
    }

    .seo-info-primary-link {
        width: 100%;
        box-sizing: border-box;
    }

    .seo-info-fact-list div {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}

/* ========================================================================
   ========================= ALERT MODAL ===========================
   ======================================================================== */
.alert-wrapper {
    display: flex;
    flex-direction: column;
    /* background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10), 0 1.5px 6px rgba(0, 0, 0, 0.06);
    padding: 28px 32px 20px 32px; */
    min-width: 320px;
    max-width: 95vw;
    margin: 0 auto;
    font-family: var(--body-font);
    color: var(--dark-color);
    transition: box-shadow 0.2s, background 0.2s;
}

.alert-wrapper .alert-content {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
}

.alert-wrapper .alert-content .icon {
    background: #b4b4b4;
    /* verde standard pentru confirmare */
    color: #fff;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6em;
    /* box-shadow: 0 2px 8px rgba(40,167,69,0.10); */
    margin-right: 0;
    flex-shrink: 0;
}

.alert-wrapper.alert-danger .alert-content .icon {
    background: #dc3545;
    /* roșu standard pentru alertă */
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.10);
}

.alert-wrapper .alert-content .message {
    font-size: 1.1em;
    font-weight: 500;
    color: var(--dark-color);
    line-height: 1.5;
    margin: 0;
    background-color: transparent;
}

.alert-wrapper .buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 0;
    flex-wrap: wrap;
}

.alert-wrapper .buttons .btn-confirm,
.alert-wrapper .buttons .btn-cancel {
    padding: 10px 24px;
    border-radius: 9999px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1.2;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.alert-wrapper .buttons .btn-confirm {
    background-color: #28a745;
    color: #fff;
}

.alert-wrapper .buttons .btn-confirm:hover {
    background-color: #229e4a;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(40, 167, 69, 0.25);
}

.alert-wrapper .buttons .btn-cancel {
    background-color: #dc3545;
    color: #fff;
}

.alert-wrapper .buttons .btn-cancel:hover {
    background-color: #c82333;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(220, 53, 69, 0.25);
}

.alert-wrapper .buttons .btn-confirm:active,
.alert-wrapper .buttons .btn-cancel:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.alert-wrapper .buttons .btn-confirm:focus-visible {
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.25), 0 2px 8px rgba(0, 0, 0, 0.06);
}

.alert-wrapper .buttons .btn-cancel:focus-visible {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25), 0 2px 8px rgba(0, 0, 0, 0.06);
}

.alert-wrapper .buttons .btn-confirm:disabled,
.alert-wrapper .buttons .btn-cancel:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.text-align-center {
    text-align: center;
}











/* ========================================================================
   ========================= EVENT CARDS ==================================
   ======================================================================== */
.message-text .event {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    margin: 10px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.message-text .event:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

/* Stiluri pentru elementele event */
.message-text .event .event-details h2 {
    color: var(--accent-color);
    margin: 0 0 12px 0;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.3;
}

.message-text .event .event-details p {
    margin: 6px 0;
    font-size: 0.95rem;
    color: var(--dark-color);
    line-height: 1.4;
}

.message-text .event .event-details strong {
    color: var(--dark-color);
    font-weight: 600;
}

.message-text .event .event-details a {
    color: var(--accent-color);
    text-decoration: underline dotted;
    text-underline-offset: 3px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.message-text .event .event-details a:hover {
    color: #740343;
    text-decoration: underline;
}

.message-text .event img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin: 12px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    align-self: center;
}

.message-text .event>div:last-child {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #555;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
}

/* Layout pentru desktop - imagine în stânga, detalii în dreapta */
@media (min-width: 769px) {
    .message-text .event {
        display: grid;
        grid-template-columns: 40% 1fr;
        grid-template-rows: auto auto;
        gap: 16px 20px;
        grid-template-areas:
            "image details"
            "description description";
    }

    .message-text .event img {
        grid-area: image;
        width: 100%;
        height: 150px;
        object-fit: cover;
        margin: 0;
    }

    .message-text .event .event-details {
        grid-area: details;
        align-self: start;
        margin: 0;
    }

    .message-text .event>div:last-child {
        grid-area: description;
        margin-top: 0;
        padding-top: 16px;
        border-top: 1px solid #e9ecef;
    }
}

/* ========================================================================
   ========================= RESPONSIVE DESIGN ===========================
   ======================================================================== */

/* Extra large screens */
@media (min-width: 768px) {

}


@media (max-width: 1900px) {
    :root {
        --basic-size: 14px;
    }

    #prompt-area,
    #attachments-list,
    #dialog-window {
        width: 80%;
    }
}

/* Large screens */
@media (max-width: 1500px) {
    :root {
        --basic-size: 14px;
    }

    #logo-text {
        font-size: calc(var(--basic-size) * 2.8);
    }

    #prompt-area,
    #attachments-list,
    #dialog-window {
        width: 90%;
    }
}

@media (max-width: 1300px) {
    :root {
        --basic-size: 12px;
    }

    #logo-text {
        font-size: calc(var(--basic-size) * 2.9);
    }

    #logo-wrapper {
        padding: 30px 10%;
    }

    #prompt-area,
    #attachments-list,
    #dialog-window {
        width: 90%;
    }

    /* #chat-list-wrapper {
        max-height: 25vh;
    } */
}

@media (min-width: 769px) and (max-width: 1200px) {
    #logo-text {
        left: auto;
        right: 10%;
        transform: none;
    }
}

@media (min-width: 1025px) and (max-width: 1500px),
(min-width: 1025px) and (max-height: 760px) {
    aside {
        min-width: 250px;
        width: 25%;
        max-width: 340px;
    }

    #main-stage {
        margin: 10px;
        height: calc(100% - 20px);
        border-radius: 18px;
    }

    #widgets,
    #chat-list-wrapper,
    #aside-footer {
        padding-left: 9%;
        padding-right: 9%;
    }

    #logo-wrapper {
        padding-top: 22px;
        padding-bottom: 22px;
    }

    #ideea-logo,
    #logo-text {
        font-size: calc(var(--basic-size) * 2.65);
    }

    .widget {
        margin-bottom: 8px;
        padding: 9px 12px;
        font-size: calc(var(--basic-size) * 1.28);
    }

    .aside-delimeter-text {
        font-size: calc(var(--basic-size) * 1.38);
    }

    #chat-list-wrapper {
        margin-top: 8px;
        padding-bottom: 6px;
    }

    .conversation-link {
        padding: 4px 9px;
        min-height: 20px;
        font-size: calc(var(--basic-size) * 1.18);
    }

    .user-info {
        font-size: calc(var(--basic-size) * 1.2);
    }
}

@media (min-width: 1301px) {
    #logo-wrapper {
        padding: 40px 10%;
    }
}

@media (min-width: 1901px) {
    #logo-wrapper {
        padding: 50px 10%;
    }
}

@media (min-width: 769px) and (max-height: 760px) {
    #login-widget {
        display: none !important;
        min-height: 0;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
    }

    #login-widget .widget-text {
        display: none;
    }

    #login-widget .login-button {
        width: 100%;
        height: 38px;
        margin: 0;
    }

    #login-widget-compact {
        display: flex !important;
        width: auto;
        height: 38px;
        min-height: 38px;
        padding-top: 0;
        padding-bottom: 0;
        margin-bottom: 8px;
        border-radius: 999px;
    }
}

/* Tablet */
@media (max-height: 750px),
(max-width: 1300px) {
    .conversation-list {
        display: flex;
    }

}

/* Mobile */
@media (max-width: 768px) {
    #app-wrapper {
        position: relative;
        overflow-x: hidden;
    }

    aside {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 75vw;
        max-width: 300px;
        /* z-index: 2; */
        transform: translateX(-100%);
        transition: transform 0.4s ease-in-out;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    }

    #aside-collapse-toggle {
        display: none;
    }

    #app-wrapper.expanded aside {
        transform: translateX(0);
    }

    #main-stage {
        transition: transform 0.4s ease-in-out;
        position: relative;
        background: transparent;
        /* z-index: 900; */
    }

    #app-wrapper.expanded #main-stage {
        transform: translateX(75vw);
    }

    #overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(255, 247, 247, 0.4);
        z-index: 2;
        transition: opacity 0.4s ease-in-out;
        backdrop-filter: blur(1px);
        -webkit-backdrop-filter: blur(1px);
    }

    #app-wrapper.expanded #overlay {
        display: block;
    }

    #main-stage {
        margin: 0px;
    }

    #mobile-header-wrapper {
        display: block;
        width: 100%;
    }

    #chat-mobile-header {
        display: flex;
    }

    .user-message {
        max-width: 90%;
        margin-right: 0px;
        --user-message-fade-height: 58px;
    }

    .message {
        margin: 5px 0px 5px 0px;
    }

    .message-with-attachments.user-message-wrapper {
        max-width: 90%;
        margin-right: 0px;
    }

    #dialog-window {
        width: 90%;
        /* padding-bottom: 90px; */
    }

    #attach-button-wrapper {
        gap: 0px;
        margin-right: 0px;
        margin-left: 10px;
    }

    #attach-button {
        padding: 0px;
    }

    #attach-button:hover {
        background: transparent;
    }

    .attach-dropdown {
        left: 0;
        right: auto;
        min-width: 210px;
        max-width: min(84vw, 280px);
        bottom: calc(100% + 8px);
    }

    .chat-processing-toggle {
        display: none;
    }

    #attachments-list,
    #prompt-area {
        margin: 0px;
        width: 100%;
        /* transition: bottom 0.2s ease-out; */
    }

    /* Când bara mobilă este vizibilă, ridicăm prompt-area deasupra ei (fără overlap vizual) */
    #prompt-area.over-bottom-bar {
        margin-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    }

    #attachments-list {
        border-radius: 20px 20px 0px 0px;
        padding: 10px 0 0 0;
    }

    .prompt-input-container {
        border-radius: 20px 20px 20px 20px;
        padding: 12px;
    }

    /* Banner de notificare - tablete */
    @media (min-width: 481px) and (max-width: 768px) {
        .limit-notification-banner {
            width: calc(100% - 24px);
            max-width: 800px;
            padding: 16px;
            margin: 0 auto 15px auto;
            left: 0;
        }

        .limit-banner-content {
            gap: 14px;
        }

        .limit-banner-title {
            font-size: 14px;
        }

        .limit-banner-action {
            padding: 11px 18px;
            font-size: 13px;
        }
    }

    /* Banner de notificare - mobile */
    .limit-notification-banner {
        border-radius: 12px;
        padding: 16px;
        margin: 0 auto 15px auto;
        width: calc(100% - 24px);
        max-width: calc(100% - 24px);
        left: 0;
    }

    .limit-banner-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
        padding-right: 0;
    }

    .limit-banner-title {
        font-size: 15px;
        line-height: 1.4;
        padding: 0 28px;
        width: 100%;
        box-sizing: border-box;
    }

    .limit-banner-desc {
        font-size: 14px;
        min-width: unset;
        line-height: 1.5;
        width: 100%;
    }

    .limit-banner-action {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
        font-size: 14px;
        margin-top: 4px;
    }

    .limit-banner-actions {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }

    .limit-banner-close {
        position: absolute;
        top: -6px;
        right: 0px;
        margin-left: 0;
        font-size: 28px;
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
    }


    /* Banner pentru ecrane foarte mici */
    @media (max-width: 480px) {
        .limit-notification-banner {
            padding: 14px;
            border-radius: 10px;
            margin: 0 auto 15px auto;
            width: calc(100% - 20px);
            max-width: calc(100% - 20px);
            left: 0;
        }

        .limit-banner-title {
            font-size: 14px;
            padding: 0 24px;
            width: 100%;
            box-sizing: border-box;
        }

        .limit-banner-desc {
            font-size: 14px;
        }

        .limit-banner-action {
            padding: 11px 16px;
            font-size: 14px;
        }

        .limit-banner-close {
            top: -6px;
            right: 0px;
            font-size: 26px;
            width: 26px;
            height: 26px;
        }
    }

    /* Banner pentru orientare landscape pe mobile */
    @media (max-width: 768px) and (orientation: landscape) {
        .limit-notification-banner {
            padding: 12px 44px 12px 14px;
        }

        .limit-banner-content {
            flex-direction: row;
            flex-wrap: wrap;
            gap: 10px;
        }

        .limit-banner-title {
            font-size: 14px;
            padding-right: 0;
            margin-right: 8px;
        }

        .limit-banner-desc {
            flex: 1;
            min-width: 200px;
            font-size: 14px;
        }

        .limit-banner-action {
            width: auto;
            padding: 10px 18px;
            margin-top: 0;
        }

        .limit-banner-actions {
            width: auto;
            flex-direction: row;
        }
    }

    .prompt-toolbox {
        padding: 4px 0 0 0;
    }

    textarea#prompt {
        padding-left: 10px;
    }

    .generic-modal-content {
        padding: calc(var(--basic-size));
    }

    #settings {
        height: 90vh;
        min-height: auto;
    }

    #settings .content {
        width: 95%;
    }


    /* Mobile bottom bar */
    #mobile-bottom-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        min-height: 60px;
        padding-bottom: 20px;
        background-color: white;
        font-size: 26px;
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 100000;
    }

    #mobile-bottom-bar.with-border-radius {
        border-radius: 20px 20px 0 0;
        box-shadow: 0px -10px 10px rgba(0, 0, 0, 0.1);
        border: 1px solid var(--border-color);
    }

    #mobile-bottom-bar svg {
        width: 27px;
        height: 27px;
        padding: 15px 40px;
    }

    #mobile-bottom-bar i {
        color: #4f4f4f;
        cursor: pointer;
        transition: color 0.3s ease, transform 0.2s ease;
    }

    #mobile-bottom-bar i.on-page {
        color: var(--dark-color);
    }

    #mobile-bottom-bar.hidden {
        display: none;
    }

    body.mini-browser-open #mobile-bottom-bar {
        display: none !important;
    }

    /* Aside logo text */
    #logo-text {
        display: none;
    }

    #logo-wrapper {
        padding: 20px;
    }

    /* Event cards optimizate pentru mobile */
    .message-text .event {
        display: flex !important;
        flex-direction: column !important;
        grid-template-areas: none !important;
        grid-template-columns: none !important;
        grid-template-rows: none !important;
        gap: 0 !important;
        padding: 12px;
        margin: 8px 0;
        border-radius: 10px;
    }

    .message-text .event .event-details {
        grid-area: unset !important;
        align-self: unset !important;
        margin: 0 0 12px 0 !important;
    }

    .message-text .event .event-details h2 {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }

    .message-text .event .event-details p {
        font-size: 0.85rem;
        margin: 4px 0;
    }

    .message-text .event img {
        grid-area: unset !important;
        width: 100% !important;
        height: auto !important;
        max-height: 150px;
        margin: 10px 0 !important;
        border-radius: 6px;
    }

    .message-text .event>div:last-child {
        grid-area: unset !important;
        font-size: 0.85rem;
        margin-top: 10px !important;
        padding-top: 10px;
    }
}

/* Landscape orientation on mobile */
@media screen and (max-width: 1000px) and (orientation: landscape) {
    #chat-list-wrapper {
        display: none !important;
    }
}

@media (hover: hover) and (pointer: fine) {
    #send-button:hover {
        box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2), 0px 4px 8px rgba(0, 0, 0, 0.15);
        transform: translateY(-2px);
    }
}



@media (max-width: 600px) {
    .alert-wrapper {
        padding: 18px 8vw 14px 8vw;
        min-width: unset;
    }

    .alert-wrapper .alert-content .icon {
        width: 36px;
        height: 36px;
        font-size: 1.2em;
    }
}

/* ========================================================================
   ========================= EVENT META TAGS ==============================
   ======================================================================== */
.event-meta-container {
    margin-top: auto;
}

/* ========================================================================
   ========================= FAQ SECTION ===============================
   ======================================================================== */

@media (max-width: 768px) {
    #faq {
        background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
        padding: 20px;
        border-radius: 24px;

    }
}

.faq-section {
    padding: 48px 0;
    border-top: 1px solid rgba(0, 0, 0, .06);
}

.faq-header {
    text-align: center;
    margin-bottom: 24px;
}

.faq-header .faq-subtitle {
    color: #666;
    margin-top: 8px;
}

.faq-accordion {
    max-width: 960px;
    margin: 0 auto;
}

.faq-item {
    border-bottom: 1px solid rgba(0, 0, 0, .08);
}

.faq-trigger {
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    padding: 16px 0;
    font-size: 18px;
    line-height: 1.4;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--dark-color);
}

.faq-trigger::after {
    content: "+";
    transition: transform .2s ease;
    font-size: 24px;
    margin-left: 10px;
}

.faq-trigger[aria-expanded="true"]::after {
    content: "–";
    transition: transform .2s ease;
    font-size: 24px;
    margin-left: 10px;
}

.faq-panel {
    padding: 0 0 16px;
    color: #444;
}

#faq-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 6px;
}

/* ========================================================================
   ========================= PRICING SECTION ===============================
   ======================================================================== */

#pricing {
    margin: 30px auto;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 1px solid #eef2f7;
    border-radius: 24px;
    box-shadow: 0 10px 30px rgba(17, 24, 39, 0.04);
}

#pricing .pricing-header {
    text-align: center;
    margin-bottom: 18px;
}

#pricing .pricing-title {
    font-size: 34px;
    margin: 0 0 6px 0;
    font-weight: 700;
    color: #111827;
}

#pricing .pricing-subtitle {
    color: #6b7280;
    margin: 0 0 16px 0;
    font-size: 15px;
}

/* Toggle */
#pricing .pricing-toggle {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    background: #f6f7f9;
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    padding: 4px;
}

#pricing .pricing-toggle .toggle-btn {
    border: none;
    background: transparent;
    color: #4b5563;
    padding: 8px 14px;
    border-radius: 9999px;
    font-weight: 600;
    cursor: pointer;
}

#pricing .pricing-toggle .toggle-btn.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
    border: 1px solid rgba(17, 24, 39, 0.08);
}

#pricing .pricing-toggle .badge-save {
    display: none;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 9999px;
    background: #111827;
    color: #ffffff;
    font-size: 11px;
}

#pricing.is-annual .pricing-toggle .badge-save {
    display: inline-block;
}

/* Grid */
#pricing .pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px;
    margin-top: 32px;
}

/* Card */
#pricing .pricing-card {
    background: #ffffff;
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.06);
    padding: 24px;
    display: flex;
    flex-direction: column;
    transition: transform .18s ease, box-shadow .2s ease, border-color .2s ease;
}

#pricing .pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(16, 24, 40, 0.10);
}

#pricing .pricing-card .card-header {
    margin-bottom: 12px;
}

#pricing .card-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: var(--dark-color);
}

#pricing>div>article.pricing-card.enterprise>div>h3,
#pricing>div>article.pricing-card.enterprise>div>div.price-row,
#pricing>div>article.pricing-card.enterprise>div>div.details {
    color: white;
}

#pricing .pill-hot {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fde68a;
    color: #92400e;
    border-radius: 9999px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 8px;
}

#pricing .price-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
    color: var(--dark-color);
}

#pricing .price-row .currency {
    font-size: 22px;
}

#pricing .price-row .amount {
    font-size: 44px;
    font-weight: 600;
    line-height: 1;
}

#pricing .price-row.custom {
    font-size: 38px;
    font-weight: 700;
}

#pricing .billing-note,
#pricing .details {
    color: #6b7280;
    font-size: 12px;
}

#pricing .features {
    list-style: none;
    padding: 0;
    margin: 14px 0 18px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #374151;
}

#pricing .features li {
    display: flex;
    align-items: flex-start;
}

#pricing .features li i {
    color: var(--accent-color);
    margin-right: 8px;
    flex-shrink: 0;
    margin-top: 4px;
}

#pricing .cta-btn {
    appearance: none;
    border: 1px solid rgba(17, 24, 39, 0.08);
    background: #f9fafb;
    color: #0f172a;
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s ease, transform .15s ease, box-shadow .2s ease;
    margin-top: auto;
}

#pricing .cta-btn:hover {
    background: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.08);
}

#pricing .cta-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25), 0 8px 20px rgba(16, 24, 40, 0.08);
}

#pricing .featured {
    border-color: var(--accent-color);
}

#pricing .enterprise {
    background: linear-gradient(135deg, #0f172a 0%, #111827 60%);
    color: #ffffff;
    border-color: transparent;
}

#pricing .enterprise .features {
    color: rgba(255, 255, 255, 0.9);
}

#pricing .enterprise .features li i {
    color: #10b981;
}

#pricing .enterprise .billing-note {
    color: rgba(255, 255, 255, 0.75);
}

#pricing .enterprise .cta-btn.dark {
    background: #ffffff;
    color: #111827;
}

@media (max-width: 900px) {
    #pricing .pricing-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}


.event-meta-tags {
    display: flex;
    /* flex-wrap: wrap; */
    gap: 10px;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding-top: 5px;
    mask-image: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 95%, rgba(0, 0, 0, 0) 100%);
    mask-image: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 95%, rgba(0, 0, 0, 0) 100%);
    mask-image: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 95%, rgba(0, 0, 0, 0) 100%);
    mask-image: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 95%, rgba(0, 0, 0, 0) 100%);
    mask-image: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 95%, rgba(0, 0, 0, 0) 100%);
    mask-image: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 95%, rgba(0, 0, 0, 0) 100%);
    mask-image: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 95%, rgba(0, 0, 0, 0) 100%);
    -webkit-mask-image: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 95%, rgba(0, 0, 0, 0) 100%);
    transition: max-height 0.5s ease-in-out;
    max-width: 650px;
}

.event-meta-tags::-webkit-scrollbar {
    height: 6px;
    border-radius: 3px;
    background: transparent;
    opacity: 0;
}

.event-meta-tags::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0;
}

.event-meta-tags:hover::-webkit-scrollbar {
    background: transparent;
    opacity: 1;
}

.event-meta-tags:hover::-webkit-scrollbar-thumb {
    background: #a0055a63;
    opacity: 1;
}



.event-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 16px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    border-radius: 25px;
    font-size: 13px;
    color: #495057;
    transition: all 0.3s ease;
    cursor: default;
    /* max-width: 200px; */
    /* overflow: hidden; */
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 10px;
}

.event-tag:hover {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
    border-color: #adb5bd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.event-tag i {
    font-size: 15px;
    color: var(--accent-color);
    flex-shrink: 0;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.event-tag:hover i {
    opacity: 1;
}

.event-tag-text {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

/* Hide empty tags */
.event-tag:empty,
.event-tag .event-tag-text:empty {
    display: none;
}

/* Source name text styling */
.source-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .event-meta-tags {
        gap: 6px;
        flex-wrap: wrap;
    }

    .event-tag {
        padding: 5px 10px;
        font-size: 11px;
        /* max-width: 150px; */
    }

    .event-tag i {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .event-meta-container {
        margin: 8px 0;
    }

    .event-tag {
        padding: 4px 8px;
        font-size: 10px;
        /* max-width: 120px; */
    }
}

/* ========================================================================
   ========================= MODAL BUTTONS ================================
   ======================================================================== */
.modal-primary-btn,
.modal-secondary-btn {
    background-color: #fff;
    color: #111;
    padding: 12px 18px;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: color .2s ease, background-color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    font-family: var(--body-font);
    min-width: 120px;
    text-align: center;
}

.modal-primary-btn {
    background-color: #111;
    color: #fff;
    border-color: #111;
}

.modal-primary-btn:hover {
    background-color: #1a1a1a;
    border-color: #1a1a1a;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.modal-secondary-btn:hover {
    background-color: #f8f8f8;
    border-color: #e0e0e0;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.payment-methods-container {
    text-align: center;
    padding: 2rem 0;
    border-top: 1px solid #e9ecef;
    margin-top: 1rem;
}

.payment-methods-title {
    color: #6c757d;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.payment-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.payment-logos img {
    height: 28px;
    filter: grayscale(100%);
    opacity: 0.5;
    transition: filter 0.3s ease, opacity 0.3s ease;
}

.payment-logos img:hover {
    filter: grayscale(0%);
    opacity: 1;
    cursor: pointer;
}

.cta-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

#pricing .cta-btn:hover {
    background: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.08);
}

#pricing .cta-btn:disabled,
#pricing .cta-btn:disabled:hover {
    background: #f3f4f6;
    color: #3b3b3b;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    border-color: #e5e7eb;
}

#pricing .cta-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25), 0 8px 20px rgba(16, 24, 40, 0.08);
}

#pricing .featured {
    border-color: var(--accent-color);
    filter: grayscale(0%);
    opacity: 1;
    cursor: pointer;
}

/* Pricing Page Styles */
.terms-accept-container {
    text-align: center;
    margin: 2rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: box-shadow 0.3s ease-in-out;
}

.terms-accept-container label {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #495057;
    margin-left: 0.5rem;
}

.highlight-animation {
    animation: highlight-pulse 1.5s ease-in-out;
}

@keyframes highlight-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(0, 123, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
    }
}

/* Legal Acts Search Button - Responsive Text */
.btn-text-full {
    display: inline !important;
}

.btn-text-mobile {
    display: none !important;
}

.search-btn-text-full {
    display: inline !important;
}

.search-btn-text-mobile {
    display: none !important;
}

@media screen and (max-width: 640px) {
    .btn-text-full {
        display: none !important;
    }

    .btn-text-mobile {
        display: inline !important;
    }

    .search-btn-text-full {
        display: none !important;
    }

    .search-btn-text-mobile {
        display: inline !important;
    }
}

/* Drag and drop styles */
.prompt-input-container.drag-over {
    border-color: var(--accent-color);
    background-color: var(--secondary-color);
    box-shadow: 0px 4px 16px rgba(66, 133, 244, 0.2);
    transform: scale(1.01);
    transition: all 0.2s ease;
}

.prompt-input-container.drag-over::before {
    content: 'Trage fișierele aici pentru a le atașa';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--accent-color);
    font-weight: 500;
    font-size: 14px;
    text-align: center;
    pointer-events: none;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.prompt-input-container.drag-over .prompt-input-container-inner {
    position: relative;
    z-index: 2;
    opacity: 0.3;
}

.prompt-input-container.drag-over #prompt {
    background-color: var(--secondary-color) !important;
}

/* Compact Login Widget Logic */
body.viewport-short #login-widget {
    display: none !important;
}

body.viewport-short #login-widget-compact {
    display: flex !important;
}

/* Gestionare header mobil pe ecrane foarte mici */
@media screen and (max-width: 768px) and (max-height: 680px) {
    /* Ascunde butonul de setări */
    #mobile-settings-button {
        display: none !important;
    }

    /* Afișează butonul de navigare */
    #mobile-nav-button {
        display: block !important;
    }

    /* Ascunde bottom bar */
    #mobile-bottom-bar {
        display: none !important;
    }
}

/* Stiluri pentru butonul de navigare mobil */
#mobile-nav-button {
    background-color: white;
    padding: calc(var(--basic-size) * 0.7);
    border-radius: 50%;
    cursor: pointer;
    height: calc(var(--basic-size) * 2);
    width: calc(var(--basic-size) * 2);
    display: none;
    font-size: 20px;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Share Modal Styles */
#share-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000;
}

#share-modal .modal-content {
    background-color: white;
    margin: auto;
    padding: 2.5rem;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 550px;
    border-radius: 16px;
    position: relative;
    color: var(--text-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#share-modal h3 {
    margin-top: 0;
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

#share-modal p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.share-link-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 6px;
    margin: 15px 0;
    transition: all 0.2s ease;
}

.share-link-wrapper:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(120, 120, 120, 0.1); 
}

#share-link-input {
    flex-grow: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 0.95rem;
    outline: none;
    width: 100%;
    font-family: monospace;
}

.copy-link-btn {
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    margin-left: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.copy-link-btn:hover {
    background-color: var(--secondary-color);
    border-color: var(--border-color);
    transform: translateY(-1px);
    color: var(--accent-color);
}

.share-actions {
    display: flex;
    gap: 12px;
    margin-top: 15px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.share-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 10px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    background: var(--bg-secondary);
    padding: 12px 16px;
    border-radius: 10px;
}

.share-meta p {
    margin: 0 !important;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Modal Danger Button */
.modal-danger-btn {
    background-color: #fff;
    color: #dc3545;
    padding: 12px 18px;
    border: 1px solid #f8d7da;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    font-family: var(--body-font);
}

.modal-danger-btn:hover {
    background-color: #fff5f5;
    border-color: #dc3545;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.15);
}

/* Mobile adjustments */
@media (max-width: 600px) {
    #share-modal .modal-content {
        padding: 1.5rem;
        width: 95%;
    }
    
    .share-actions {
        flex-direction: column;
    }
    
    .share-actions button {
        width: 100%;
    }
    
    .share-meta {
        flex-direction: column;
        gap: 8px;
    }
}

/* Feedback System */
.message-actions {
    position: relative;
    margin-top: 6px;
    padding-left: 12px;
    padding-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    gap: 8px; /* Spațiere mai aerisită */
    opacity: 1;
    transition: opacity 0.2s ease;
    z-index: 5;
    background: transparent; /* Fără fundal pentru aspect modern/aerisit */
}

.message-actions .canvas-message-card {
    flex: 0 1 100%;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

/* article.ai-message:hover .message-actions {
    opacity: 1;
} */

.message-action-btn {
    position: relative;
    background: transparent; /* Transparent implicit */
    border: none; /* Fără border implicit */
    color: #6b7280;
    border-radius: 10px;
    padding: 8px;
    cursor: pointer;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 1;
}

.message-action-btn:hover {
    background: #e5e7eb; /* Fundal subtil la hover */
    color: var(--text-primary);
    transform: translateY(-1px);
    opacity: 1;
}

.message-action-btn.active {
    background: #e5e7eb; /* Rămâne sur când e activ */
    color: #10b981;
    opacity: 1;
}

.message-action-btn.thumb-down-btn.active {
    background: #e5e7eb; /* Rămâne sur când e activ */
    color: #ef4444;
    opacity: 1;
}

/* Reset existing message-copy-btn specific styles when inside actions */
.message-actions .message-copy-btn {
    position: static;
    display: inline-flex;
    bottom: auto;
    left: auto;
    right: auto;
    top: auto;
}

/* Feedback Modal Styles */
.modal {
    display: none; /* Ascuns implicit */
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6); /* Overlay întunecat */
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.feedback-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 500px;
    width: 90%;
    padding: 24px;
    border-radius: 16px;
    background: #ffffff; /* Fixed background */
    color: #333333; /* Fixed text color */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    margin: 0;
    animation: feedbackModalFadeIn 0.3s ease;
}

@keyframes feedbackModalFadeIn {
    from { opacity: 0; transform: translate(-50%, -60%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 24px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #333;
}

.feedback-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0;
}

.feedback-tag {
    background: transparent;
    border: 1px solid var(--border-color);
    color: #333;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.feedback-tag:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: #666;
}

.feedback-tag.selected {
    background: var(--accent-color, #740343);
    color: white;
    border-color: var(--accent-color, #740343);
}

#feedback-details {
    width: 100%;
    height: 100px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: #333;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    resize: none;
    font-family: inherit;
    font-size: 0.95rem;
    box-sizing: border-box; /* Fix overflow */
}

#feedback-details:focus {
    outline: none;
    border-color: var(--accent-color, #740343);
}

.feedback-info {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 24px;
    background: rgba(0, 0, 0, 0.03);
    padding: 12px;
    border-radius: 6px;
}

.feedback-actions {
    display: flex;
    justify-content: flex-end;
}

#submit-feedback {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    transition: background-color 0.2s, opacity 0.2s;
    background-color: #111827; /* Match btn-dark */
    color: white; /* Button text color */
    border: none;
    cursor: pointer;
    font-size: 14px;
}

#submit-feedback:hover {
    background-color: #1f2937; /* Match btn-dark:hover */
}

#submit-feedback:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.site-feedback-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 560px;
    width: min(92vw, 560px);
    padding: 28px 24px 24px;
    border-radius: 18px;
    background: #ffffff;
    color: #111827;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.24);
    margin: 0;
    animation: feedbackModalFadeIn 0.3s ease;
}

.site-feedback-modal-content h3 {
    margin: 0 36px 10px 0;
    font-size: 1.35rem;
}

.site-feedback-copy {
    margin: 0 0 16px;
    color: #4b5563;
    line-height: 1.5;
}

#site-feedback-message {
    width: 100%;
    min-height: 160px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 14px 16px;
    resize: vertical;
    font: inherit;
    color: #111827;
    background: #f9fafb;
    box-sizing: border-box;
}

#site-feedback-message:focus {
    outline: none;
    border-color: var(--accent-color, #740343);
    box-shadow: 0 0 0 3px rgba(116, 3, 67, 0.12);
    background: #ffffff;
}

.site-feedback-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

/* ========================================================================
   ========================= MOBILE FILESYSTEM OPTIMIZATION ==============
   ======================================================================== */
@media (max-width: 768px) {
    #site-feedback-modal {
        align-items: flex-end;
        justify-content: center;
        padding: 16px 0 0;
        overflow: hidden;
    }

    /* Full screen modal on mobile for better space usage */
    #filesystem-modal {
        padding: 0 !important;
        align-items: flex-end !important;
        z-index: 2147483647 !important; /* Ensure it's above EVERYTHING */
        inset: 0 !important;
        position: fixed !important;
        height: 100% !important;
        width: 100% !important;
        background: #fff !important; /* Force white background for full screen */
    }

    .filesystem-modal-content {
        width: 100% !important;
        height: 100% !important;
        max-height: none !important;
        border-radius: 0 !important;
        padding: 0 !important; /* Reset padding, we'll use inner containers */
        display: flex;
        flex-direction: column;
        position: relative;
        box-shadow: none !important;
        border: none !important;
        background: #fff !important;
    }

    /* Header adjustments */
    .filesystem-modal-content h3 {
        margin: 0;
        padding: 16px 16px 12px 16px;
        font-size: 1.25rem;
        font-weight: 700;
        border-bottom: 1px solid #f1f5f9;
        background: #fff;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    .filesystem-subtitle {
        display: none; /* Save space */
    }

    .filesystem-footer-note {
        display: none;
    }

    /* Toolbar: Search and Breadcrumb */
    .filesystem-toolbar {
        flex-direction: column;
        gap: 8px;
        margin: 0;
        padding: 12px 16px 0 16px;
        flex-shrink: 0;
    }
    
    .filesystem-breadcrumb {
        font-size: 0.85rem;
        color: #64748b;
        margin-bottom: 4px;
    }

    #filesystem-search-input {
        width: 100%;
        padding: 10px 12px;
        font-size: 14px;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        box-sizing: border-box; /* Crucial for width: 100% with padding */
        min-width: 0; /* Allow shrinking in flex/grid */
    }

    /* Actions: Compact Grid */
    .filesystem-actions {
        display: grid;
        grid-template-columns: 1fr 1fr; /* 2 columns */
        gap: 8px;
        margin: 0;
        padding: 12px 16px;
        flex-shrink: 0;
    }

    /* Button styles for mobile */
    .filesystem-actions .modal-secondary-btn,
    .filesystem-actions .modal-danger-btn {
        padding: 10px;
        font-size: 13px;
        min-width: 0; /* Allow shrinking */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        border-radius: 8px;
    }

    #filesystem-new-folder-button { grid-column: 1; }
    #filesystem-upload-files-button { grid-column: 2; }
    #filesystem-upload-folder-button { grid-column: 1; }
    #filesystem-delete-selected-button { grid-column: 2; }

    /* Fixed Footer for Attach Button */
    #filesystem-attach-selected-button {
        position: absolute; /* Positioned relative to modal content */
        bottom: 20px;
        left: 16px;
        right: 16px;
        width: calc(100% - 32px);
        z-index: 100;
        padding: 14px;
        font-size: 1rem;
        font-weight: 600;
        box-shadow: 0 4px 16px rgba(0,0,0,0.1);
        margin: 0;
        border-radius: 12px;
        /* Safe area support */
        margin-bottom: env(safe-area-inset-bottom, 0px);
    }

    /* Table to List/Card transformation */
    .filesystem-table-wrap {
        flex: 1; /* Take remaining space */
        min-height: 0; /* Allow shrinking */
        border: none; /* Cleaner look */
        border-top: 1px solid #f1f5f9;
        border-radius: 0;
        margin: 0;
        overflow-y: auto;
        padding: 4px 16px 100px 16px; /* Bottom padding for attach button */
        -webkit-overflow-scrolling: touch;
    }

    .filesystem-table thead {
        display: none; /* Hide headers */
    }

    .filesystem-table, .filesystem-table tbody, .filesystem-table tr {
        display: block;
        width: 100%;
    }

    .filesystem-table tr {
        display: grid;
        grid-template-columns: 36px minmax(0, 1fr) 40px;
        grid-template-rows: auto auto;
        column-gap: 10px;
        row-gap: 4px;
        padding: 14px 0;
        border-bottom: 1px solid #f1f5f9;
        align-items: start;
    }

    .filesystem-table td {
        display: block;
        padding: 0;
        border: none;
    }

    /* Checkbox cell - Row 1 & 2, Column 1 */
    .filesystem-table td:first-child {
        grid-column: 1;
        grid-row: 1 / span 2;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
    }
    
    .filesystem-row-check {
        transform: scale(1.3);
        margin: 0;
    }

    /* Name cell - Row 1, Column 2 */
    .filesystem-table td:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
        width: 100%;
        overflow: hidden;
        min-width: 0;
    }
    
    .filesystem-name-cell {
        font-weight: 500;
        font-size: 1rem;
        color: var(--dark-color);
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
    }

    .filesystem-open-item {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
        width: 100%;
        text-align: left;
        line-height: 1.4;
        padding: 2px 0;
    }
    
    .filesystem-name-cell i {
        color: #64748b; /* Muted icon color */
        font-size: 1.2em;
    }

    /* Type - hide */
    .filesystem-table td:nth-child(3) {
        display: none;
    }

    /* Size - Row 2, Column 2 (Inline) */
    .filesystem-table td:nth-child(4) {
        grid-column: 2;
        grid-row: 2;
        font-size: 12px;
        color: #94a3b8;
        display: inline-block;
        width: auto;
    }
    
    /* Date - Row 2, Column 2 (Inline after size) */
    .filesystem-table td:nth-child(5) {
        grid-column: 2;
        grid-row: 2;
        font-size: 12px;
        color: #94a3b8;
        display: inline-block;
        width: auto;
        margin-left: 80px;
        position: relative;
        padding-left: 12px;
    }
    
    /* Move date to be next to size visually */
    .filesystem-table td:nth-child(5)::before {
        content: "•";
        position: absolute;
        left: 0;
        color: #cbd5e1;
        top: 0;
    }

    .filesystem-table td:nth-child(6) {
        grid-column: 3;
        grid-row: 1 / span 2;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .filesystem-row-actions-cell {
        width: 40px;
        justify-self: center;
        align-self: center;
    }

    .filesystem-actions-trigger {
        width: 36px;
        height: 36px;
    }

    .filesystem-row-menu {
        right: 0;
        min-width: 190px;
    }
    
    /* Adjust empty state */
    #filesystem-empty-state {
        margin-top: 60px;
    }
    
    /* Close button styling */
    .generic-modal-close {
        top: 14px;
        right: 14px;
        z-index: 20;
        background: #f1f5f9;
        border-radius: 50%;
        width: 36px;
        height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        color: #475569;
        border: none;
    }

    .site-feedback-modal-content {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        width: 100%;
        max-width: none;
        max-height: min(84dvh, 720px);
        margin: 0;
        padding: 22px 16px calc(16px + env(safe-area-inset-bottom, 0px));
        border-radius: 22px 22px 0 0;
        box-shadow: 0 -16px 36px rgba(15, 23, 42, 0.18);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        animation: none;
    }

    .site-feedback-modal-content h3 {
        margin: 0 44px 8px 0;
        font-size: 1.2rem;
        line-height: 1.3;
    }

    .site-feedback-copy {
        margin-bottom: 14px;
        font-size: 0.95rem;
        line-height: 1.45;
    }

    #site-feedback-message {
        min-height: 160px;
        max-height: min(42dvh, 320px);
        font-size: 16px;
        line-height: 1.45;
        resize: none;
        overflow-y: auto;
    }

    .site-feedback-actions {
        margin-top: 14px;
        padding-top: 12px;
    }

    .site-feedback-actions .modal-primary-btn {
        width: 100%;
        min-height: 48px;
    }
}

/* Hide original copy button if it still exists outside actions (backward compatibility) */
article.ai-message > .message-copy-btn:not(.message-actions .message-copy-btn) {
    display: none !important;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
