
:root {
    --page: #f7f9fc;
    --surface: #ffffff;
    --surface-soft: #f3f6fb;
    --surface-blue: #eef3ff;
    --surface-violet: #f2efff;
    --ink: #111827;
    --navy: #101a3b;
    --muted: #667085;
    --line: #e4e9f2;
    --line-strong: #d5dce9;
    --blue: #2146c7;
    --blue-2: #3158d7;
    --violet: #4b3fc2;
    --green: #067647;
    --green-bg: #ecfdf3;
    --amber: #a15c07;
    --amber-bg: #fff8e8;
    --danger: #b42318;
    --danger-bg: #fff1f0;
    --shadow-sm: 0 8px 24px rgba(16, 24, 40, .055);
    --shadow-md: 0 18px 52px rgba(16, 24, 40, .08);
    --focus: 0 0 0 4px rgba(33, 70, 199, .12);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--ink);
    background:
        radial-gradient(circle at 2% 0%, rgba(33, 70, 199, .08), transparent 27rem),
        radial-gradient(circle at 98% 5%, rgba(75, 63, 194, .07), transparent 30rem),
        linear-gradient(180deg, #fbfcfe 0%, var(--page) 46%, #eef2f8 100%);
    font-family:
        Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", Arial, sans-serif;
    line-height: 1.5;
}

body.modal-open {
    overflow: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a,
select {
    -webkit-tap-highlight-color: transparent;
}

button {
    border: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

img,
svg {
    display: block;
}

[hidden] {
    display: none !important;
}

.icon {
    width: 1.08rem;
    height: 1.08rem;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid rgba(213, 220, 233, .82);
    background: rgba(250, 252, 255, .91);
    box-shadow: 0 6px 22px rgba(16, 24, 40, .035);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.header-inner {
    width: min(1180px, calc(100% - 32px));
    min-height: 68px;
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.brand-logo img {
    width: auto;
    height: 40px;
    max-width: min(190px, 48vw);
    object-fit: contain;
}

.desktop-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link,
.nav-current,
.mobile-menu-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 999px;
    padding: 0 15px;
    font-size: .875rem;
    font-weight: 800;
    transition:
        color .18s ease,
        border-color .18s ease,
        background .18s ease,
        transform .18s ease,
        box-shadow .18s ease;
}

.nav-link {
    color: #536078;
    border: 1px solid transparent;
}

.nav-link:hover {
    color: var(--blue);
    border-color: #dce5fb;
    background: var(--surface-blue);
}

.nav-current {
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .18);
    background: linear-gradient(135deg, var(--blue), var(--blue-2) 52%, var(--violet));
    box-shadow: 0 10px 24px rgba(33, 70, 199, .18);
}

.mobile-menu-button {
    display: none;
    width: 42px;
    padding: 0;
    cursor: pointer;
    color: var(--blue);
    border: 1px solid #dbe3f2;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.mobile-nav {
    display: none;
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto 12px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, .98);
    box-shadow: var(--shadow-md);
}

.mobile-nav.is-open {
    display: block;
}

.mobile-nav-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.mobile-nav a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 9px 10px;
    color: #44506a;
    background: var(--surface-soft);
    font-size: .82rem;
    font-weight: 800;
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin-inline: auto;
    padding: 34px 0 54px;
}

.hero {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 30px;
    padding: clamp(24px, 4vw, 38px);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .98), rgba(244, 247, 255, .96));
    box-shadow: var(--shadow-md);
}

.hero::after {
    content: "";
    position: absolute;
    width: 320px;
    height: 320px;
    top: -190px;
    right: -80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(49, 88, 215, .13), transparent 68%);
    pointer-events: none;
}

.hero-row {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.hero-copy-wrap {
    min-width: 0;
}

.eyebrow {
    margin: 0;
    color: var(--blue);
    font-size: .75rem;
    font-weight: 900;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.eyebrow-danger {
    color: var(--danger);
}

.hero h1 {
    max-width: 790px;
    margin: 9px 0 0;
    color: var(--navy);
    font-size: clamp(1.9rem, 4.5vw, 3.15rem);
    line-height: 1.08;
    letter-spacing: -.035em;
    overflow-wrap: anywhere;
}

.hero-copy {
    max-width: 680px;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: clamp(.95rem, 2vw, 1.05rem);
    line-height: 1.75;
}

.count-pill,
.mode-pill,
.favorite-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid #dce5fb;
    border-radius: 999px;
    color: var(--blue);
    background: var(--surface-blue);
    font-weight: 900;
}

.count-pill {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 13px;
    font-size: .78rem;
}

.toolbar {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 24px;
}

.search-form {
    width: min(100%, 600px);
    display: flex;
    gap: 9px;
}

.search-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.search-icon {
    position: absolute;
    top: 50%;
    inset-inline-start: 14px;
    transform: translateY(-50%);
    color: #77849b;
    pointer-events: none;
}

.control {
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line-strong);
    border-radius: 13px;
    outline: none;
    padding: 12px 14px;
    color: var(--ink);
    background: #fff;
    box-shadow: inset 0 1px 2px rgba(16, 24, 40, .025);
    transition:
        border-color .18s ease,
        box-shadow .18s ease,
        background .18s ease;
}

.search-wrap .control {
    padding-inline-start: 42px;
}

.control:hover {
    border-color: #b9c4d6;
}

.control:focus {
    border-color: var(--blue);
    box-shadow: var(--focus);
}

textarea.control {
    min-height: 116px;
    resize: vertical;
    line-height: 1.65;
}

select.control {
    cursor: pointer;
}

.button,
.filter-link,
.icon-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 12px;
    cursor: pointer;
    padding: 0 15px;
    font-size: .82rem;
    font-weight: 900;
    transition:
        transform .18s ease,
        filter .18s ease,
        border-color .18s ease,
        color .18s ease,
        background .18s ease,
        box-shadow .18s ease;
}

.button:hover:not(:disabled),
.filter-link:hover,
.icon-button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button-primary {
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .18);
    background: linear-gradient(135deg, var(--blue), var(--blue-2) 52%, var(--violet));
    box-shadow: 0 12px 28px rgba(33, 70, 199, .19);
}

.button-primary:hover:not(:disabled) {
    filter: brightness(1.04);
    box-shadow: 0 16px 34px rgba(33, 70, 199, .24);
}

.button-soft,
.filter-link,
.icon-button {
    color: #4a5872;
    border: 1px solid var(--line);
    background: var(--surface-soft);
}

.button-soft:hover:not(:disabled),
.filter-link:hover,
.icon-button:hover:not(:disabled) {
    color: var(--blue);
    border-color: #c7d4f4;
    background: #f7f9ff;
}

.button-danger {
    color: var(--danger);
    border: 1px solid #fecaca;
    background: var(--danger-bg);
}

.button-danger:hover:not(:disabled) {
    background: #ffe4e1;
}

.button-success {
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .16);
    background: linear-gradient(135deg, #05875a, #067647);
    box-shadow: 0 10px 24px rgba(6, 118, 71, .16);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-link.active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, var(--blue), var(--blue-2) 52%, var(--violet));
    box-shadow: 0 10px 24px rgba(33, 70, 199, .18);
}

.notice {
    margin-top: 18px;
    border: 1px solid;
    border-radius: 14px;
    padding: 13px 14px;
    font-size: .86rem;
    line-height: 1.6;
}

.notice-success {
    color: var(--green);
    border-color: #a8e7c5;
    background: var(--green-bg);
}

.notice-error {
    color: var(--danger);
    border-color: #fecaca;
    background: var(--danger-bg);
}

.documents-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 22px;
}

.document-card {
    min-width: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 19px;
    background: rgba(255, 255, 255, .97);
    box-shadow: var(--shadow-sm);
    transition:
        transform .18s ease,
        border-color .18s ease,
        box-shadow .18s ease,
        background .18s ease;
}

.document-card:hover {
    transform: translateY(-2px);
    border-color: #cbd8f4;
    background: #fff;
    box-shadow: var(--shadow-md);
}

.document-top,
.document-stats,
.document-actions,
.section-head,
.card-head,
.quality-head,
.version-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mode-pill {
    max-width: 65%;
    padding: 5px 10px;
    font-size: .7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.deleted-pill {
    color: var(--danger);
    border-color: #fecaca;
    background: var(--danger-bg);
}

.favorite-button {
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
    color: #c97907;
    font-size: 1.25rem;
}

.document-title {
    min-height: 3rem;
    margin: 15px 0 0;
    color: var(--navy);
    font-size: 1.02rem;
    line-height: 1.45;
    font-weight: 900;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow-wrap: anywhere;
}

.document-excerpt {
    min-height: 4.15rem;
    margin: 9px 0 0;
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.65;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow-wrap: anywhere;
}

.document-stats {
    align-items: flex-start;
    margin-top: auto;
    padding-top: 16px;
    color: var(--muted);
    font-size: .72rem;
}

.document-stats span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.document-stats span:last-child {
    text-align: end;
}

.document-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 14px;
}

.document-actions .primary-action {
    grid-column: 1 / -1;
}

.document-actions form,
.document-actions .button {
    width: 100%;
}

.empty-state {
    margin-top: 22px;
    border: 1px dashed #cad4e4;
    border-radius: 24px;
    padding: clamp(30px, 6vw, 48px);
    color: var(--muted);
    background: rgba(255, 255, 255, .92);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.empty-icon {
    width: 58px;
    height: 58px;
    margin-inline: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    color: var(--blue);
    background: var(--surface-blue);
}

.empty-state h2 {
    margin: 16px 0 0;
    color: var(--navy);
    font-size: 1.2rem;
}

.empty-state p {
    max-width: 520px;
    margin: 7px auto 0;
}

.empty-state .button {
    margin-top: 18px;
}

.pagination-wrap {
    margin-top: 26px;
}

.pagination-wrap nav {
    display: grid;
    gap: 10px;
}

.pagination-wrap nav > div:first-child {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.pagination-wrap nav > div:last-child {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pagination-wrap a,
.pagination-wrap span {
    border-radius: 10px !important;
}

.pagination-wrap a {
    color: var(--blue) !important;
    border-color: var(--line) !important;
    background: #fff !important;
}

.pagination-wrap a:hover {
    background: var(--surface-blue) !important;
}

.pagination-wrap [aria-current="page"] > span {
    color: #fff !important;
    border-color: var(--blue) !important;
    background: var(--blue) !important;
}

.card {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(255, 255, 255, .97);
    box-shadow: var(--shadow-sm);
}

.card-inner {
    padding: clamp(20px, 3.5vw, 28px);
}

.back-link {
    margin-bottom: 14px;
}

.document-hero-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.document-hero-title h1 {
    margin: 0;
    color: var(--navy);
    font-size: clamp(1.7rem, 4vw, 2.65rem);
    line-height: 1.12;
    overflow-wrap: anywhere;
}

/* The title reads in its own direction (dir="auto") but keeps the page's alignment. */
html[dir="rtl"] .document-hero-title h1 {
    text-align: right;
}

.rename-panel {
    width: min(100%, 650px);
    display: flex;
    gap: 9px;
    margin-top: 14px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.compare-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 22px;
}

.text-card {
    min-width: 0;
    overflow: hidden;
}

.text-card-head {
    min-height: 63px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding: 14px 18px;
}

.text-card-head strong {
    color: var(--navy);
    font-size: .78rem;
    letter-spacing: .11em;
    text-transform: uppercase;
}

.text-card-head strong.result-label {
    color: var(--blue);
}

.document-text {
    min-height: 24rem;
    max-height: 42rem;
    overflow: auto;
    padding: 22px;
    color: #273248;
    background: #fff;
    font-size: .93rem;
    line-height: 1.9;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    scrollbar-width: thin;
}

.document-text.compare-original {
    background: #fff9ed;
    box-shadow: inset 0 0 0 1px rgba(245, 158, 11, .18);
}

.document-text.compare-result {
    background: #f2f7ff;
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, .18);
}

.result-card {
    position: relative;
}

.loader {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 20px;
    color: var(--blue);
    background: rgba(247, 249, 252, .88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-weight: 900;
    text-align: center;
}

.loader-box {
    display: grid;
    justify-items: center;
    gap: 11px;
}

.loader-ring {
    width: 34px;
    height: 34px;
    border: 3px solid #dce5fb;
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin .85s linear infinite;
}

.section-card {
    margin-top: 18px;
}

.section-head {
    align-items: flex-start;
}

.section-head h2,
.card h2 {
    margin: 0;
    color: var(--navy);
    font-size: 1.22rem;
}

.section-copy {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: .84rem;
    line-height: 1.6;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.tool-button {
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    cursor: pointer;
    color: var(--hx-ink-2, #43516a);
    background: var(--surface-soft);
    font-size: .82rem;
    font-weight: 850;
    transition:
        color .18s ease,
        border-color .18s ease,
        background .18s ease,
        transform .18s ease;
}

.tool-button:hover:not(:disabled) {
    transform: translateY(-1px);
    color: var(--blue);
    border-color: #c7d4f4;
    background: #f8faff;
}

.tool-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.tool-panel {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    background: var(--surface-soft);
}

.tool-panel label {
    color: var(--navy);
    font-size: .84rem;
    font-weight: 900;
}

.inline-controls {
    display: flex;
    gap: 9px;
    margin-top: 11px;
}

.inline-controls .control {
    flex: 1 1 auto;
    min-width: 0;
}

.counter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
    color: var(--muted);
    font-size: .75rem;
}

.quality-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 22px;
    margin-top: 18px;
}

.quality-head {
    color: #344054;
    font-size: .82rem;
    font-weight: 850;
}

.quality-score {
    color: var(--blue);
}

.quality-track {
    width: 100%;
    height: 8px;
    margin-top: 8px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: #e8edf5;
    appearance: none;
    -webkit-appearance: none;
}

.quality-track::-webkit-progress-bar {
    border-radius: inherit;
    background: #e8edf5;
}

.quality-track::-webkit-progress-value {
    border-radius: inherit;
    background: linear-gradient(90deg, var(--blue), var(--blue-2), var(--violet));
    transition: width .35s ease;
}

.quality-track::-moz-progress-bar {
    border-radius: inherit;
    background: linear-gradient(90deg, var(--blue), var(--blue-2), var(--violet));
}

.copy-buffer {
    position: fixed;
    left: -9999px;
    top: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.feedback-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin-top: 20px;
}

.status-message {
    min-height: 1.25rem;
    color: var(--muted);
    font-size: .82rem;
}

.status-message[data-state="info"] {
    color: var(--blue);
}

.status-message[data-state="success"] {
    color: var(--green);
}

.status-message[data-state="error"] {
    color: var(--danger);
}

.versions-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 11px;
    margin-top: 16px;
}

.version-item {
    min-width: 0;
    display: grid;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface-soft);
}

.version-button {
    min-width: 0;
    border: 0;
    padding: 14px;
    cursor: pointer;
    color: #425069;
    background: transparent;
    text-align: left;
}

.version-button.active {
    color: var(--blue);
    background: var(--surface-blue);
}

.version-button strong,
.version-button span {
    display: block;
    overflow-wrap: anywhere;
}

.version-button span {
    margin-top: 4px;
    color: var(--muted);
    font-size: .77rem;
}

.version-button small {
    display: block;
    margin-top: 8px;
    color: var(--blue);
    font-weight: 850;
}

.version-restore {
    min-height: 36px;
    border-top: 1px solid var(--line);
    cursor: pointer;
    color: #536078;
    background: #fff;
    font-size: .73rem;
    font-weight: 850;
}

.version-restore:hover {
    color: var(--blue);
    background: #f8faff;
}

button:disabled {
    cursor: wait;
    opacity: .64;
    transform: none !important;
    filter: none;
}

form[aria-busy="true"] {
    opacity: .78;
}

.button:focus-visible,
.filter-link:focus-visible,
.icon-button:focus-visible,
.nav-link:focus-visible,
.nav-current:focus-visible,
.mobile-menu-button:focus-visible,
.tool-button:focus-visible,
.version-button:focus-visible,
.version-restore:focus-visible,
.control:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

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

@media (max-width: 980px) {
    .documents-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .search-form {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .desktop-nav {
        display: none;
    }

    .mobile-menu-button {
        display: inline-flex;
    }

    .compare-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .tool-grid,
    .versions-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tool-panels,
    .quality-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .header-inner,
    .mobile-nav,
    .page-shell {
        width: min(100% - 22px, 1180px);
    }

    .header-inner {
        min-height: 62px;
    }

    .brand-logo img {
        height: 36px;
        max-width: 55vw;
    }

    .page-shell {
        padding-top: 20px;
        padding-bottom: 34px;
    }

    .hero {
        border-radius: 22px;
    }

    .hero-row {
        align-items: stretch;
        flex-direction: column;
    }

    .count-pill {
        width: max-content;
    }

    .search-form,
    .inline-controls,
    .rename-panel {
        flex-direction: column;
    }

    .search-form .button,
    .inline-controls .button,
    .rename-panel .button {
        width: 100%;
    }

    .filters {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .filter-link {
        width: 100%;
        padding-inline: 8px;
    }

    .documents-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-top: 14px;
    }

    .document-card {
        border-radius: 20px;
        padding: 17px;
    }

    .document-card:hover {
        transform: none;
    }

    .card {
        border-radius: 20px;
    }

    .card-inner {
        padding: 18px 16px;
    }

    .document-actions {
        grid-template-columns: 1fr;
    }

    .document-actions .primary-action {
        grid-column: auto;
    }

    .document-stats,
    .section-head,
    .card-head,
    .usage-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .document-stats span:last-child {
        text-align: start;
    }

    .hero-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .hero-actions form,
    .hero-actions .button {
        width: 100%;
    }

    .document-text {
        min-height: 18rem;
        max-height: 34rem;
        padding: 17px;
    }

    .tool-grid,
    .versions-grid {
        grid-template-columns: 1fr;
    }

    .feedback-row .button {
        flex: 1 1 145px;
    }

    .mobile-nav-grid {
        grid-template-columns: 1fr;
    }

    .pagination-wrap nav > div:last-child {
        align-items: flex-start;
        flex-direction: column;
    }
}

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

    .document-top {
        align-items: flex-start;
    }

    .mode-pill {
        max-width: 58%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@supports not ((backdrop-filter: blur(2px))) {
    .site-header {
        background: #fbfcff;
    }

    .loader {
        background: rgba(247, 249, 252, .98);
    }
}

/* =========================================================
   HumanProse Documents — Prism Library
   Shared premium theme for Index / Show / Trash.
========================================================= */
:root {
    --pl-page: #f4f7fb;
    --pl-ink: #14213d;
    --pl-muted: #65748c;
    --pl-navy: #091733;
    --pl-navy-2: #12244c;
    --pl-blue: #3158e7;
    --pl-blue-2: #5878ff;
    --pl-violet: #7658d8;
    --pl-cyan: #22b9d0;
    --pl-rose: #d94f87;
    --pl-mint: #1aa579;
    --pl-amber: #b66b11;
    --pl-line: rgba(105, 128, 177, .18);
    --pl-line-strong: rgba(78, 103, 164, .26);
    --pl-shadow-sm: 0 12px 34px rgba(20, 33, 61, .065);
    --pl-shadow-md: 0 28px 76px rgba(20, 33, 61, .11);
    --pl-focus: 0 0 0 4px rgba(49, 88, 231, .12);
}

html,
body,
button,
input,
select,
textarea,
a {
    font-family:
        "Segoe UI Variable Text",
        "Segoe UI Variable",
        "Aptos",
        "Segoe UI",
        -apple-system,
        BlinkMacSystemFont,
        system-ui,
        Arial,
        sans-serif;
}

body {
    color: var(--pl-ink);
    background:
        radial-gradient(circle at 2% -2%, rgba(49, 88, 231, .105), transparent 29rem),
        radial-gradient(circle at 98% 4%, rgba(118, 88, 216, .08), transparent 31rem),
        linear-gradient(180deg, #fcfdff 0%, var(--pl-page) 50%, #edf1f7 100%);
    font-size: 16px;
    font-weight: 440;
    font-kerning: normal;
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    color: #fff;
    background: rgba(49, 88, 231, .58);
}

.site-header {
    border-bottom-color: rgba(105, 128, 177, .14);
    background: rgba(251, 252, 255, .92);
    box-shadow: 0 8px 26px rgba(20, 33, 61, .045);
    backdrop-filter: blur(14px) saturate(145%);
    -webkit-backdrop-filter: blur(14px) saturate(145%);
}

.header-inner {
    width: min(1220px, calc(100% - 32px));
    min-height: 72px;
}

.brand-logo img {
    height: 42px;
    max-width: min(205px, 48vw);
    filter: drop-shadow(0 8px 18px rgba(49, 88, 231, .08));
}

.nav-link,
.nav-current,
.mobile-menu-button,
.mobile-nav a,
.button,
.filter-link,
.tool-button,
.version-button,
.version-restore {
    font-family:
        "Segoe UI Variable Display",
        "Segoe UI Variable",
        "Aptos Display",
        "Segoe UI",
        system-ui,
        sans-serif;
}

.nav-link,
.mobile-nav a {
    font-weight: 710;
    letter-spacing: -.012em;
}

.nav-link {
    color: #52617b;
}

.nav-link:hover {
    color: var(--pl-blue);
    border-color: rgba(49, 88, 231, .13);
    background: #eef3ff;
    transform: translateY(-1px);
}

.nav-current {
    color: #fff;
    background:
        linear-gradient(135deg, #2e54df 0%, #5575f7 54%, #7257d4 100%);
    box-shadow:
        0 12px 28px rgba(49, 88, 231, .20),
        inset 0 1px 0 rgba(255, 255, 255, .15);
}

.mobile-menu-button {
    color: var(--pl-blue);
    border-color: var(--pl-line);
    background: rgba(255, 255, 255, .98);
}

.mobile-nav {
    border-color: var(--pl-line);
    background: rgba(255, 255, 255, .99);
    box-shadow: var(--pl-shadow-md);
}

.mobile-nav a {
    color: #44526d;
    border-color: rgba(105, 128, 177, .14);
    background: #f5f7fb;
}

.mobile-nav a[aria-current="page"] {
    color: #fff;
    border-color: transparent;
    background:
        linear-gradient(135deg, var(--pl-blue), var(--pl-blue-2), var(--pl-violet));
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    padding-top: 30px;
    padding-bottom: 60px;
}

/* Dark premium hero across the documents area. */
.hero {
    isolation: isolate;
    border-color: rgba(145, 170, 233, .17);
    border-radius: 32px;
    padding: clamp(28px, 5vw, 44px);
    color: #fff;
    background:
        radial-gradient(circle at 88% 5%, rgba(34, 185, 208, .17), transparent 18rem),
        radial-gradient(circle at 10% 96%, rgba(118, 88, 216, .18), transparent 22rem),
        linear-gradient(135deg, var(--pl-navy) 0%, var(--pl-navy-2) 58%, #142b4e 100%);
    box-shadow:
        0 30px 84px rgba(8, 19, 44, .19),
        inset 0 1px 0 rgba(255, 255, 255, .07);
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: .14;
    background-image:
        linear-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px);
    background-size: 54px 54px;
    mask-image: linear-gradient(to right, #000, transparent 84%);
    -webkit-mask-image: linear-gradient(to right, #000, transparent 84%);
}

.hero::after {
    width: 360px;
    height: 360px;
    top: -235px;
    right: -92px;
    background: radial-gradient(circle, rgba(88, 120, 255, .32), transparent 68%);
}

.hero .eyebrow {
    color: #8ce1ee;
}

.documents-trash-page .hero .eyebrow-danger {
    color: #ff9cb1;
}

.hero h1,
.document-hero-title h1 {
    color: #fff;
    font-family:
        "Segoe UI Variable Display",
        "Segoe UI Variable",
        "Aptos Display",
        "Segoe UI",
        system-ui,
        sans-serif;
    font-weight: 780;
    letter-spacing: -.052em;
    text-wrap: balance;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.55rem);
    line-height: 1.02;
}

.document-hero-title h1 {
    font-size: clamp(1.9rem, 4.6vw, 3rem);
    line-height: 1.05;
}

.hero-copy {
    color: #bdc9dc;
    font-size: clamp(.97rem, 2vw, 1.07rem);
    font-weight: 450;
    line-height: 1.78;
}

.count-pill,
.hero .mode-pill {
    border-color: rgba(151, 181, 255, .22);
    color: #dce7ff;
    background: rgba(255, 255, 255, .075);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .065);
}

.toolbar {
    align-items: stretch;
    gap: 12px;
}

.search-form {
    width: min(100%, 650px);
}

.control {
    min-height: 50px;
    border-color: var(--pl-line-strong);
    border-radius: 14px;
    color: #17233d;
    background: rgba(255, 255, 255, .99);
    box-shadow:
        inset 0 1px 2px rgba(20, 33, 61, .025),
        0 1px 0 rgba(255, 255, 255, .9);
}

.hero .control {
    border-color: rgba(156, 180, 235, .22);
    color: #f7f9ff;
    background: rgba(3, 10, 24, .58);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .035),
        0 10px 26px rgba(0, 0, 0, .12);
}

.hero .control::placeholder {
    color: #8ea0bc;
}

.control:hover {
    border-color: rgba(75, 102, 166, .36);
}

.hero .control:hover {
    border-color: rgba(116, 151, 255, .38);
}

.control:focus {
    border-color: var(--pl-blue);
    box-shadow: var(--pl-focus);
}

.hero .control:focus {
    border-color: rgba(105, 224, 238, .55);
    box-shadow: 0 0 0 4px rgba(105, 224, 238, .10);
}

.search-icon {
    color: #8898b0;
}

.hero .search-icon {
    color: #93a7c5;
}

.button {
    min-height: 48px;
    border-radius: 13px;
    font-weight: 730;
    letter-spacing: -.01em;
}

.button-primary {
    background:
        linear-gradient(135deg, #3158e7 0%, #5878ff 54%, #7658d8 100%);
    box-shadow:
        0 14px 32px rgba(49, 88, 231, .21),
        inset 0 1px 0 rgba(255, 255, 255, .16);
}

.button-primary:hover:not(:disabled) {
    box-shadow: 0 18px 38px rgba(49, 88, 231, .25);
}

.button-soft {
    border-color: rgba(105, 128, 177, .17);
    color: #4c5b75;
    background: #f3f6fb;
}

.hero .button-soft {
    border-color: rgba(151, 181, 255, .18);
    color: #d4def0;
    background: rgba(255, 255, 255, .07);
}

.hero .button-soft:hover:not(:disabled) {
    color: #fff;
    border-color: rgba(105, 224, 238, .28);
    background: rgba(255, 255, 255, .11);
}

.button-danger {
    color: #b53543;
    border-color: rgba(217, 79, 135, .20);
    background: #fff2f5;
}

.button-danger:hover:not(:disabled) {
    background: #ffe7ed;
}

.button-success {
    color: #08734f;
    border-color: rgba(26, 165, 121, .20);
    background: #ecfaf4;
}

.search-clear {
    flex: 0 0 auto;
}

.filter-link {
    border-radius: 12px;
    font-weight: 720;
}

.filter-link.active {
    box-shadow: 0 9px 22px rgba(49, 88, 231, .13);
}

/* Documents index / trash cards */
.documents-grid {
    gap: 15px;
    margin-top: 20px;
}

.document-card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 300px;
    border-color: var(--pl-line);
    border-radius: 22px;
    padding: 20px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, .995), rgba(248, 250, 255, .985));
    box-shadow:
        var(--pl-shadow-sm),
        inset 0 1px 0 rgba(255, 255, 255, .95);
}

.document-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    z-index: -1;
    height: 2px;
    opacity: .82;
    background:
        linear-gradient(90deg, transparent, var(--pl-blue), var(--pl-violet), transparent);
}

.trash-document-card::before {
    background:
        linear-gradient(90deg, transparent, var(--pl-rose), #f08b6c, transparent);
}

.document-card:hover {
    transform: translateY(-2px);
    border-color: rgba(73, 103, 179, .24);
    background:
        linear-gradient(145deg, #fff, #f7f9ff);
    box-shadow:
        0 22px 50px rgba(20, 33, 61, .10),
        inset 0 1px 0 rgba(255, 255, 255, .96);
}

.document-title {
    color: var(--pl-navy);
    font-family:
        "Segoe UI Variable Display",
        "Segoe UI Variable",
        "Aptos Display",
        "Segoe UI",
        system-ui,
        sans-serif;
    font-weight: 760;
    letter-spacing: -.018em;
}

.document-excerpt,
.document-date {
    color: var(--pl-muted);
}

.mode-pill {
    border-color: rgba(49, 88, 231, .14);
    color: var(--pl-blue);
    background: #edf2ff;
    font-weight: 740;
}

.deleted-pill {
    color: #b53a50;
    border-color: rgba(217, 79, 135, .18);
    background: #fff0f4;
}

.favorite-button {
    border-color: rgba(182, 107, 17, .16);
    color: #a3620c;
    background: #fff8e9;
}

.favorite-button[aria-pressed="true"] {
    color: #8f5305;
    border-color: rgba(182, 107, 17, .28);
    background: #fff1c9;
    box-shadow: 0 8px 20px rgba(182, 107, 17, .10);
}

.document-stats {
    color: #6e7e96;
}

.document-actions {
    gap: 8px;
}

.notice {
    border-radius: 16px;
    box-shadow: var(--pl-shadow-sm);
}

.empty-state {
    border-color: rgba(105, 128, 177, .20);
    background:
        linear-gradient(145deg, #fff, #f6f8fc);
    box-shadow: var(--pl-shadow-sm);
}

.empty-icon {
    color: var(--pl-blue);
    background: #eaf0ff;
}

.pagination-wrap a,
.pagination-wrap span {
    border-radius: 10px;
}

.pagination-wrap [aria-current="page"] > span {
    background:
        linear-gradient(135deg, var(--pl-blue), var(--pl-blue-2), var(--pl-violet));
}

.trash-warning {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-top: 18px;
    border: 1px solid rgba(255, 148, 169, .22);
    border-radius: 15px;
    padding: 13px 14px;
    color: #ffd6df;
    background: rgba(126, 29, 55, .16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.trash-warning strong,
.trash-warning span {
    display: block;
}

.trash-warning strong {
    color: #fff0f4;
    font-size: .82rem;
}

.trash-warning span {
    margin-top: 3px;
    color: #c7b2bf;
    font-size: .77rem;
    line-height: 1.55;
}

/* Document workspace */
.document-show-page .page-shell {
    width: min(1260px, calc(100% - 32px));
}

.document-show-page .back-link {
    margin-bottom: 14px;
}

.document-show-page .hero {
    padding-bottom: 30px;
}

.document-summary {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.summary-chip {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(151, 181, 255, .17);
    border-radius: 999px;
    padding: 0 10px;
    color: #c4d1e5;
    background: rgba(255, 255, 255, .055);
    font-size: .72rem;
    font-weight: 700;
}

.rename-panel {
    position: relative;
    z-index: 1;
}

.hero-actions {
    position: relative;
    z-index: 1;
}

.compare-grid {
    gap: 18px;
    margin-top: 20px;
}

.text-card {
    border-radius: 24px;
    box-shadow: var(--pl-shadow-sm);
}

.text-card-head {
    min-height: 64px;
    border-bottom-color: var(--pl-line);
    background:
        linear-gradient(180deg, #fbfcff, #f6f8fc);
}

.text-card-head strong {
    color: var(--hx-ink-2, #43516a);
    font-family:
        "Segoe UI Variable Display",
        "Segoe UI Variable",
        "Aptos Display",
        "Segoe UI",
        system-ui,
        sans-serif;
    font-weight: 780;
    letter-spacing: .09em;
}

.text-card-head strong.result-label {
    color: var(--pl-blue);
}

.document-text {
    min-height: 25rem;
    max-height: 46rem;
    padding: 24px;
    color: #26344d;
    background: #fff;
    font-size: .96rem;
    line-height: 1.92;
}

.result-card .document-text {
    background:
        linear-gradient(180deg, #fff, #fbfcff);
}

.text-stats {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    border-top: 1px solid var(--pl-line);
    padding: 9px 18px;
    color: #76859c;
    background: #f8fafd;
    font-size: .72rem;
}

.text-stats strong {
    color: var(--hx-ink-2, #43526c);
    font-weight: 760;
}

.loader {
    color: var(--pl-blue);
    background: rgba(247, 249, 252, .92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.section-card {
    margin-top: 16px;
}

.section-card .card-inner {
    padding: clamp(22px, 3vw, 28px);
}

.section-head h2,
.card h2 {
    color: var(--pl-navy);
    font-family:
        "Segoe UI Variable Display",
        "Segoe UI Variable",
        "Aptos Display",
        "Segoe UI",
        system-ui,
        sans-serif;
    font-weight: 760;
    letter-spacing: -.022em;
}

.section-copy {
    color: var(--pl-muted);
}

.tool-grid {
    gap: 9px;
}

.tool-button {
    min-height: 48px;
    border-color: rgba(105, 128, 177, .15);
    border-radius: 13px;
    color: #45546f;
    background: #f5f7fb;
    font-weight: 720;
}

.tool-button:hover:not(:disabled) {
    color: var(--pl-blue);
    border-color: rgba(49, 88, 231, .22);
    background: #edf2ff;
}

.tool-panel {
    border-color: var(--pl-line);
    border-radius: 18px;
    background:
        linear-gradient(145deg, #f8faff, #f4f7fc);
}

.tool-panel label {
    color: #33435e;
}

.quality-head {
    color: var(--hx-ink-2, #35445e);
    font-weight: 720;
}

.quality-score {
    color: var(--pl-blue);
    font-weight: 760;
}

.quality-track::-webkit-progress-value,
.progress-native::-webkit-progress-value {
    background:
        linear-gradient(90deg, var(--pl-blue), var(--pl-blue-2), var(--pl-violet));
}

.quality-track::-moz-progress-bar,
.progress-native::-moz-progress-bar {
    background:
        linear-gradient(90deg, var(--pl-blue), var(--pl-blue-2), var(--pl-violet));
}

.feedback-row .button[aria-pressed="true"],
.feedback-row .button.is-selected {
    color: #08734f;
    border-color: rgba(26, 165, 121, .22);
    background: #eaf9f3;
    box-shadow: 0 8px 20px rgba(26, 165, 121, .08);
}

.status-message {
    font-weight: 620;
}

.versions-grid {
    gap: 10px;
}

.version-item {
    border-color: var(--pl-line);
    border-radius: 16px;
    background: #f7f9fd;
}

.version-button {
    color: #45536d;
}

.version-button.active {
    color: var(--pl-blue);
    background:
        linear-gradient(145deg, #edf2ff, #f4f6ff);
}

.version-restore {
    color: var(--hx-ink-3, #53627a);
    background: #fff;
}

.version-restore:hover {
    color: var(--pl-blue);
    background: #f3f6ff;
}

.copy-buffer {
    font-family: inherit;
}

/* Strong focus treatment shared by all interactive controls. */
.button:focus-visible,
.filter-link:focus-visible,
.icon-button:focus-visible,
.nav-link:focus-visible,
.nav-current:focus-visible,
.mobile-menu-button:focus-visible,
.tool-button:focus-visible,
.version-button:focus-visible,
.version-restore:focus-visible,
.control:focus-visible {
    outline: none;
    box-shadow: var(--pl-focus);
}

@media (max-width: 980px) {
    .document-show-page .page-shell {
        width: min(1180px, calc(100% - 32px));
    }
}

@media (max-width: 640px) {
    .header-inner,
    .mobile-nav,
    .page-shell,
    .document-show-page .page-shell {
        width: min(100% - 22px, 1180px);
    }

    .page-shell {
        padding-top: 18px;
        padding-bottom: 36px;
    }

    .hero {
        border-radius: 24px;
        padding: 25px 18px;
    }

    .hero h1,
    .document-hero-title h1 {
        font-size: clamp(1.88rem, 10vw, 2.55rem);
        letter-spacing: -.044em;
    }

    .hero-copy {
        font-size: .94rem;
        line-height: 1.7;
    }

    .toolbar,
    .search-form {
        gap: 9px;
    }

    .search-form {
        flex-wrap: wrap;
    }

    .search-wrap {
        flex-basis: 100%;
    }

    .search-form .button {
        flex: 1 1 0;
    }

    .documents-grid {
        gap: 12px;
    }

    .document-card {
        min-height: 0;
        border-radius: 20px;
        padding: 18px;
    }

    .document-card:hover {
        transform: none;
    }

    .trash-warning {
        border-radius: 13px;
    }

    .text-card {
        border-radius: 20px;
    }

    .document-text {
        min-height: 20rem;
        padding: 19px;
        font-size: .93rem;
    }

    .text-stats {
        justify-content: space-between;
        gap: 8px;
        padding-inline: 14px;
    }

    .document-summary {
        gap: 6px;
    }

    .summary-chip {
        font-size: .68rem;
    }

    .tool-panel {
        border-radius: 15px;
    }
}

@media (max-width: 390px) {
    .hero {
        padding-inline: 16px;
    }

    .hero h1,
    .document-hero-title h1 {
        font-size: 1.82rem;
    }

    .eyebrow {
        font-size: .63rem;
        letter-spacing: .12em;
    }

    .text-stats {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .document-card:hover,
    .nav-link:hover,
    .button:hover,
    .tool-button:hover {
        transform: none !important;
    }
}

