html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: linear-gradient(90deg, rgba(0, 25, 76, 0.95) 0%, rgba(1, 11, 38, 0.96) 38%, rgba(0, 25, 76, 0.95) 100%);
    color: #f5f7fb;
}

/* Top bar */

.app-topbar {
    height: 86px;
    background: #f3f3f3;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-topbar-inner {
    width: 100%;
    max-width: 1560px;
    padding: 0 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    box-sizing: border-box;
}

.app-brand-wrap {
    display: flex;
    align-items: center;
    min-width: 170px;
}

.app-brand {
    text-decoration: none;
    color: #1a1a1a;
    font-size: 2.05rem;
    font-weight: 300;
    letter-spacing: -0.03em;
    line-height: 1;
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 34px;
    flex: 1;
    justify-content: flex-start;
}

.app-nav-link {
    text-decoration: none;
    color: #545454;
    font-size: 1rem;
    font-weight: 400;
    transition: color 0.18s ease;
    white-space: nowrap;
}

    .app-nav-link:hover {
        color: #111111;
    }

.app-user-area {
    min-width: 180px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.app-user-text {
    color: #3f3f3f;
    font-size: 0.98rem;
    font-weight: 500;
    white-space: nowrap;
}

/* Main layout */

.app-main {
    min-height: calc(100vh - 86px);
}

.neosentia-shell {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 42px 24px 54px;
    box-sizing: border-box;
}

.hero-panel,
.viewer-panel {
    width: 100%;
    max-width: 1380px;
    padding: 56px 56px 54px;
    border-radius: 30px;
    background: linear-gradient(135deg, rgba(18, 39, 74, 0.94) 0%, rgba(18, 25, 47, 0.96) 100%);
    border: 1px solid rgba(120, 150, 220, 0.16);
    box-shadow: 0 30px 80px rgba(0,0,0,0.42);
    box-sizing: border-box;
}

.hero-panel-browser {
    text-align: center;
    max-width: 980px;
    margin-top: 18px;
}

.brand-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    margin-bottom: 22px;
    border-radius: 999px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.10);
    color: #dbe7ff;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.hero-panel h1 {
    margin: 0 0 12px;
    font-size: 4rem;
    line-height: 1.02;
    letter-spacing: -0.05em;
    font-weight: 800;
    color: #f5f7fb;
}

.hero-subtitle-browser {
    margin: 0 auto 12px;
    max-width: 700px;
    font-size: 1.35rem;
    line-height: 1.45;
    color: #b7c5dd;
    font-weight: 500;
}

.hero-supporting-copy {
    max-width: 780px;
    margin: 0 auto 34px;
    font-size: 1.12rem;
    line-height: 1.75;
    color: rgba(255,255,255,0.74);
}

/* Search area */

.search-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.search-input {
    width: min(100%, 680px);
    padding: 18px 20px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.12);
    color: #ffffff;
    font-size: 1.03rem;
    outline: none;
    box-sizing: border-box;
}

    .search-input::placeholder {
        color: rgba(255,255,255,0.44);
    }

    .search-input:focus {
        border-color: rgba(111, 154, 255, 0.72);
        box-shadow: 0 0 0 4px rgba(111, 154, 255, 0.12);
    }

.search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    padding: 18px 28px;
    border: none;
    border-radius: 18px;
    background: linear-gradient(135deg, #6f98ff 0%, #5f8ff8 100%);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(74, 117, 255, 0.28);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    text-decoration: none;
}

    .search-button:hover {
        transform: translateY(-1px);
        box-shadow: 0 16px 36px rgba(74, 117, 255, 0.34);
    }

    .search-button.searching,
    .search-button:disabled {
        opacity: 0.82;
        cursor: wait;
        transform: none;
        box-shadow: 0 8px 18px rgba(67,116,255,0.22);
    }

/* Search tips */

.search-tips-panel {
    margin-top: 22px;
    margin-bottom: 22px;
    padding: 22px 20px;
    border-radius: 22px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    text-align: left;
}

    .search-tips-panel.compact {
        margin-top: 18px;
        margin-bottom: 22px;
    }

.search-tips-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 10px;
}

.search-tips-text {
    color: rgba(255,255,255,0.74);
    line-height: 1.7;
}

.tip-chip,
.search-query-chip {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    margin-top: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.10);
    color: #dbe7ff;
    font-size: 0.84rem;
}

/* Hero footer */

.hero-footer {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 10px;
}

    .hero-footer span {
        padding: 9px 14px;
        border-radius: 999px;
        background: rgba(255,255,255,0.05);
        border: 1px solid rgba(255,255,255,0.08);
        color: rgba(255,255,255,0.68);
        font-size: 0.9rem;
    }

/* Results toolbar */

.results-toolbar {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    align-items: end;
    justify-content: flex-start;
    margin-bottom: 24px;
    text-align: left;
}

.toolbar-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}

    .toolbar-group label {
        font-size: 0.88rem;
        color: rgba(255,255,255,0.72);
    }

.toolbar-select {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.08);
    color: #ffffff;
    outline: none;
}

    .toolbar-select option {
        color: #000;
    }

/* Results cards */

.results-list {
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.result-card {
    text-align: left;
    padding: 22px;
    border-radius: 20px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
}

.result-topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.result-title {
    font-size: 1.6rem;
    font-weight: 750;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
    color: #ffffff;
}

.result-summary {
    color: rgba(255,255,255,0.74);
    font-size: 1rem;
    line-height: 1.72;
}

.result-meta-inline {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.82rem;
    color: rgba(255,255,255,0.56);
}

.why-result {
    margin-top: 12px;
    margin-bottom: 14px;
    color: rgba(255,255,255,0.72);
    font-size: 0.92rem;
    line-height: 1.6;
}

/* File type badges */

.filetype-badge {
    display: inline-block;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border: 1px solid rgba(255,255,255,0.12);
}

.filetype-pdf {
    background: rgba(255, 102, 102, 0.14);
    color: #ffd9d9;
}

.filetype-docx,
.filetype-doc {
    background: rgba(106, 168, 255, 0.14);
    color: #dceaff;
}

.filetype-txt,
.filetype-md,
.filetype-json,
.filetype-csv,
.filetype-xml,
.filetype-html {
    background: rgba(126, 231, 135, 0.14);
    color: #deffe1;
}

.filetype-file {
    background: rgba(255,255,255,0.08);
    color: #f3f5fb;
}

/* Viewer */

.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.viewer-title {
    margin: 10px 0 8px;
    font-size: 2.2rem;
    line-height: 1.08;
    letter-spacing: -0.03em;
    color: #ffffff;
}

.viewer-meta {
    color: rgba(255,255,255,0.70);
    font-size: 0.95rem;
}

.viewer-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.match-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin: 0 0 18px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
}

.match-status {
    color: #f6f8ff;
    font-size: 0.98rem;
    font-weight: 700;
}

.match-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.match-nav-button {
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
}

    .match-nav-button:disabled {
        opacity: 0.48;
        cursor: not-allowed;
    }

.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 18px 28px;
    border-radius: 16px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
}

.text-viewer {
    border-radius: 18px;
    background: rgba(0,0,0,0.22);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 22px;
    overflow-x: auto;
    line-height: 1.75;
    color: #eef3ff;
    white-space: normal;
    word-break: break-word;
}

    .text-viewer mark {
        background: rgba(255, 221, 87, 0.34);
        color: #fff8d8;
        padding: 0 2px;
        border-radius: 4px;
    }

.search-match.current-search-match {
    background: rgba(255, 126, 87, 0.72);
    color: #ffffff;
    outline: 2px solid rgba(255,255,255,0.70);
    outline-offset: 2px;
}

.pdf-viewer-wrapper {
    width: 100%;
    height: 78vh;
    border-radius: 18px;
    overflow: auto;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.28);
    padding: 18px;
}

.pdf-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    color: rgba(255,255,255,0.78);
    font-weight: 700;
}

.pdf-page {
    position: relative;
    margin: 0 auto 18px;
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(0,0,0,0.26);
}

.pdf-page-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.pdf-text-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
    line-height: 1;
}

.pdf-text-item {
    position: absolute;
    white-space: pre;
    color: transparent;
    transform-origin: 0 0;
}

.pdf-search-match {
    background: rgba(255, 221, 87, 0.48);
    color: transparent;
    border-radius: 3px;
}

.unsupported-panel {
    padding: 24px;
    border-radius: 18px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
}

/* Related docs */

.related-section {
    margin-top: 30px;
}

.related-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: rgba(255,255,255,0.90);
    margin-bottom: 16px;
}

.related-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.related-card {
    padding: 18px;
    border-radius: 18px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
}

.related-doc-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: #ffffff;
}

.related-doc-snippet {
    font-size: 0.92rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.72);
    margin-bottom: 14px;
}

/* Responsive */

@media (max-width: 1200px) {
    .app-nav {
        gap: 20px;
    }

    .app-brand {
        font-size: 1.8rem;
    }
}

@media (max-width: 980px) {
    .app-topbar {
        height: auto;
        padding: 14px 0;
    }

    .app-topbar-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .app-nav {
        flex-wrap: wrap;
        gap: 14px 18px;
    }

    .app-user-area {
        justify-content: flex-start;
        min-width: auto;
    }

    .hero-panel,
    .viewer-panel {
        padding: 34px 22px;
    }

        .hero-panel h1 {
            font-size: 2.8rem;
        }

    .hero-subtitle-browser {
        font-size: 1.12rem;
    }

    .hero-supporting-copy {
        font-size: 1rem;
    }

    .results-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-group {
        min-width: 100%;
    }

    .search-input,
    .search-button {
        width: 100%;
    }

    .pdf-viewer-wrapper {
        height: 68vh;
    }
}
.open-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 14px;
    padding: 14px 22px;
    border-radius: 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.14);
    color: #ffffff !important;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.18s ease;
}

    .open-button:hover {
        background: rgba(255,255,255,0.16);
        border-color: rgba(255,255,255,0.28);
        color: #ffffff !important;
        text-decoration: none !important;
    }
/* Browser identity line */

.browser-identity-line {
    margin: 0 auto 24px;
    max-width: 760px;
    text-align: center;
    font-size: 0.98rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.62);
    letter-spacing: 0.01em;
}

.browser-identity-line-results {
    margin-bottom: 22px;
}

/* Thinking state */

.thinking-state {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 14px 0 24px;
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.82);
    font-size: 0.95rem;
    font-weight: 500;
}

    .thinking-state.visible {
        display: inline-flex;
    }

.thinking-state-results {
    justify-content: flex-start;
    margin-top: 2px;
    margin-bottom: 24px;
}

.thinking-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #6f98ff;
    box-shadow: 0 0 0 rgba(111, 152, 255, 0.7);
    animation: thinkingPulse 1.4s infinite;
}

@keyframes thinkingPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(111, 152, 255, 0.55);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(111, 152, 255, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(111, 152, 255, 0);
    }
}
.result-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.summary-button {
    background: rgba(255,255,255,0.06);
}

.summary-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 10, 20, 0.68);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 9999;
}

    .summary-modal-overlay.visible {
        display: flex;
    }

.summary-modal {
    width: 100%;
    max-width: 860px;
    max-height: 82vh;
    overflow-y: auto;
    padding: 30px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(18, 39, 74, 0.98) 0%, rgba(18, 25, 47, 0.99) 100%);
    border: 1px solid rgba(120, 150, 220, 0.16);
    box-shadow: 0 30px 80px rgba(0,0,0,0.42);
    box-sizing: border-box;
}

.summary-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 22px;
}

    .summary-modal-header h2 {
        margin: 10px 0 0;
        font-size: 1.9rem;
        line-height: 1.1;
        color: #ffffff;
        letter-spacing: -0.03em;
    }

.summary-close-button {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.06);
    color: #ffffff;
    font-size: 1.4rem;
    cursor: pointer;
}

.summary-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.82);
    font-size: 1rem;
    margin-bottom: 16px;
}

.summary-error {
    color: #ffd0d0;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 12px;
}

.summary-content {
    color: rgba(255,255,255,0.84);
    font-size: 1.03rem;
    line-height: 1.85;
    white-space: pre-wrap;
}

.login-panel {
    max-width: 760px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 460px;
    margin: 28px auto 0;
}

.login-input {
    width: 100%;
}

.login-button {
    width: 100%;
}

.login-error {
    max-width: 460px;
    margin: 20px auto 0;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 102, 102, 0.12);
    border: 1px solid rgba(255, 102, 102, 0.24);
    color: #ffd6d6;
    font-size: 0.98rem;
    text-align: left;
}

/* Login page final override */

.login-panel {
    max-width: 980px;
    text-align: center;
}

.login-form {
    width: 100%;
    max-width: 520px;
    margin: 34px auto 0 auto;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: center !important;
    gap: 16px !important;
    box-sizing: border-box;
}

.login-field {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    height: 64px;
    padding: 0 24px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.12);
    color: #ffffff;
    font-size: 1.05rem;
    outline: none;
    box-sizing: border-box;
}

    .login-field::placeholder {
        color: rgba(255,255,255,0.46);
    }

    .login-field:focus {
        border-color: rgba(111, 154, 255, 0.72);
        box-shadow: 0 0 0 4px rgba(111, 154, 255, 0.12);
    }

.login-submit-button {
    display: flex;
    width: 100% !important;
    height: 64px;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 18px;
    background: linear-gradient(135deg, #6f98ff 0%, #5f8ff8 100%);
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(74, 117, 255, 0.28);
    box-sizing: border-box;
}

    .login-submit-button:hover {
        transform: translateY(-1px);
        box-shadow: 0 16px 36px rgba(74, 117, 255, 0.34);
    }

.login-error {
    width: 100%;
    max-width: 520px;
    margin: 22px auto 0 auto;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 102, 102, 0.12);
    border: 1px solid rgba(255, 102, 102, 0.24);
    color: #ffd6d6;
    font-size: 0.98rem;
    text-align: left;
    box-sizing: border-box;
}

@media (max-width: 700px) {
    .login-panel {
        padding-left: 22px;
        padding-right: 22px;
    }

    .login-form {
        max-width: 100%;
    }
}
