@font-face {
    font-family: 'PP Kyoto';
    src: url('assets/fonts/PPKyoto-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'PP Kyoto';
    src: url('assets/fonts/PPKyoto-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'PP Kyoto';
    src: url('assets/fonts/PPKyoto-RegularItalic.woff') format('woff');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'PP Kyoto';
    src: url('assets/fonts/PPKyoto-MediumItalic.woff') format('woff');
    font-weight: 500;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'PP Kyoto';
    src:
        url('assets/fonts/PPKyoto-HeavyItalic.woff2') format('woff2'),
        url('assets/fonts/PPKyoto-HeavyItalic.woff') format('woff');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

[hidden] {
    display: none !important;
}

:root {
    --font-serif: 'PP Kyoto', Georgia, serif;
    --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
    --font-sans-structured: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    --text-2xs: 10px;
    --text-xs: 11px;
    --text-sm: 12px;
    --text-md: 13px;
    --text-base: 14px;
    --text-readable: 15px;
    --text-lg: 16px;
    --text-xl: 18px;
    --text-2xl: 20px;
    --text-3xl: 24px;
    --text-display: 30px;
    --text-code-inline: 0.875em;

    --leading-solid: 1;
    --leading-display: 1.15;
    --leading-tight: 1.2;
    --leading-snug: 1.25;
    --leading-ui: 1.35;
    --leading-copy: 1.45;
    --leading-prose: 1.6;
    --leading-loose: 1.7;

    --text-2xs-line: var(--leading-tight);
    --text-xs-line: var(--leading-tight);
    --text-sm-line: var(--leading-copy);
    --text-md-line: var(--leading-copy);
    --text-base-line: var(--leading-prose);
    --text-readable-line: var(--leading-prose);
    --text-lg-line: var(--leading-prose);
    --text-xl-line: var(--leading-snug);
    --text-2xl-line: var(--leading-tight);
    --text-3xl-line: var(--leading-display);
    --text-display-line: var(--leading-solid);

    --weight-regular: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-strong: 650;
    --weight-bold: 700;

    --tracking-none: 0;
    --tracking-label: 0.04em;
    --tracking-caps: 0.06em;

    --space-0: 0;
    --space-px: 1px;
    --space-0-5: 2px;
    --space-1: 4px;
    --space-1-5: 6px;
    --space-2: 8px;
    --space-2-5: 10px;
    --space-3: 12px;
    --space-3-5: 14px;
    --space-4: 16px;
    --space-4-5: 18px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 28px;
    --space-8: 32px;
    --space-10: 40px;
    --space-14: 56px;
    --space-16: 64px;
    --space-25: 100px;
}

/* Reset and Base Styles */
* {
    margin: var(--space-0);
    padding: var(--space-0);
    box-sizing: border-box;
}

html {
    height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    height: 100%;
    background: #fbf9f7;
    color: #1d1d1f;
    line-height: var(--leading-prose);
    font-size: var(--text-lg);
    overflow: hidden;
}

.app-container {
    height: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ═══════════════════════════════════════════════════════════════
   IDE Layout: Three-Column Structure
   ═══════════════════════════════════════════════════════════════ */

.ide-layout {
    display: flex;
    flex: 1;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
}

.app-container.desk-mode .ide-layout {
    display: none;
}

.app-container:not(.desk-mode) .desk-view {
    display: none;
}

/* ─────────────────────────────────────────────────────────────
   Desk View
   ───────────────────────────────────────────────────────────── */

.desk-view {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 48% 42%, rgba(72, 76, 67, 0.12) 0, rgba(72, 76, 67, 0.04) 28%, rgba(72, 76, 67, 0) 44%),
        linear-gradient(90deg, rgba(52, 56, 47, 0.03) 1px, transparent 1px),
        linear-gradient(rgba(52, 56, 47, 0.028) 1px, transparent 1px),
        #f1f0e8;
    background-size: auto, 56px 56px, 56px 56px, auto;
    color: #1d1d1f;
}

.desk-topbar {
    position: absolute;
    top: 24px;
    left: 32px;
    right: 32px;
    z-index: 20;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-6);
}

.desk-brand {
    position: relative;
}

.desk-brand-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.desk-brand h1 {
    font-family: var(--font-serif);
    font-size: var(--text-display);
    font-weight: var(--weight-medium);
    line-height: var(--leading-solid);
    margin: var(--space-0);
    text-wrap: balance;
}

.desk-help-popover {
    position: absolute;
    top: 48px;
    left: 0;
    z-index: 40;
    width: min(314px, calc(100vw - 64px));
    padding: var(--space-3-5) var(--space-4) var(--space-4);
    background: rgba(255, 250, 242, 0.94);
    border-radius: 8px;
    backdrop-filter: blur(16px);
    box-shadow:
        inset 0 0 0 1px rgba(42, 46, 40, 0.07),
        inset 0 1px 0 rgba(255, 255, 255, 0.54),
        0 18px 42px rgba(61, 66, 58, 0.13);
}

.desk-help-popover[hidden] {
    display: none;
}

.desk-help-popover h2 {
    margin: var(--space-0) var(--space-0) var(--space-2);
    color: #20221f;
    font-size: var(--text-md);
    font-weight: var(--weight-strong);
    line-height: var(--leading-snug);
}

.desk-help-popover p {
    margin: var(--space-0);
    color: #646b61;
    font-size: var(--text-sm);
    line-height: var(--leading-prose);
    text-wrap: pretty;
}

.desk-actions {
    display: flex;
    gap: var(--space-2);
}

.desk-layout-toggle {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border-radius: 999px;
    background: rgba(255, 250, 242, 0.5);
    box-shadow:
        inset 0 0 0 1px rgba(42, 46, 40, 0.055),
        inset 0 1px 0 rgba(255, 255, 255, 0.52);
    backdrop-filter: blur(12px);
}

.desk-icon-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    min-height: 40px;
    appearance: none;
    background: transparent;
    border: none;
    border-radius: 999px;
    color: #646c62;
    cursor: pointer;
    padding: var(--space-0);
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease, opacity 0.16s ease;
}

.desk-icon-btn:hover {
    background: rgba(42, 46, 40, 0.055);
    color: #252923;
}

.desk-icon-btn.active,
.desk-icon-btn[aria-pressed="true"] {
    background: rgba(42, 46, 40, 0.09);
    color: #20241f;
    box-shadow: inset 0 0 0 1px rgba(42, 46, 40, 0.07);
}

.desk-icon-btn:focus-visible {
    outline: 1px solid rgba(42, 46, 40, 0.22);
    outline-offset: 3px;
}

.desk-icon-btn:active {
    transform: scale(0.96);
}

.desk-icon-btn.primary {
    color: #2a2e28;
}

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

.desk-action-btn {
    min-height: 38px;
    appearance: none;
    background: rgba(255, 250, 242, 0.82);
    border: none;
    border-radius: 7px;
    color: #262a25;
    cursor: pointer;
    font-size: var(--text-md);
    font-weight: var(--weight-medium);
    padding: var(--space-2) var(--space-3);
    transition: background-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
    backdrop-filter: blur(12px);
    box-shadow:
        inset 0 0 0 1px rgba(29, 29, 31, 0.07),
        inset 0 1px 0 rgba(255, 255, 255, 0.62),
        0 8px 20px rgba(61, 66, 58, 0.08);
}

.desk-action-btn:hover {
    background: rgba(255, 253, 248, 0.96);
    box-shadow:
        inset 0 0 0 1px rgba(29, 29, 31, 0.09),
        inset 0 1px 0 rgba(255, 255, 255, 0.72),
        0 10px 24px rgba(61, 66, 58, 0.1);
}

.desk-action-btn:active {
    transform: scale(0.96);
}

.desk-action-btn.secondary {
    background: rgba(246, 245, 237, 0.62);
    color: #687066;
    box-shadow:
        inset 0 0 0 1px rgba(29, 29, 31, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.56),
        0 8px 18px rgba(61, 66, 58, 0.05);
}

.desk-empty-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
}

.desk-canvas {
    position: absolute;
    inset: 102px 28px 28px;
    touch-action: none;
}

.desk-canvas.arranged {
    overflow: auto;
    touch-action: pan-x pan-y;
}

.desk-canvas.desk-transitioning .desk-paper {
    animation: none;
    will-change: transform;
}

.desk-paper.desk-transitioned {
    animation: none;
}

.desk-canvas.desk-transitioning .desk-arranged-row-label {
    opacity: 0;
    transform: translateY(4px);
}

.desk-arranged-rows {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-8);
    min-height: 100%;
    padding: var(--space-6) var(--space-3) var(--space-8);
}

.desk-arranged-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    width: fit-content;
    max-width: 100%;
    margin: var(--space-0) auto;
}

.desk-arranged-row-label {
    color: #737b70;
    font-size: var(--text-2xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-caps);
    line-height: var(--leading-tight);
    opacity: 1;
    padding-left: var(--space-1);
    transform: translateY(0);
    transition: opacity 0.18s ease 0.08s, transform 0.18s ease 0.08s;
    text-transform: uppercase;
}

.desk-arranged-row-papers {
    display: flex;
    align-items: flex-start;
    gap: var(--space-5);
    overflow: visible;
    padding: var(--space-2) var(--space-1) var(--space-5);
}

.desk-paper {
    --paper-rotation: 0deg;
    --paper-delay: 0ms;
    position: absolute;
    width: clamp(220px, 17vw, 258px);
    min-height: clamp(250px, 27vh, 310px);
    appearance: none;
    background: #fffaf2;
    border: none;
    border-radius: 4px;
    color: #1d1d1f;
    cursor: grab;
    display: flex;
    flex-direction: column;
    gap: var(--space-2-5);
    padding: var(--space-4-5) var(--space-4-5) var(--space-4);
    text-align: left;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transform: rotate(var(--paper-rotation)) translateY(0) scale(1);
    transform-origin: 50% 62%;
    transition: transform 0.22s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.22s ease, filter 0.22s ease;
    animation: deskPaperIn 0.36s cubic-bezier(0.2, 0, 0, 1) both;
    animation-delay: var(--paper-delay);
    box-shadow:
        0 0 0 1px rgba(42, 46, 40, 0.055),
        0 1px 2px rgba(61, 66, 58, 0.045),
        0 18px 42px rgba(61, 66, 58, 0.075),
        0 0 26px rgba(124, 132, 112, 0.055);
}

.desk-canvas.arranged .desk-paper {
    position: relative;
    left: auto;
    top: auto;
    flex: 0 0 clamp(220px, 17vw, 258px);
    cursor: pointer;
    transform: translateY(0) scale(1);
}

.desk-canvas.arranged .desk-paper:hover,
.desk-canvas.arranged .desk-paper:focus-visible {
    transform: translateY(-8px) scale(1.015);
}

.desk-canvas.arranged .paper-rotate-zone {
    display: none;
}

.desk-paper.placed {
    animation: none;
}

.desk-paper::before,
.desk-paper::after {
    content: '';
    position: absolute;
    inset: 5px;
    z-index: -1;
    border-radius: 4px;
    background: #fbf7ef;
    box-shadow:
        0 0 0 1px rgba(42, 46, 40, 0.035),
        0 8px 16px rgba(61, 66, 58, 0.04);
    opacity: 0;
    transition: transform 0.22s cubic-bezier(0.2, 0, 0, 1), opacity 0.22s ease;
}

.desk-paper.stacked::before,
.desk-paper.stacked::after {
    opacity: 1;
}

.desk-paper.stacked::before {
    transform: translate(6px, 7px) rotate(3deg);
}

.desk-paper.stacked::after {
    transform: translate(-5px, 10px) rotate(-4deg);
}

.desk-paper:hover,
.desk-paper:focus-visible {
    z-index: 30;
    filter: saturate(1.02);
    outline: none;
    transform: rotate(var(--paper-rotation)) translateY(-12px) scale(1.025);
    box-shadow:
        0 0 0 1px rgba(42, 46, 40, 0.055),
        0 2px 4px rgba(61, 66, 58, 0.045),
        0 26px 56px rgba(61, 66, 58, 0.095),
        0 0 32px rgba(124, 132, 112, 0.075);
}

.desk-paper.bundled {
    --peek-x: 0px;
    --peek-y: 0px;
    --peek-rotation: 0deg;
    --peek-z: 35;
}

.desk-paper.bundle-peeked {
    z-index: var(--peek-z);
    filter: saturate(1.025);
    transform: translate3d(var(--peek-x), var(--peek-y), 0) rotate(calc(var(--paper-rotation) + var(--peek-rotation))) translateY(-7px) scale(1.018);
    box-shadow:
        0 0 0 1px rgba(42, 46, 40, 0.055),
        0 2px 5px rgba(61, 66, 58, 0.045),
        0 28px 58px rgba(61, 66, 58, 0.1),
        0 0 34px rgba(124, 132, 112, 0.075);
}

.desk-paper.bundle-peeked:hover,
.desk-paper.bundle-peeked:focus-visible {
    z-index: 52;
    transform: translate3d(var(--peek-x), var(--peek-y), 0) rotate(calc(var(--paper-rotation) + var(--peek-rotation))) translateY(-12px) scale(1.035);
}

.desk-paper.bundle-peeked .paper-info {
    opacity: 1;
    transform: translateY(0);
}

.desk-paper.dragging,
.desk-paper.rotating {
    z-index: 60;
    cursor: grabbing;
    filter: saturate(1.03);
    transform: rotate(var(--paper-rotation)) translateY(-16px) scale(1.035);
    transition: box-shadow 0.14s ease, filter 0.14s ease;
    box-shadow:
        0 0 0 1px rgba(42, 46, 40, 0.06),
        0 3px 8px rgba(61, 66, 58, 0.05),
        0 34px 70px rgba(61, 66, 58, 0.12),
        0 0 36px rgba(124, 132, 112, 0.08);
}

.desk-paper:hover::before,
.desk-paper:hover::after,
.desk-paper:focus-visible::before,
.desk-paper:focus-visible::after {
    opacity: 0.9;
}

.desk-paper.active {
    box-shadow:
        0 0 0 1px rgba(42, 46, 40, 0.065),
        0 1px 2px rgba(61, 66, 58, 0.045),
        0 18px 44px rgba(61, 66, 58, 0.08),
        0 0 28px rgba(124, 132, 112, 0.06);
}

.desk-paper.recent {
    z-index: 44;
    animation: deskRecentPaperPulse 1.45s cubic-bezier(0.2, 0, 0, 1) both;
    box-shadow:
        0 0 0 1px rgba(152, 111, 48, 0.16),
        0 2px 4px rgba(61, 66, 58, 0.055),
        0 24px 58px rgba(61, 66, 58, 0.105),
        0 0 36px rgba(217, 177, 91, 0.28);
}

.paper-rotate-zone {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 5;
    display: block;
    width: 68px;
    height: 68px;
    background: transparent;
    border: 0;
    border-radius: 0 4px 0 18px;
    color: #667066;
    cursor: grab;
    touch-action: none;
}

.paper-rotate-zone:active,
.desk-paper.rotating .paper-rotate-zone {
    cursor: grabbing;
}

.paper-kicker {
    color: #687267;
    font-size: var(--text-2xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-caps);
    line-height: var(--leading-tight);
    min-height: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.paper-title {
    color: #181818;
    display: -webkit-box;
    font-family: var(--font-serif);
    font-size: clamp(var(--text-xl), 1.7vw, var(--text-3xl));
    font-weight: var(--weight-medium);
    line-height: var(--leading-display);
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    text-wrap: balance;
}

.paper-preview {
    color: #4f554f;
    display: -webkit-box;
    font-size: var(--text-sm);
    line-height: var(--leading-copy);
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    text-wrap: pretty;
}

.paper-lines {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: auto;
    opacity: 0.42;
}

.paper-lines span {
    height: 1px;
    background: rgba(29, 29, 31, 0.2);
}

.paper-lines span:nth-child(2) {
    width: 74%;
}

.paper-lines span:nth-child(3) {
    width: 52%;
}

.paper-info {
    display: flex;
    justify-content: space-between;
    gap: var(--space-2-5);
    color: #7b837b;
    font-size: var(--text-xs);
    line-height: var(--leading-tight);
    opacity: 0;
    padding-top: var(--space-2-5);
    transform: translateY(4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    font-variant-numeric: tabular-nums;
}

.desk-paper:hover .paper-info,
.desk-paper:focus-visible .paper-info {
    opacity: 1;
    transform: translateY(0);
}

.desk-empty {
    position: absolute;
    left: 50%;
    top: 44%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.desk-empty h2 {
    font-family: var(--font-serif);
    font-size: var(--text-display);
    font-weight: var(--weight-medium);
    margin: var(--space-0) var(--space-0) var(--space-2);
}

.desk-empty p {
    color: #666f68;
    font-size: var(--text-md);
    margin: var(--space-0) var(--space-0) var(--space-4);
}

@keyframes deskPaperIn {
    from {
        opacity: 0;
        transform: rotate(var(--paper-rotation)) translateY(8px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: rotate(var(--paper-rotation)) translateY(0) scale(1);
    }
}

@keyframes deskRecentPaperPulse {
    0% {
        filter: saturate(1.08) brightness(1.025);
        transform: rotate(var(--paper-rotation)) translateY(-10px) scale(1.022);
    }
    100% {
        filter: saturate(1);
        transform: rotate(var(--paper-rotation)) translateY(0) scale(1);
    }
}

/* API Key Section */
.api-key-section {
    width: min(100%, 760px);
    margin: calc(var(--space-1) * -1) var(--space-0) var(--space-6);
    background: rgba(245, 243, 240, 0.72);
    border-radius: 8px;
    padding: var(--space-2-5) var(--space-3);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
    box-shadow:
        inset 0 0 0 1px rgba(0, 0, 0, 0.05),
        0 1px 2px rgba(0, 0, 0, 0.02);
}

.api-key-section.visible {
    display: flex;
}

.api-key-section.hidden {
    display: none;
}

.settings-panel .api-key-section {
    width: 100%;
    margin: var(--space-0-5) var(--space-0) var(--space-3-5);
    align-items: stretch;
    gap: var(--space-2-5);
}

.settings-panel .api-key-copy {
    min-width: 0;
}

.settings-panel #apiKeyInput {
    flex-basis: 100%;
    width: 100%;
}

.settings-panel .remember-key-option,
.settings-panel .save-key-btn {
    align-self: flex-start;
}

.api-key-copy {
    display: flex;
    flex-direction: column;
    min-width: 156px;
}

.api-key-copy span {
    font-size: var(--text-sm);
    color: #3a3a3c;
    font-weight: var(--weight-semibold);
}

.api-key-copy small {
    color: #8e8e93;
    font-size: var(--text-xs);
    line-height: var(--leading-ui);
}

#apiKeyInput {
    flex: 1 1 240px;
    width: min(320px, 100%);
    padding: var(--space-2) var(--space-2-5);
    border: none;
    border-radius: 6px;
    font-size: var(--text-md);
    background: rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

#apiKeyInput:focus {
    outline: none;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22);
}

.save-key-btn {
    min-height: 34px;
    background: rgba(29, 29, 31, 0.06);
    color: #1d1d1f;
    border: none;
    padding: var(--space-1-5) var(--space-3);
    border-radius: 6px;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    cursor: pointer;
    transition: background-color 0.16s ease, transform 0.16s ease;
}

.save-key-btn:hover {
    background: rgba(29, 29, 31, 0.1);
}

.save-key-btn:active {
    transform: scale(0.96);
}

.remember-key-option {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    min-height: 34px;
    font-size: var(--text-sm);
    color: #8e8e93;
    cursor: pointer;
    user-select: none;
}

.remember-key-option input {
    accent-color: #8e8e93;
}

/* ─────────────────────────────────────────────────────────────
   Left Sidebar: Documents
   ───────────────────────────────────────────────────────────── */

.documents-sidebar {
    width: 220px;
    min-width: 220px;
    height: 100vh;
    align-self: flex-start;
    background: #f5f3f0;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: sticky;
    top: 0;
    transition: width 0.24s cubic-bezier(0.2, 0, 0, 1), min-width 0.24s cubic-bezier(0.2, 0, 0, 1), opacity 0.16s ease;
}

.documents-sidebar.collapsed {
    width: 0;
    min-width: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 0 0 auto;
    position: sticky;
    top: 0;
    z-index: 3;
    padding: var(--space-4) var(--space-4) var(--space-3);
    background: rgba(245, 243, 240, 0.94);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sidebar-title {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: #8e8e93;
    text-transform: uppercase;
    letter-spacing: var(--tracking-label);
    margin: var(--space-0);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.new-doc-actions {
    display: flex;
    align-items: center;
    gap: var(--space-0-5);
}

.new-doc-btn {
    background: none;
    border: none;
    color: #8e8e93;
    cursor: pointer;
    padding: var(--space-1);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.new-doc-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1d1d1f;
}

.sidebar-desk-nav {
    flex: 0 0 auto;
    padding: var(--space-2);
}

.sidebar-desk-btn {
    width: 100%;
    min-height: 40px;
    appearance: none;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #3a3a3c;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-2-5);
    font-size: var(--text-md);
    font-weight: var(--weight-medium);
    justify-content: flex-start;
    padding: var(--space-2) var(--space-2-5);
    text-align: left;
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.sidebar-desk-btn svg {
    color: #8e8e93;
    flex: 0 0 auto;
    transition: color 0.16s ease;
}

.sidebar-desk-btn:hover {
    background: rgba(0, 0, 0, 0.045);
    color: #1d1d1f;
}

.sidebar-desk-btn:hover svg {
    color: #1d1d1f;
}

.sidebar-desk-btn:active {
    transform: scale(0.96);
}

.document-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--space-2);
}

.workspace-actions {
    padding: var(--space-3);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.workspace-actions-label {
    color: #8e8e93;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-label);
    margin: var(--space-0) var(--space-1) var(--space-2);
    text-transform: uppercase;
}

.workspace-action-btn {
    width: 100%;
    min-height: 32px;
    appearance: none;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #3a3a3c;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: var(--text-md);
    justify-content: flex-start;
    margin-bottom: var(--space-0-5);
    padding: var(--space-1-5) var(--space-2);
    text-align: left;
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.workspace-action-btn:hover {
    background: rgba(0, 0, 0, 0.045);
    color: #1d1d1f;
}

.workspace-action-btn:active {
    transform: scale(0.96);
}

.workspace-actions-note {
    color: #9a9a9f;
    font-size: var(--text-xs);
    line-height: var(--leading-copy);
    margin: var(--space-2-5) var(--space-1) var(--space-0);
    text-wrap: pretty;
}

.document-item {
    padding: var(--space-2-5) var(--space-3);
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.16s ease;
    margin-bottom: var(--space-0-5);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 56px;
}

.document-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.document-item.active {
    background: rgba(0, 0, 0, 0.06);
}

.document-item {
    position: relative;
}

.document-copy {
    flex: 1;
    min-width: 0;
}

.document-title {
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
    color: #1d1d1f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: var(--space-0-5);
}

.document-meta {
    font-size: var(--text-sm);
    color: #8e8e93;
    font-variant-numeric: tabular-nums;
}

.document-menu-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #8e8e93;
    cursor: pointer;
    flex-shrink: 0;
    font-size: var(--text-readable);
    line-height: var(--leading-solid);
    opacity: 0;
    transition: background-color 0.16s ease, color 0.16s ease, opacity 0.16s ease, transform 0.16s ease;
}

.document-item:hover .document-menu-btn,
.document-menu-btn:focus,
.document-item.active .document-menu-btn {
    opacity: 1;
}

.document-menu-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1d1d1f;
}

.document-menu-btn:active {
    transform: scale(0.96);
}

.document-menu {
    position: absolute;
    right: 8px;
    top: 42px;
    z-index: 40;
    width: 132px;
    padding: var(--space-1);
    background: rgba(251, 249, 247, 0.98);
    border-radius: 8px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.07),
        0 10px 24px rgba(0, 0, 0, 0.1);
}

.document-menu button {
    width: 100%;
    min-height: 30px;
    background: transparent;
    border: none;
    border-radius: 5px;
    color: #3a3a3c;
    cursor: pointer;
    font-size: var(--text-md);
    padding: var(--space-1-5) var(--space-2);
    text-align: left;
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.document-menu button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1d1d1f;
}

.document-menu button:active {
    transform: scale(0.96);
}

.document-menu button.danger {
    color: #b42318;
}

.document-menu button:disabled {
    color: #c7c7cc;
    cursor: not-allowed;
}

.sidebar-collapse-btn {
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 48px;
    background: #f5f3f0;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-left: none;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8e8e93;
    font-size: var(--text-sm);
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
    z-index: 10;
}

.sidebar-collapse-btn:hover {
    background: #eeebe8;
    color: #1d1d1f;
}

.sidebar-reveal-btn {
    position: fixed;
    top: 50%;
    z-index: 120;
    display: none;
    align-items: center;
    justify-content: center;
    width: var(--space-10);
    height: 44px;
    min-height: 40px;
    appearance: none;
    background: rgba(251, 249, 247, 0.96);
    border: none;
    border-radius: 10px;
    color: #6e6e73;
    cursor: pointer;
    padding: var(--space-0);
    transform: translateY(-50%);
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.07),
        0 8px 22px rgba(0, 0, 0, 0.1);
}

.sidebar-reveal-left {
    left: 8px;
    border-radius: 0 10px 10px 0;
}

.sidebar-reveal-right {
    right: 8px;
    border-radius: 10px 0 0 10px;
}

.sidebar-reveal-icon {
    flex: none;
    opacity: 0.82;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.sidebar-reveal-left .sidebar-reveal-icon {
    transform: translateX(1px);
}

.sidebar-reveal-right .sidebar-reveal-icon {
    transform: translateX(-1px);
}

.documents-sidebar.collapsed + .sidebar-reveal-left,
.problems-sidebar.collapsed + .sidebar-reveal-right {
    display: flex;
}

.sidebar-reveal-btn:hover {
    background: #fffdf9;
    color: #1d1d1f;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.09),
        0 12px 28px rgba(0, 0, 0, 0.13);
}

.sidebar-reveal-btn:hover .sidebar-reveal-icon {
    opacity: 1;
}

.sidebar-reveal-left:hover .sidebar-reveal-icon {
    transform: translateX(2px);
}

.sidebar-reveal-right:hover .sidebar-reveal-icon {
    transform: translateX(-2px);
}

.sidebar-reveal-btn:focus-visible {
    outline: 2px solid rgba(0, 122, 255, 0.45);
    outline-offset: 2px;
}

.sidebar-reveal-btn:active {
    transform: translateY(-50%) scale(0.96);
}

/* ─────────────────────────────────────────────────────────────
   Main Editor Area
   ───────────────────────────────────────────────────────────── */

.editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    background: #fbf9f7;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--space-10) var(--space-16) var(--space-25);
    scrollbar-gutter: stable;
}

/* Writing Container - now inside editor-main */
.writing-container {
    flex: 1;
    max-width: none;
    min-width: 0;
    margin: var(--space-0) auto;
    padding: var(--space-16) var(--space-10) var(--space-25);
    width: 100%;
    max-width: 800px;
    transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─────────────────────────────────────────────────────────────
   Right Sidebar: Problems Panel
   ───────────────────────────────────────────────────────────── */

.problems-sidebar {
    width: var(--problems-sidebar-width, 360px);
    min-width: var(--problems-sidebar-width, 360px);
    height: 100vh;
    align-self: flex-start;
    position: sticky;
    top: 0;
    background: rgba(251, 249, 247, 0.98);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: inset 1px 0 rgba(0, 0, 0, 0.06);
    transition: width 0.24s cubic-bezier(0.2, 0, 0, 1), min-width 0.24s cubic-bezier(0.2, 0, 0, 1), opacity 0.16s ease;
}

.problems-sidebar.is-resizing {
    transition-property: opacity;
}

.resizing-problems-sidebar {
    cursor: col-resize;
    user-select: none;
}

.problems-sidebar-resize-handle {
    bottom: 0;
    cursor: col-resize;
    left: -16px;
    position: absolute;
    touch-action: none;
    top: 0;
    width: 32px;
    z-index: 8;
}

.problems-sidebar-resize-handle::before {
    background: rgba(29, 29, 31, 0.12);
    border-radius: 999px;
    content: "";
    display: block;
    height: 44px;
    left: 15px;
    opacity: 0.42;
    position: sticky;
    top: calc(50vh - 22px);
    transition: opacity 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
    width: 3px;
}

.problems-sidebar-resize-handle:hover::before,
.problems-sidebar-resize-handle:focus-visible::before,
.problems-sidebar.is-resizing .problems-sidebar-resize-handle::before {
    background: rgba(0, 122, 255, 0.72);
    opacity: 1;
    transform: scaleX(1.35);
}

.problems-sidebar-resize-handle:focus-visible {
    outline: none;
}

.problems-sidebar.collapsed {
    width: 0;
    min-width: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

.problems-sidebar.collapsed .problems-sidebar-resize-handle {
    display: none;
}

.problems-sidebar .sidebar-header {
    flex: 0 0 auto;
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2-5);
    padding: var(--space-4) var(--space-4-5) var(--space-3);
    background: rgba(251, 249, 247, 0.94);
    backdrop-filter: blur(14px);
}

.sidebar-mode-tabs {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    padding: var(--space-0-5);
    border-radius: 999px;
    background: rgba(29, 29, 31, 0.045);
    box-shadow: inset 0 0 0 1px rgba(29, 29, 31, 0.045);
}

.sidebar-mode-tab {
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #797d78;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    min-height: 28px;
    padding: var(--space-0) var(--space-2-5);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    line-height: var(--leading-solid);
    white-space: nowrap;
    transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.sidebar-mode-tab[hidden],
.reader-margins-btn[hidden],
.filter-btn[hidden] {
    display: none;
}

.sidebar-mode-tab:hover {
    color: #242823;
}

.sidebar-mode-tab.active {
    background: rgba(255, 255, 255, 0.72);
    color: #242823;
    box-shadow:
        0 1px 2px rgba(29, 29, 31, 0.06),
        inset 0 0 0 1px rgba(29, 29, 31, 0.045);
}

.right-pane {
    display: none;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
}

.right-pane.active {
    display: flex;
}

.sidebar-actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.reader-margins-btn,
.filter-btn,
.sidebar-toggle-btn {
    background: none;
    border: none;
    color: #8e8e93;
    cursor: pointer;
    padding: var(--space-1);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.reader-margins-btn {
    position: relative;
}

.reader-margins-btn.active,
.reader-margins-btn:hover,
.filter-btn:hover,
.sidebar-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1d1d1f;
}

.reader-margin-count {
    position: absolute;
    right: -4px;
    top: -4px;
    min-width: 14px;
    height: 14px;
    border-radius: 999px;
    background: rgba(29, 29, 31, 0.84);
    color: #fffdf8;
    font-size: var(--text-2xs);
    font-weight: var(--weight-strong);
    line-height: var(--space-3-5);
    text-align: center;
    box-shadow: 0 0 0 2px rgba(251, 249, 247, 0.98);
}

.reader-margin-count:empty {
    display: none;
}

.problems-count {
    background: rgba(0, 0, 0, 0.08);
    color: #8e8e93;
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    padding: var(--space-0-5) var(--space-1-5);
    border-radius: 10px;
    margin-left: var(--space-1-5);
}

.problems-count:empty {
    display: none;
}

/* Problems Filter */
.problems-filter {
    background: rgba(251, 249, 247, 0.98);
    border-radius: 8px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.07),
        0 14px 34px rgba(0, 0, 0, 0.12);
    display: none;
    min-width: 188px;
    padding: var(--space-2);
    position: fixed;
    z-index: 70;
}

.problems-filter.show {
    display: block;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-md);
    color: #3a3a3c;
    border-radius: 6px;
    padding: var(--space-1-5) var(--space-2);
    cursor: pointer;
}

.filter-option:hover {
    background: rgba(0, 0, 0, 0.045);
}

.filter-option input[type="checkbox"] {
    accent-color: #8e8e93;
}

/* Problems List */
.problems-list {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--space-3);
    min-height: 0;
}

.app-container.reader-mode .problems-list {
    overflow: hidden;
    padding: var(--space-2-5);
}

.reader-panel {
    display: grid;
    height: 100%;
    min-height: 0;
}

.reader-panel-conversation,
.reader-panel-margins {
    min-height: 0;
}

.reader-conversation,
.reader-thread-section {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: var(--space-0-5);
}

.reader-messages-frame {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.reader-panel-kicker,
.reader-section-heading {
    color: #8e8e93;
    font-size: var(--text-xs);
    font-weight: var(--weight-strong);
    letter-spacing: var(--tracking-caps);
    line-height: var(--leading-tight);
    margin: var(--space-0) var(--space-0) var(--space-2);
    text-transform: uppercase;
}

.reader-section-heading {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    font-variant-numeric: tabular-nums;
    padding: var(--space-px) var(--space-0-5) var(--space-2-5);
}

.reader-selected-quote {
    margin: var(--space-0) var(--space-0) var(--space-2-5);
    color: #3a3a3c;
    font-family: var(--font-serif);
    font-size: var(--text-base);
    line-height: var(--leading-prose);
    text-wrap: pretty;
}

.reader-clear-selection {
    min-height: 30px;
    appearance: none;
    border: none;
    border-radius: 6px;
    background: rgba(29, 29, 31, 0.055);
    color: #6e6e73;
    cursor: pointer;
    font-size: var(--text-sm);
    margin: var(--space-0) var(--space-0) var(--space-2-5);
    padding: var(--space-1-5) var(--space-2-5);
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.reader-clear-selection:hover {
    background: rgba(29, 29, 31, 0.085);
    color: #1d1d1f;
}

.reader-clear-selection:active {
    transform: scale(0.96);
}

.reader-reply-form {
    display: block;
    flex: 0 0 auto;
    margin-top: var(--space-2-5);
}

.reader-composer-shell {
    width: 100%;
    overflow: hidden;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow:
        0 0 0 1px rgba(29, 29, 31, 0.08),
        0 14px 36px rgba(29, 29, 31, 0.09);
    transition: background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.reader-composer-shell:focus-within {
    background: rgba(255, 255, 255, 0.98);
    box-shadow:
        0 0 0 1px rgba(29, 29, 31, 0.14),
        0 18px 44px rgba(29, 29, 31, 0.12);
}

.reader-composer-shell textarea {
    display: block;
    width: 100%;
    min-height: 92px;
    max-height: 176px;
    resize: none;
    border: none;
    background: transparent;
    color: #1d1d1f;
    font: inherit;
    font-size: var(--text-base);
    line-height: var(--leading-copy);
    padding: var(--space-4-5) var(--space-4-5) var(--space-4);
}

.reader-composer-shell textarea:focus {
    outline: none;
}

.reader-composer-bar {
    display: flex;
    min-height: 54px;
    align-items: center;
    justify-content: flex-end;
    padding: var(--space-2) var(--space-2-5);
    box-shadow: inset 0 1px rgba(29, 29, 31, 0.085);
}

.reader-messages {
    --reader-message-mask-bottom: 0px;
    --reader-message-mask-top: 0px;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    height: 100%;
    mask-image: linear-gradient(
        to bottom,
        transparent 0,
        #000 var(--reader-message-mask-top),
        #000 calc(100% - var(--reader-message-mask-bottom)),
        transparent 100%
    );
    mask-size: 100% 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--space-5) var(--space-0-5) var(--space-6);
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    transition: mask-image 0.18s ease;
    -webkit-mask-image: linear-gradient(
        to bottom,
        transparent 0,
        #000 var(--reader-message-mask-top),
        #000 calc(100% - var(--reader-message-mask-bottom)),
        transparent 100%
    );
    -webkit-mask-size: 100% 100%;
}

.reader-messages-frame.has-top-overflow .reader-messages {
    --reader-message-mask-top: 76px;
}

.reader-messages-frame.has-bottom-overflow .reader-messages {
    --reader-message-mask-bottom: 82px;
}

.reader-message {
    position: relative;
    border-radius: 0;
    padding: var(--space-0-5) var(--space-1) var(--space-1);
    background: transparent;
    box-shadow: none;
}

.reader-message.user {
    align-self: flex-end;
    max-width: calc(100% - 30px);
    margin-left: var(--space-8);
    border-radius: 8px;
    padding: var(--space-2-5) var(--space-2-5);
    background: rgba(29, 29, 31, 0.045);
    box-shadow: inset 0 0 0 1px rgba(29, 29, 31, 0.05);
}

.reader-message.assistant {
    margin-right: var(--space-0);
    padding-inline: var(--space-1) var(--space-1-5);
}

.reader-message-role {
    color: #8e8e93;
    font-size: var(--text-2xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-caps);
    line-height: var(--leading-tight);
    margin-bottom: var(--space-1);
    text-transform: uppercase;
}

.reader-message-content {
    color: #3a3a3c;
    font-size: var(--text-md);
    line-height: var(--leading-prose);
}

.reader-message-content > :first-child {
    margin-top: var(--space-0);
}

.reader-message-content > :last-child {
    margin-bottom: var(--space-0);
}

.reader-message-content p {
    margin: var(--space-0);
    white-space: pre-wrap;
    text-wrap: pretty;
}

.reader-message-content p + p,
.reader-message-content ul,
.reader-message-content ol,
.reader-message-content blockquote,
.reader-message-content pre {
    margin-top: var(--space-2);
}

.reader-message-content ul,
.reader-message-content ol {
    padding-left: var(--space-4-5);
}

.reader-message-content li {
    margin: var(--space-1) var(--space-0);
}

.reader-message-content h1,
.reader-message-content h2,
.reader-message-content h3,
.reader-message-content h4 {
    color: #1d1d1f;
    font-family: var(--font-sans-structured);
    font-size: var(--text-md);
    font-weight: var(--weight-strong);
    line-height: var(--leading-ui);
    margin: var(--space-2-5) var(--space-0) var(--space-1-5);
}

.reader-message-content blockquote {
    margin-left: var(--space-0);
    padding-left: var(--space-2-5);
    color: #515154;
    box-shadow: inset 2px 0 0 rgba(29, 29, 31, 0.16);
}

.reader-message-content code {
    border-radius: 4px;
    background: rgba(29, 29, 31, 0.06);
    font-family: var(--font-mono);
    font-size: var(--text-code-inline);
    padding: var(--space-px) var(--space-1);
}

.reader-message-content pre {
    overflow-x: auto;
    border-radius: 7px;
    background: rgba(29, 29, 31, 0.055);
    padding: var(--space-2-5);
}

.reader-message-content pre code {
    background: transparent;
    padding: var(--space-0);
}

.reader-visualization-shell {
    margin-top: var(--space-2-5);
}

.reader-visualization {
    font-family: var(--font-sans-structured);
}

.reader-visualization-error {
    border-radius: 7px;
    background: rgba(220, 38, 38, 0.08);
    color: #991b1b;
    font-size: var(--text-sm);
    padding: var(--space-2-5);
}

.json-render-card {
    border-radius: 8px;
    background: #fff;
    box-shadow:
        0 0 0 1px rgba(29, 29, 31, 0.08),
        0 12px 30px rgba(29, 29, 31, 0.08);
    color: #1d1d1f;
    padding: var(--space-3);
}

.json-render-card-title {
    color: #1d1d1f;
    font-size: var(--text-md);
    font-weight: var(--weight-bold);
    line-height: var(--leading-snug);
    margin: var(--space-0);
}

.json-render-card-description {
    color: #636366;
    font-size: var(--text-sm);
    line-height: var(--leading-copy);
    margin: var(--space-1) var(--space-0) var(--space-0);
}

.json-render-card-body {
    margin-top: var(--space-2-5);
}

.json-render-stack {
    display: flex;
}

.json-render-stack-vertical {
    flex-direction: column;
}

.json-render-stack-horizontal {
    align-items: stretch;
    flex-direction: row;
}

.json-render-stack-wrap {
    flex-wrap: wrap;
}

.json-render-stack-gap-xs {
    gap: var(--space-1);
}

.json-render-stack-gap-sm {
    gap: var(--space-2);
}

.json-render-stack-gap-md {
    gap: var(--space-3);
}

.json-render-stack-gap-lg {
    gap: var(--space-4);
}

.json-render-heading {
    color: #1d1d1f;
    font-size: var(--text-md);
    font-weight: var(--weight-bold);
    line-height: var(--leading-ui);
    margin: var(--space-0);
}

.json-render-text {
    font-size: var(--text-sm);
    line-height: var(--leading-copy);
    margin: var(--space-0);
}

.json-render-text-muted {
    color: #636366;
}

.json-render-text-strong {
    color: #1d1d1f;
    font-weight: var(--weight-strong);
}

.json-render-metric {
    border-radius: 7px;
    background: rgba(29, 29, 31, 0.045);
    min-width: 116px;
    padding: var(--space-2-5);
}

.json-render-metric-label,
.json-render-metric-change {
    color: #636366;
    display: block;
    font-size: var(--text-xs);
    line-height: var(--leading-ui);
}

.json-render-metric-value {
    color: #1d1d1f;
    display: block;
    font-size: var(--text-2xl);
    font-variant-numeric: tabular-nums;
    line-height: var(--leading-display);
    margin: var(--space-1) var(--space-0);
}

.json-render-metric-positive .json-render-metric-change {
    color: #047857;
}

.json-render-metric-negative .json-render-metric-change {
    color: #b91c1c;
}

.json-render-badge {
    align-items: center;
    align-self: flex-start;
    border-radius: 999px;
    background: rgba(29, 29, 31, 0.06);
    color: #3a3a3c;
    display: inline-flex;
    font-size: var(--text-xs);
    font-weight: var(--weight-strong);
    line-height: var(--leading-solid);
    padding: var(--space-1) var(--space-2);
}

.json-render-badge-blue {
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
}

.json-render-badge-green {
    background: rgba(5, 150, 105, 0.12);
    color: #047857;
}

.json-render-badge-amber {
    background: rgba(217, 119, 6, 0.12);
    color: #a16207;
}

.json-render-badge-red {
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
}

.json-render-chart-title {
    color: #1d1d1f;
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
    line-height: var(--leading-ui);
    margin: var(--space-0) var(--space-0) var(--space-2);
}

.json-render-bars {
    display: grid;
    gap: var(--space-2);
}

.json-render-bar-row {
    align-items: center;
    display: grid;
    gap: var(--space-2);
    grid-template-columns: minmax(62px, 0.8fr) minmax(90px, 1.4fr) auto;
}

.json-render-bar-label,
.json-render-bar-value {
    color: #515154;
    font-size: var(--text-xs);
    line-height: var(--leading-tight);
}

.json-render-bar-value {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.json-render-bar-track,
.json-render-progress-track {
    border-radius: 999px;
    background: rgba(29, 29, 31, 0.08);
    display: block;
    height: 8px;
    overflow: hidden;
}

.json-render-bar-fill,
.json-render-progress-track span {
    border-radius: inherit;
    display: block;
    height: 100%;
}

.json-render-line-svg {
    display: block;
    height: auto;
    overflow: visible;
    width: 100%;
}

.json-render-line-labels {
    color: #636366;
    display: flex;
    font-size: var(--text-2xs);
    justify-content: space-between;
    line-height: var(--leading-tight);
    margin-top: var(--space-1-5);
}

.json-render-progress-top {
    align-items: center;
    color: #515154;
    display: flex;
    font-size: var(--text-xs);
    justify-content: space-between;
    margin-bottom: var(--space-1-5);
}

.json-render-progress-top strong {
    color: #1d1d1f;
    font-variant-numeric: tabular-nums;
}

.json-render-progress-track span {
    background: #2563eb;
}

.json-render-table-wrap {
    margin: var(--space-0);
    overflow-x: auto;
}

.json-render-table-wrap figcaption {
    color: #636366;
    font-size: var(--text-xs);
    margin-bottom: var(--space-1-5);
}

.json-render-table {
    border-collapse: collapse;
    font-size: var(--text-xs);
    width: 100%;
}

.json-render-table th,
.json-render-table td {
    border-bottom: 1px solid rgba(29, 29, 31, 0.08);
    padding: var(--space-1-5) var(--space-2);
    text-align: left;
    vertical-align: top;
}

.json-render-table th {
    color: #515154;
    font-weight: var(--weight-bold);
}

.json-render-table td {
    color: #1d1d1f;
}

.json-render-separator {
    border: 0;
    border-top: 1px solid rgba(29, 29, 31, 0.1);
    margin: var(--space-0-5) var(--space-0);
}

.reader-message.is-loading p {
    color: #8e8e93;
    font-style: italic;
}

.reader-thread-list {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: var(--space-2);
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--space-px) var(--space-0-5) var(--space-1);
    scrollbar-gutter: stable;
    scrollbar-width: thin;
}

.reader-thread-item {
    position: relative;
    width: 100%;
    appearance: none;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.64);
    color: #3a3a3c;
    cursor: pointer;
    display: grid;
    gap: var(--space-1);
    padding: var(--space-2-5) var(--space-2-5) var(--space-2-5) var(--space-3);
    text-align: left;
    transition: background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.reader-thread-item:hover,
.reader-thread-item.active {
    background: rgba(255, 255, 255, 0.92);
    box-shadow:
        0 0 0 1px rgba(29, 29, 31, 0.09),
        0 1px 2px rgba(29, 29, 31, 0.04);
}

.reader-thread-item.active::before {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 0;
    width: 2px;
    border-radius: 999px;
    background: rgba(183, 111, 55, 0.62);
}

.reader-thread-item:active {
    transform: scale(0.96);
}

.reader-thread-quote {
    color: #6e6e73;
    display: -webkit-box;
    font-family: var(--font-serif);
    font-size: var(--text-sm);
    line-height: var(--leading-copy);
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.reader-thread-title {
    color: #1d1d1f;
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    line-height: var(--leading-ui);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reader-thread-meta {
    color: #8e8e93;
    font-size: var(--text-xs);
    line-height: var(--leading-tight);
    font-variant-numeric: tabular-nums;
}

.reader-empty-state {
    color: #8e8e93;
    font-size: var(--text-sm);
    padding: var(--space-2-5) var(--space-0-5) var(--space-0-5);
    text-align: center;
}

.reader-empty-state p {
    margin: var(--space-0);
}

.revision-summary {
    margin: var(--space-0) var(--space-0) var(--space-3-5);
    padding: var(--space-3);
    background: rgba(255, 250, 242, 0.72);
    border-radius: 8px;
    box-shadow:
        inset 0 0 0 1px rgba(29, 29, 31, 0.055),
        inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.revision-summary-title {
    color: #232522;
    font-size: var(--text-sm);
    font-weight: var(--weight-strong);
    line-height: var(--leading-snug);
    margin-bottom: var(--space-1);
}

.revision-summary p {
    color: #666d65;
    font-size: var(--text-sm);
    line-height: var(--leading-copy);
    margin: var(--space-0);
    text-wrap: pretty;
}

.revision-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-1-5);
    margin-top: var(--space-2-5);
}

.revision-stat {
    display: flex;
    align-items: baseline;
    gap: var(--space-1);
    min-width: 0;
    color: #70776f;
    font-size: var(--text-xs);
    line-height: var(--leading-tight);
    padding: var(--space-2) var(--space-2);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.48);
    box-shadow: inset 0 0 0 1px rgba(29, 29, 31, 0.045);
    font-variant-numeric: tabular-nums;
}

.revision-stat strong {
    color: #242823;
    font-size: var(--text-md);
    font-weight: var(--weight-strong);
}

.revision-quiet-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-1-5);
    margin-top: var(--space-2-5);
}

.revision-quiet-item {
    display: grid;
    grid-template-columns: 7px 1fr;
    gap: var(--space-2);
    align-items: start;
    color: #777e76;
    font-size: var(--text-xs);
    line-height: var(--leading-ui);
}

.revision-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    margin-top: var(--space-1);
    background: #b9bdb6;
}

.revision-resolved {
    color: #5f7e62;
}

.revision-changed {
    color: #8a6f3d;
}

.revision-still_open {
    color: #8c6258;
}

.revision-new {
    color: #5f6f88;
}

.revision-obsolete {
    color: #777e76;
}

.revision-dot.revision-resolved {
    background: #8fab8e;
}

.revision-dot.revision-obsolete {
    background: #b9bdb6;
}

.problem-group {
    margin-bottom: var(--space-4);
}

.problem-group-header {
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
    padding: var(--space-1-5) var(--space-2);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: #8e8e93;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.problem-group-header:hover {
    background: rgba(0, 0, 0, 0.03);
}

.problem-group-header .expand-icon {
    font-size: var(--text-2xs);
    transition: transform 0.2s ease;
}

.problem-group.collapsed .expand-icon {
    transform: rotate(-90deg);
}

.problem-group.collapsed .problem-group-items {
    display: none;
}

.problem-group-count {
    margin-left: auto;
    font-weight: var(--weight-regular);
}

.problem-item {
    padding: var(--space-2-5) var(--space-3);
    margin: var(--space-1) var(--space-0) var(--space-1) var(--space-4);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.problem-item-topline {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: var(--space-1-5);
}

.problem-status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    border-radius: 999px;
    background: rgba(29, 29, 31, 0.045);
    box-shadow: inset 0 0 0 1px rgba(29, 29, 31, 0.045);
    color: #6f766e;
    font-size: var(--text-2xs);
    font-weight: var(--weight-strong);
    line-height: var(--leading-solid);
    padding: var(--space-1) var(--space-2);
    text-transform: uppercase;
    letter-spacing: var(--tracking-label);
}

.problem-status-pill.revision-resolved {
    background: rgba(106, 140, 103, 0.1);
    color: #5f7e62;
}

.problem-status-pill.revision-still_open {
    background: rgba(145, 91, 76, 0.09);
    color: #8c6258;
}

.problem-status-pill.revision-changed {
    background: rgba(145, 117, 58, 0.1);
    color: #8a6f3d;
}

.problem-status-pill.revision-new {
    background: rgba(90, 107, 136, 0.1);
    color: #5f6f88;
}

.problem-status-pill.revision-obsolete {
    background: rgba(110, 118, 108, 0.09);
    color: #777e76;
}

.problem-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.problem-item.unlinked {
    border-left-color: #d1d1d6;
    cursor: default;
}

.problem-item.unlinked .problem-text::after {
    content: "Not highlighted";
    display: block;
    margin-top: var(--space-1-5);
    color: #8e8e93;
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-style: normal;
}

.problem-item.active {
    background: rgba(0, 0, 0, 0.05);
    border-left-color: #c7c7cc;
}

.problem-text {
    font-size: var(--text-md);
    color: #3a3a3c;
    line-height: var(--leading-copy);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

.problem-location {
    font-size: var(--text-xs);
    color: #8e8e93;
    margin-top: var(--space-1);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-10) var(--space-5);
    color: #8e8e93;
}

.empty-state p {
    margin-bottom: var(--space-2);
}

.empty-state .hint {
    font-size: var(--text-md);
    font-style: italic;
}

/* Annotation Detail Panel */
.annotation-detail {
    display: none;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.annotation-detail.show {
    display: flex;
}

.problems-list.hidden {
    display: none;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 0 0 auto;
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: 54px;
    padding: var(--space-2-5) var(--space-4);
    background: rgba(251, 249, 247, 0.94);
    backdrop-filter: blur(14px);
    box-shadow: inset 0 -1px rgba(0, 0, 0, 0.06);
}

.back-to-list-btn {
    background: none;
    border: none;
    color: #8e8e93;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-md);
    min-height: 36px;
    padding: var(--space-1-5) var(--space-2);
    border-radius: 6px;
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.back-to-list-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1d1d1f;
}

.detail-type {
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: #6e6e73;
    text-transform: uppercase;
    letter-spacing: var(--tracking-label);
}

.detail-content {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    min-height: 0;
    padding: var(--space-4-5) var(--space-4-5) var(--space-7);
}

.feedback-detail {
    display: grid;
    gap: var(--space-4-5);
    color: #2c2c2f;
}

.feedback-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1-5);
}

.feedback-meta span {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: rgba(29, 29, 31, 0.055);
    color: #6e6e73;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-label);
    padding: var(--space-1) var(--space-2);
    text-transform: uppercase;
}

.feedback-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.feedback-action-btn {
    position: relative;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    appearance: none;
    border: none;
    border-radius: 999px;
    background: rgba(29, 29, 31, 0.07);
    color: #2f332d;
    cursor: pointer;
    padding: var(--space-0);
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.feedback-action-btn::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 999px;
}

.feedback-action-btn:hover {
    background: rgba(29, 29, 31, 0.11);
    color: #1d1d1f;
}

.feedback-action-btn:active {
    transform: scale(0.96);
}

.feedback-excerpt {
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.54);
    padding: var(--space-3) var(--space-3-5);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.055);
}

.feedback-section-label,
.feedback-section h4 {
    color: #8a8a8f;
    font-size: var(--text-xs);
    font-weight: var(--weight-strong);
    letter-spacing: var(--tracking-caps);
    line-height: var(--leading-tight);
    margin: var(--space-0) var(--space-0) var(--space-2);
    text-transform: uppercase;
}

.feedback-excerpt p {
    color: #2c2c2f;
    font-family: var(--font-serif);
    font-size: var(--text-readable);
    line-height: var(--leading-prose);
    margin: var(--space-0);
    text-wrap: pretty;
}

.feedback-revision-note {
    border-radius: 8px;
    background: rgba(255, 250, 242, 0.68);
    padding: var(--space-3) var(--space-3-5);
    box-shadow:
        inset 0 0 0 1px rgba(29, 29, 31, 0.055),
        inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

.feedback-revision-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1-5);
    align-items: center;
}

.feedback-revision-note p {
    color: #3f443f;
    font-size: var(--text-md);
    line-height: var(--leading-prose);
    margin: var(--space-2-5) var(--space-0) var(--space-0);
    text-wrap: pretty;
}

.feedback-section {
    padding-top: var(--space-0-5);
}

.feedback-section + .feedback-section,
.feedback-excerpt + .feedback-section {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding-top: var(--space-4-5);
}

.feedback-section p {
    color: #343437;
    font-size: var(--text-base);
    line-height: var(--leading-prose);
    margin: var(--space-0);
    text-wrap: pretty;
}

.feedback-questions {
    display: grid;
    gap: var(--space-2-5);
}

.feedback-question {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: var(--space-2-5);
}

.feedback-question-index {
    color: #9a9a9f;
    font-size: var(--text-xs);
    font-variant-numeric: tabular-nums;
    font-weight: var(--weight-strong);
    line-height: var(--leading-prose);
}

.feedback-question p {
    color: #333336;
    font-size: var(--text-base);
    font-style: normal;
    line-height: var(--leading-prose);
    margin: var(--space-0);
}

.feedback-warning {
    color: #7a5c34;
}

/* ─────────────────────────────────────────────────────────────
   Responsive: Collapse Sidebars on Narrow Screens
   ───────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .documents-sidebar {
        width: 0;
        min-width: 0;
        opacity: 0;
        overflow: hidden;
    }

    .documents-sidebar.show {
        width: 220px;
        min-width: 220px;
        opacity: 1;
    }

    .problems-sidebar {
        width: var(--problems-sidebar-width, 340px);
        min-width: var(--problems-sidebar-width, 340px);
    }
}

@media (max-width: 768px) {
    .desk-topbar {
        left: 18px;
        right: 18px;
        top: 18px;
        flex-direction: column;
        gap: var(--space-3-5);
    }

    .desk-actions {
        width: 100%;
    }

    .desk-layout-toggle {
        margin-right: auto;
    }

    .desk-action-btn {
        flex: 1;
    }

    .desk-canvas {
        inset: 136px 12px 0;
        overflow-y: auto;
        padding: var(--space-7) var(--space-1) var(--space-14);
        touch-action: pan-y;
    }

    .desk-arranged-rows {
        gap: var(--space-7);
        justify-content: flex-start;
        padding: var(--space-0);
    }

    .desk-arranged-row-papers {
        flex-direction: column;
        gap: var(--space-6);
        overflow: visible;
        padding: var(--space-0);
    }

    .desk-arranged-row-label {
        width: min(calc(100% - 24px), 320px);
        margin: var(--space-0) auto;
    }

    .desk-paper {
        position: relative;
        left: auto !important;
        top: auto !important;
        width: min(calc(100% - 24px), 320px);
        min-height: 210px;
        margin: var(--space-0) auto var(--space-6);
        transform: rotate(0deg);
    }

    .desk-paper:hover,
    .desk-paper:focus-visible,
    .desk-paper.bundle-peeked,
    .desk-paper.bundle-peeked:hover,
    .desk-paper.bundle-peeked:focus-visible {
        transform: translateY(-6px) scale(1.01);
    }

    .problems-sidebar {
        position: fixed;
        right: 0;
        top: 60px;
        bottom: 0;
        width: min(var(--problems-sidebar-width, 360px), calc(100vw - 24px));
        min-width: 0;
        height: auto;
        z-index: 100;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    .problems-sidebar-resize-handle {
        display: none;
    }

    .problems-sidebar.show {
        transform: translateX(0);
    }

    .sidebar-reveal-right {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .problems-sidebar.show + .sidebar-reveal-right {
        display: none;
    }

    .editor-main {
        padding: var(--space-5) var(--space-5) var(--space-25);
    }
}

/* Context Properties - Notion Style */
.context-properties {
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* Clarke Header */
.clarke-header {
    align-items: center;
    display: flex;
    justify-content: flex-start;
    gap: var(--space-2-5);
    margin-bottom: var(--space-6);
    width: 100%;
}

.document-heading {
    display: grid;
    gap: var(--space-1);
    min-width: 0;
}

.document-heading-kicker {
    color: #8e8e93;
    font-size: var(--text-xs);
    font-weight: var(--weight-strong);
    letter-spacing: var(--tracking-caps);
    line-height: var(--leading-solid);
    text-transform: uppercase;
}

.document-heading-title {
    color: #1d1d1f;
    font-family: var(--font-sans-structured);
    font-size: var(--text-base);
    font-weight: var(--weight-strong);
    letter-spacing: var(--tracking-none);
    line-height: var(--leading-snug);
    margin: var(--space-0);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-source-strip {
    align-items: center;
    color: #8e8e93;
    display: flex;
    flex-wrap: wrap;
    font-size: var(--text-xs);
    gap: var(--space-1-5);
    line-height: var(--leading-snug);
    min-width: 0;
}

.document-source-strip a {
    color: #3a3a3c;
    text-decoration: none;
}

.document-source-strip a:hover {
    color: #007aff;
}

.document-source-strip > span + span::before {
    content: "·";
    margin-right: var(--space-1-5);
}

.reader-import-prompt {
    align-items: center;
    background: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    gap: var(--space-0);
    margin: calc(var(--space-1) * -1) var(--space-0) var(--space-7);
    max-width: 820px;
    min-height: 32px;
    padding: var(--space-1) var(--space-0) var(--space-4);
    transition: border-color 0.16s ease;
}

.reader-import-prompt:focus-within {
    border-color: rgba(29, 29, 31, 0.22);
}

.reader-import-prompt[hidden] {
    display: none;
}

.reader-import-prompt label {
    color: #8e8e93;
    cursor: default;
    flex: 0 0 80px;
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
}

.reader-import-prompt input {
    background: transparent;
    border-radius: 4px;
    border: none;
    color: #1d1d1f;
    flex: 1;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-tight);
    min-height: 24px;
    min-width: 0;
    outline: none;
    padding: var(--space-1) var(--space-2);
    transition: background-color 0.16s ease, color 0.16s ease;
}

.reader-import-prompt input::placeholder {
    color: #c7c7cc;
    font-style: italic;
}

.reader-import-prompt input:hover,
.reader-import-prompt input:focus {
    background: rgba(0, 0, 0, 0.05);
}

.reader-import-prompt button {
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #8e8e93;
    cursor: pointer;
    flex: 0 0 auto;
    font-size: var(--text-sm);
    font-weight: var(--weight-strong);
    margin-left: var(--space-2);
    min-height: 28px;
    padding: var(--space-1) var(--space-2);
    position: relative;
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.reader-import-prompt button::after {
    content: "";
    inset: -6px;
    position: absolute;
}

.reader-import-prompt button:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1d1d1f;
}

.reader-import-prompt button:active {
    transform: scale(0.96);
}

.context-row {
    display: flex;
    align-items: center;
    min-height: 32px;
    padding: var(--space-1) var(--space-0);
    transition: background-color 0.16s ease;
}

.context-row:hover {
    background: rgba(0, 0, 0, 0.02);
}

.context-label {
    width: 80px;
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    color: #8e8e93;
    flex-shrink: 0;
    cursor: default;
}

.context-value {
    flex: 1;
    min-height: 24px;
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-base);
    color: #1d1d1f;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.16s ease, color 0.16s ease;
    position: relative;
}

.context-value:empty::before {
    content: attr(data-placeholder);
    color: #c7c7cc;
    font-style: italic;
}

.context-value:hover {
    background: rgba(0, 0, 0, 0.05);
}

.context-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: calc(var(--space-4-5) * -1) var(--space-0) var(--space-6);
}

.context-suggestion-btn {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    color: #3a3a3c;
    cursor: pointer;
    font-size: var(--text-sm);
    padding: var(--space-1) var(--space-2-5);
    transition: all 0.2s ease;
}

.context-suggestion-btn:hover {
    background: rgba(0, 0, 0, 0.07);
    color: #1d1d1f;
}

.context-suggestion-dismiss {
    background: none;
    border: none;
    color: #8e8e93;
    cursor: pointer;
    font-size: var(--text-sm);
    padding: var(--space-1) var(--space-0-5);
}

.context-suggestion-dismiss:hover {
    color: #1d1d1f;
}



/* Analysis Controls - Fixed Position, Always Visible */
.analysis-controls {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    align-items: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.analysis-controls.disabled .reanalyze-btn {
    opacity: 0.4;
    pointer-events: none;
}

.analysis-controls .reanalyze-btn {
    transition: background-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, opacity 0.18s ease, color 0.18s ease;
}

.analysis-controls:not(.disabled) .review-disabled-hint {
    opacity: 0;
    transform: translateY(-2px);
}

.review-disabled-hint {
    color: #8e8e93;
    font-size: var(--text-sm);
    font-style: italic;
    line-height: var(--leading-solid);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.reanalyze-btn {
    background: rgba(255, 255, 255, 0.95);
    color: #1d1d1f;
    border: none;
    padding: var(--space-3) var(--space-5);
    border-radius: 24px;
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-width: 112px;
    backdrop-filter: blur(20px);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.08),
        0 4px 20px rgba(0, 0, 0, 0.1);
}

.reanalyze-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.1),
        0 8px 25px rgba(0, 0, 0, 0.15);
}

.reanalyze-btn:active {
    transform: translateY(-1px) scale(0.96);
}

.reanalyze-btn.is-loading,
.reanalyze-btn:disabled {
    cursor: progress;
}

.reanalyze-btn.is-loading {
    min-width: 128px;
}

.reanalyze-btn.is-loading:hover,
.reanalyze-btn:disabled:hover {
    transform: none;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.08),
        0 4px 20px rgba(0, 0, 0, 0.1);
}

.review-spinner {
    display: none;
    position: relative;
    width: 14px;
    height: 14px;
    border-radius: 2px;
    flex: 0 0 14px;
    image-rendering: pixelated;
}

.review-spinner::before,
.review-spinner::after {
    content: "";
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 1px;
}

.review-spinner::before {
    left: 1px;
    top: 2px;
    background: #1d1d1f;
    box-shadow:
        5px 0 #5c7e73,
        10px 0 #1d1d1f,
        0 5px #d07b5e,
        5px 5px #1d1d1f,
        10px 5px #5c7e73,
        0 10px #1d1d1f,
        5px 10px #d07b5e,
        10px 10px #1d1d1f;
    animation: reviewButtonPixels 1.1s steps(1, end) infinite;
}

.review-spinner::after {
    right: 1px;
    bottom: 1px;
    background: #d07b5e;
    animation: reviewButtonCursor 0.75s steps(1, end) infinite;
}

.reanalyze-btn.is-loading .review-spinner {
    display: block;
}

.reanalyze-icon {
    font-size: var(--text-lg);
    animation: none;
    opacity: 0.7;
}

.reanalyze-btn:hover .reanalyze-icon {
    animation: spin 1s linear infinite;
    opacity: 1;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes reviewButtonPixels {
    0%, 100% {
        opacity: 1;
        transform: translateY(0);
    }

    50% {
        opacity: 0.42;
        transform: translateY(1px);
    }
}

@keyframes reviewButtonCursor {
    0%, 45% {
        opacity: 1;
    }

    46%, 100% {
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .review-spinner::before,
    .review-spinner::after {
        animation: none;
    }
}

/* Writing Canvas */
.writing-canvas {
    margin-bottom: var(--space-6);
    position: relative;
}

.reader-editor-toolbar {
    align-items: center;
    display: flex;
    justify-content: flex-end;
    position: absolute;
    right: 0;
    top: -2px;
    z-index: 3;
}

.reader-editor-toolbar[hidden] {
    display: none;
}

.app-container.reader-mode.reader-editing .reader-editor-toolbar {
    margin-bottom: calc((var(--space-8) + var(--space-0-5)) * -1);
    pointer-events: none;
    position: sticky;
    right: auto;
    top: 18px;
    z-index: 80;
}

.app-container.reader-mode.reader-editing .reader-edit-toggle {
    pointer-events: auto;
}

.reader-edit-toggle,
.reader-send-icon-btn,
.reader-annotation-close {
    align-items: center;
    appearance: none;
    border: none;
    color: #8e8e93;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    transition: background-color 0.16s ease, color 0.16s ease, opacity 0.16s ease, transform 0.16s ease;
}

.reader-edit-toggle {
    background: rgba(255, 255, 255, 0.86);
    border-radius: 999px;
    box-shadow:
        0 0 0 1px rgba(29, 29, 31, 0.08),
        0 8px 22px rgba(29, 29, 31, 0.08);
    gap: var(--space-2);
    height: 34px;
    min-width: 72px;
    padding: var(--space-0) var(--space-3) var(--space-0) var(--space-2-5);
}

.reader-edit-toggle:hover {
    background: #fff;
    color: #1d1d1f;
    box-shadow:
        0 0 0 1px rgba(29, 29, 31, 0.12),
        0 10px 26px rgba(29, 29, 31, 0.12);
}

.reader-edit-toggle.active {
    background: #1d1d1f;
    color: #fff;
    box-shadow:
        0 0 0 1px rgba(29, 29, 31, 0.16),
        0 12px 30px rgba(29, 29, 31, 0.18);
}

.reader-edit-toggle:active,
.reader-send-icon-btn:active,
.reader-annotation-close:active {
    transform: scale(0.96);
}

.reader-edit-toggle-icon {
    display: inline-flex;
    position: relative;
}

.reader-edit-toggle-icon-done {
    display: none;
}

.reader-edit-toggle.active .reader-edit-toggle-icon-edit {
    display: none;
}

.reader-edit-toggle.active .reader-edit-toggle-icon-done {
    display: inline-flex;
}

.reader-edit-toggle-label {
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
    line-height: var(--leading-solid);
    white-space: nowrap;
}

.reader-annotation-popover {
    position: fixed;
    z-index: 1200;
    width: min(340px, calc(100vw - 24px));
    border-radius: 10px;
    background: rgba(255, 254, 250, 0.96);
    box-shadow:
        0 0 0 1px rgba(29, 29, 31, 0.11),
        0 18px 46px rgba(29, 29, 31, 0.16);
    backdrop-filter: blur(18px);
    isolation: isolate;
    animation: readerPopoverIn 0.16s cubic-bezier(0.2, 0, 0, 1);
}

.reader-annotation-popover::before {
    content: "";
    position: absolute;
    top: var(--reader-arrow-top, 28px);
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: inherit;
    pointer-events: none;
}

.reader-annotation-popover[data-placement="right"]::before {
    left: -5px;
    box-shadow: -1px 1px 0 rgba(29, 29, 31, 0.085);
    transform: translateY(-50%) rotate(45deg);
}

.reader-annotation-popover[data-placement="left"]::before {
    right: -5px;
    box-shadow: 1px -1px 0 rgba(29, 29, 31, 0.085);
    transform: translateY(-50%) rotate(45deg);
}

.reader-annotation-popover[data-placement="floating"]::before {
    display: none;
}

.reader-annotation-popover[hidden] {
    display: none;
}

.reader-annotation-form {
    display: grid;
    gap: var(--space-2-5);
    padding: var(--space-2-5);
}

.reader-annotation-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    line-height: var(--leading-solid);
}

.reader-annotation-chip {
    border-radius: 999px;
    background: rgba(29, 29, 31, 0.055);
    color: #6e6e73;
    font-size: var(--text-2xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-caps);
    padding: var(--space-1) var(--space-2);
    text-transform: uppercase;
}

.reader-annotation-close {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    background: transparent;
}

.reader-annotation-close:hover {
    background: rgba(29, 29, 31, 0.055);
    color: #1d1d1f;
}

.reader-annotation-target {
    margin: var(--space-0);
    color: #6e6e73;
    display: -webkit-box;
    font-family: var(--font-sans-structured);
    font-size: var(--text-xs);
    line-height: var(--leading-copy);
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    padding: var(--space-0) var(--space-0-5);
}

.reader-annotation-input-shell {
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow:
        0 0 0 1px rgba(29, 29, 31, 0.08),
        0 8px 20px rgba(29, 29, 31, 0.06);
}

.reader-annotation-input-shell:focus-within {
    background: rgba(255, 255, 255, 0.98);
    box-shadow:
        0 0 0 1px rgba(29, 29, 31, 0.14),
        0 10px 24px rgba(29, 29, 31, 0.08);
}

.reader-annotation-form textarea {
    min-height: 74px;
    max-height: 140px;
    font-size: var(--text-md);
    padding: var(--space-3) var(--space-3) var(--space-2-5);
}

.reader-annotation-form .reader-composer-bar {
    min-height: 44px;
    padding: var(--space-1-5) var(--space-2);
}

.reader-send-icon-btn {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: #0a84ff;
    color: #ffffff;
    box-shadow:
        0 8px 18px rgba(10, 132, 255, 0.24),
        inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.reader-send-icon-btn:hover {
    background: #0074e8;
    box-shadow:
        0 10px 22px rgba(10, 132, 255, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.reader-annotation-form .reader-send-icon-btn {
    width: 34px;
    height: 34px;
}

.reader-send-icon-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    box-shadow: none;
}

@keyframes readerPopoverIn {
    from {
        opacity: 0;
        transform: translateY(4px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.reader-media-selected {
    outline: 2px solid rgba(29, 29, 31, 0.38);
    outline-offset: 3px;
}

.text-editor .reader-anchor-highlight {
    border-radius: 3px;
    background: rgba(29, 29, 31, 0.085);
    cursor: pointer;
    box-shadow: inset 0 -1px rgba(29, 29, 31, 0.18);
    transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

.text-editor .reader-anchor-highlight:hover,
.text-editor .reader-anchor-highlight:focus-visible {
    background: rgba(183, 111, 55, 0.11);
    box-shadow:
        inset 0 -1px rgba(183, 111, 55, 0.36),
        0 0 0 1px rgba(183, 111, 55, 0.12);
    outline: none;
}

.text-editor .reader-anchor-highlight-active {
    background: rgba(183, 111, 55, 0.14);
    box-shadow: inset 0 -1px rgba(183, 111, 55, 0.34);
}

.text-editor .reader-anchor-highlight-current {
    background: rgba(183, 111, 55, 0.2);
    box-shadow:
        inset 0 -1px rgba(183, 111, 55, 0.44),
        0 0 0 1px rgba(183, 111, 55, 0.12);
}

.text-editor .reader-anchor-highlight-jump {
    animation: readerAnchorPulse 1.35s ease;
}

img.reader-anchor-highlight-jump,
table.reader-anchor-highlight-jump,
figure.reader-anchor-highlight-jump {
    animation: readerMediaAnchorPulse 1.35s ease;
}

@keyframes readerAnchorPulse {
    0% {
        box-shadow:
            inset 0 -1px rgba(183, 111, 55, 0.44),
            0 0 0 1px rgba(183, 111, 55, 0.14);
    }

    42% {
        box-shadow:
            inset 0 -1px rgba(183, 111, 55, 0.64),
            0 0 0 5px rgba(183, 111, 55, 0.18);
    }

    100% {
        box-shadow:
            inset 0 -1px rgba(183, 111, 55, 0.34),
            0 0 0 0 rgba(183, 111, 55, 0);
    }
}

@keyframes readerMediaAnchorPulse {
    0% {
        outline: 2px solid rgba(183, 111, 55, 0.36);
        outline-offset: 3px;
    }

    42% {
        outline: 3px solid rgba(183, 111, 55, 0.6);
        outline-offset: 7px;
    }

    100% {
        outline: 2px solid rgba(183, 111, 55, 0);
        outline-offset: 3px;
    }
}

.app-container.reader-mode .context-properties,
.app-container.reader-mode .context-suggestions,
.app-container.reader-mode .analysis-controls {
    display: none;
}

.app-container.reader-mode .editor-main {
    padding-bottom: var(--space-16);
}

.app-container.reader-mode .text-editor {
    padding-top: var(--space-1-5);
}

.app-container.reader-mode:not(.reader-editing) .text-editor .ProseMirror {
    cursor: text;
}

.text-editor {
    min-height: 400px;
    padding: var(--space-6) var(--space-0);
    font-family: var(--font-serif);
    font-size: var(--text-xl);
    line-height: var(--leading-loose);
    color: #1d1d1f;
    outline: none;
    background: transparent;
    position: relative;
}

.text-editor:empty::before {
    content: attr(data-placeholder);
    color: #8e8e93;
    font-style: italic;
    pointer-events: none;
}

.text-editor .ProseMirror {
    min-height: 400px;
    outline: none;
}

.text-editor .ProseMirror p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    color: #8e8e93;
    float: left;
    font-style: italic;
    height: 0;
    pointer-events: none;
}

.app-container.reader-mode .text-editor .ProseMirror p.is-editor-empty:first-child::before {
    content: 'Paste the text you want to read here.';
}

.text-editor p {
    margin-bottom: var(--space-4);
    white-space: pre-wrap;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.text-editor p:last-child {
    margin-bottom: var(--space-0);
}

.text-editor h1,
.text-editor h2,
.text-editor h3,
.text-editor h4 {
    font-family: var(--font-serif);
    font-weight: var(--weight-medium);
    line-height: var(--leading-snug);
    margin: var(--space-6) var(--space-0) var(--space-3);
    text-wrap: balance;
}

.text-editor h1 {
    font-size: var(--text-display);
}

.text-editor h2 {
    font-size: var(--text-3xl);
}

.text-editor h3 {
    font-size: var(--text-2xl);
}

.text-editor h4 {
    font-size: var(--text-xl);
}

.text-editor strong,
.text-editor b {
    font-weight: var(--weight-bold);
}

.text-editor em,
.text-editor i {
    font-style: italic;
}

.text-editor code {
    padding: var(--space-px) var(--space-1);
    border-radius: 4px;
    background: rgba(29, 29, 31, 0.06);
    font-family: var(--font-mono);
    font-size: var(--text-code-inline);
}

.text-editor pre {
    margin: var(--space-4-5) var(--space-0);
    padding: var(--space-3-5) var(--space-4);
    border-radius: 8px;
    background: rgba(29, 29, 31, 0.045);
    box-shadow: inset 0 0 0 1px rgba(29, 29, 31, 0.08);
    overflow-x: auto;
    white-space: pre-wrap;
}

.text-editor pre code {
    padding: var(--space-0);
    background: transparent;
    border-radius: 0;
    font-size: var(--text-base);
    line-height: var(--leading-prose);
}

.text-editor table {
    width: 100%;
    margin: var(--space-5) var(--space-0);
    border-collapse: collapse;
    font-family: var(--font-sans-structured);
    font-size: var(--text-base);
    line-height: var(--leading-copy);
}

.text-editor .tableWrapper {
    overflow-x: auto;
}

.text-editor th,
.text-editor td {
    padding: var(--space-2-5) var(--space-2-5);
    border: 1px solid rgba(29, 29, 31, 0.12);
    vertical-align: top;
}

.text-editor th {
    background: rgba(29, 29, 31, 0.055);
    font-weight: var(--weight-strong);
}

.text-editor tr:nth-child(even) td {
    background: rgba(29, 29, 31, 0.025);
}

.text-editor hr {
    height: 1px;
    margin: var(--space-7) var(--space-0);
    border: 0;
    background: rgba(29, 29, 31, 0.14);
}

.graph-block {
    margin: var(--space-6) var(--space-0);
    padding: var(--space-3-5);
    border: 1px solid rgba(29, 29, 31, 0.12);
    border-radius: 8px;
    background: #fbfbfa;
    font-family: var(--font-sans-structured);
}

.graph-block-header {
    margin-bottom: var(--space-2-5);
    color: #515154;
    font-size: var(--text-sm);
    font-weight: var(--weight-strong);
    letter-spacing: var(--tracking-none);
    text-transform: uppercase;
}

.graph-block-preview {
    min-height: 80px;
    overflow-x: auto;
    padding: var(--space-3);
    border-radius: 6px;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(29, 29, 31, 0.08);
}

.graph-block-preview svg {
    display: block;
    max-width: 100%;
    height: auto;
    margin: var(--space-0) auto;
}

.graph-block-preview.has-error {
    min-height: 0;
    color: #7a2e2e;
    background: #fff8f7;
}

.graph-block-error {
    font-size: var(--text-md);
}

.graph-block-source {
    margin: var(--space-3) var(--space-0) var(--space-0);
    max-height: 180px;
}

.text-editor img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: var(--space-5) var(--space-0);
    border-radius: 8px;
    box-shadow: 0 0 0 1px rgba(29, 29, 31, 0.1);
}

.text-editor .tiptap-mathematics-render {
    color: #1d1d1f;
}

.text-editor span.tiptap-mathematics-render {
    display: inline-flex;
    vertical-align: -0.15em;
}

.text-editor div.tiptap-mathematics-render {
    margin: var(--space-4-5) var(--space-0);
    padding: var(--space-3) var(--space-4);
    overflow-x: auto;
    border-radius: 8px;
    background: rgba(29, 29, 31, 0.035);
    box-shadow: inset 0 0 0 1px rgba(29, 29, 31, 0.08);
}

.text-editor .inline-math-error,
.text-editor .block-math-error {
    color: #7a2e2e;
    font-family: var(--font-mono);
}

.text-editor [data-type="details"] {
    position: relative;
    margin: var(--space-5) var(--space-0);
    padding: var(--space-3) var(--space-3-5) var(--space-3) var(--space-10);
    border: 1px solid rgba(29, 29, 31, 0.12);
    border-radius: 8px;
    background: #fbfbfa;
}

.text-editor .details-toggle {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    padding: var(--space-0);
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #515154;
    cursor: pointer;
    font: 700 12px/1 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.text-editor .details-toggle:hover {
    background: rgba(29, 29, 31, 0.07);
}

.text-editor .clarke-details-summary {
    font-family: var(--font-sans-structured);
    font-size: var(--text-base);
    font-weight: var(--weight-strong);
    line-height: var(--leading-copy);
}

.text-editor .clarke-details-content {
    margin-top: var(--space-3);
}

.text-editor .mention {
    padding: var(--space-px) var(--space-1);
    border-radius: 5px;
    background: rgba(49, 95, 125, 0.1);
    color: #315f7d;
    font-family: var(--font-sans-structured);
    font-size: var(--text-code-inline);
    font-weight: var(--weight-strong);
    white-space: nowrap;
}

.text-editor ul,
.text-editor ol {
    margin: var(--space-0) var(--space-0) var(--space-4) var(--space-6);
    padding: var(--space-0);
}

.text-editor li {
    margin: var(--space-1-5) var(--space-0);
    padding-left: var(--space-1);
    white-space: pre-wrap;
}

.text-editor blockquote {
    margin: var(--space-4-5) var(--space-0);
    padding-left: var(--space-4-5);
    color: #515154;
    box-shadow: inset 2px 0 0 rgba(29, 29, 31, 0.16);
    white-space: pre-wrap;
}

.text-editor a {
    color: #315f7d;
    text-decoration-color: rgba(49, 95, 125, 0.35);
    text-underline-offset: 3px;
}

/* Annotations */
.annotation {
    position: relative;
    cursor: pointer;
    transition: background 120ms ease, box-shadow 120ms ease, transform 120ms ease;
    border-radius: 2px;
    padding: var(--space-px) var(--space-0-5);
    margin: var(--space-0) calc(var(--space-0-5) * -1);
}

.annotation:hover {
    transform: translateY(-1px);
}

.text-editor .annotation.block-annotation {
    display: block;
    outline: 2px solid rgba(183, 111, 55, 0.42);
    outline-offset: 4px;
    border-radius: 8px;
    border-bottom: 0;
    background: rgba(183, 111, 55, 0.06);
    box-shadow: none;
}

.text-editor img.annotation.block-annotation,
.text-editor table.annotation.block-annotation {
    display: block;
}

.text-editor .annotation.block-annotation.highlighted {
    outline-color: rgba(183, 111, 55, 0.9);
    background: rgba(183, 111, 55, 0.12);
}

/* Pastel annotation colors - soft and harmonious */
.grammar-annotation {
    background: rgba(232, 180, 180, 0.35);
    border-bottom: 1px dotted #c9a0a0;
}

.clarity-annotation {
    background: rgba(232, 210, 170, 0.35);
    border-bottom: 1px dotted #c9b090;
}

.tone-annotation {
    background: rgba(210, 190, 220, 0.35);
    border-radius: 3px;
}

.confidence-annotation {
    background: rgba(180, 210, 190, 0.35);
    border-bottom: 1px dotted #a0c0a8;
}

.structure-annotation {
    background: rgba(180, 200, 220, 0.35);
    border-left: 2px solid #a0b8c8;
    padding-left: var(--space-1);
    margin-left: calc(var(--space-0-5) * -1);
}

.evidence-annotation {
    background: rgba(230, 220, 180, 0.35);
    border-bottom: 1px dotted #c9c0a0;
}

.jargon-annotation {
    background: rgba(220, 180, 195, 0.35);
    border-radius: 3px;
}

.repetition-annotation {
    background: rgba(190, 190, 215, 0.35);
    border-bottom: 1px dotted #a8a8c8;
}

/* Analysis Status */
.analysis-status {
    text-align: center;
    color: #8e8e93;
    font-size: var(--text-base);
    font-style: italic;
    opacity: 0;
    min-height: 0;
    display: flex;
    justify-content: center;
    transition-property: opacity;
    transition-duration: 0.3s;
    transition-timing-function: ease;
}

.analysis-status.show {
    opacity: 1;
}

/* Main Content Layout */
.main-content {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Inspector Sidebar */
.inspector-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 0;
    min-width: 0;
    background: #fbf9f7;
    border-left: 1px solid rgba(0, 0, 0, 0.06);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
}

.inspector-sidebar.show {
    width: 380px;
    min-width: 380px;
}

.inspector-header {
    padding: var(--space-6) var(--space-8) var(--space-4);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inspector-header h3 {
    font-size: var(--text-lg);
    font-weight: var(--weight-medium);
    color: #8e8e93;
    letter-spacing: var(--tracking-none);
}

.inspector-toggle {
    background: none;
    border: none;
    font-size: var(--text-lg);
    color: #c7c7cc;
    cursor: pointer;
    padding: var(--space-1);
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inspector-toggle:hover {
    color: #8e8e93;
}

.inspector-sidebar.show .toggle-icon {
    transform: rotate(180deg);
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.inspector-content {
    flex: 1;
    padding: var(--space-0) var(--space-8) var(--space-8);
    overflow-y: auto;
    overflow-x: hidden;
    line-height: var(--leading-prose);
    /* Enable smooth scrolling */
    scroll-behavior: smooth;
    /* Custom scrollbar styling for better aesthetics */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.inspector-content::-webkit-scrollbar {
    width: 6px;
}

.inspector-content::-webkit-scrollbar-track {
    background: transparent;
}

.inspector-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.inspector-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.inspector-questions h4 {
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    margin-bottom: var(--space-5);
    color: #8e8e93;
    letter-spacing: var(--tracking-none);
}

.inspector-questions ul {
    list-style: none;
    margin-bottom: var(--space-10);
}

.inspector-questions li {
    margin-bottom: var(--space-4);
    padding-left: var(--space-3);
    position: relative;
    color: #1d1d1f;
    line-height: var(--leading-loose);
    font-size: var(--text-readable);
}

.inspector-questions li::before {
    content: "·";
    position: absolute;
    left: 0;
    color: #c7c7cc;
    font-size: var(--text-lg);
}

.inspector-suggestion {
    margin-top: var(--space-2);
}

.suggestion-toggle {
    background: none;
    border: none;
    color: #8e8e93;
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
    cursor: pointer;
    padding: var(--space-0);
    margin-bottom: var(--space-4);
    transition: color 0.2s ease;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 2px;
}

.suggestion-toggle:hover {
    color: #1d1d1f;
    text-decoration-color: #c7c7cc;
}

.suggestion-content {
    display: none;
    margin-left: var(--space-3);
    font-style: italic;
    color: #3a3a3c;
    line-height: var(--leading-loose);
    font-size: var(--text-readable);
    margin-bottom: var(--space-8);
}

.suggestion-content.show {
    display: block;
}

/* Rewrite Section */
.rewrite-section {
    margin-top: var(--space-6);
}

.rewrite-btn {
    background: none;
    color: #8e8e93;
    border: none;
    padding: var(--space-0);
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
    cursor: pointer;
    transition: color 0.2s ease;
    margin-bottom: var(--space-4);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 2px;
}

.rewrite-btn:hover:not(:disabled) {
    color: #1d1d1f;
    text-decoration-color: #c7c7cc;
}

.rewrite-btn:disabled {
    color: #c7c7cc;
    cursor: not-allowed;
    text-decoration: none;
}

.rewrite-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.rewrite-option {
    margin-left: var(--space-3);
}

.rewrite-text {
    font-weight: var(--weight-regular);
    color: #1d1d1f;
    margin-bottom: var(--space-2);
    font-style: italic;
    line-height: var(--leading-loose);
    font-size: var(--text-readable);
}

.rewrite-rationale {
    font-size: var(--text-base);
    color: #8e8e93;
    margin-bottom: var(--space-3);
    line-height: var(--leading-prose);
}

.apply-rewrite-btn {
    background: none;
    color: #8e8e93;
    border: none;
    padding: var(--space-0);
    font-size: var(--text-md);
    font-weight: var(--weight-regular);
    cursor: pointer;
    transition: color 0.2s ease;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 2px;
}

.apply-rewrite-btn:hover {
    color: #1d1d1f;
    text-decoration-color: #c7c7cc;
}

.error {
    color: #ff3b30;
    font-style: italic;
}

/* Context Field Input */
.context-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    font: inherit;
    color: #1d1d1f;
    padding: var(--space-0);
    position: relative;
    z-index: 2;
}

.context-input::placeholder {
    color: #c7c7cc;
    font-style: italic;
}

/* Ghost text effect for autocomplete */
.context-ghost-text {
    position: absolute;
    left: 8px;
    top: 4px;
    color: #c7c7cc;
    font: inherit;
    pointer-events: none;
    z-index: 1;
    display: none;
}

/* Context Dropdown - Notion Style */
.context-dropdown {
    position: fixed;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    min-width: 200px;
}

.context-dropdown.show {
    display: block;
}

.context-options {
    padding: var(--space-1) var(--space-0);
}

.context-option {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-base);
    color: #1d1d1f;
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.context-option:hover,
.context-option.selected {
    background: rgba(0, 0, 0, 0.05);
}

.context-option.highlighted {
    background: #007aff;
    color: white;
}

/* Overview Panel */
.overview-panel {
    position: fixed;
    bottom: 20px;
    left: 20px;
    max-width: 320px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0px;
    padding: var(--space-5);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    display: none;
    z-index: 800;
    transition: all 0.3s ease;
}

.overview-panel.show {
    display: block;
    animation: slideInUp 0.3s ease;
}

.overview-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.overview-close-btn {
    background: none;
    border: none;
    font-size: var(--text-xl);
    color: #8e8e93;
    cursor: pointer;
    padding: var(--space-1);
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.overview-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1d1d1f;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.overview-panel h2 {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--space-2);
    color: #1d1d1f;
}

.overview-content {
    font-size: var(--text-base);
    line-height: var(--leading-prose);
    color: #3a3a3c;
}

/* Delete Confirmation */
.delete-confirm-panel {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(251, 249, 247, 0.58);
    backdrop-filter: blur(4px);
}

.delete-confirm-panel.show {
    display: flex;
}

.delete-confirm-panel.anchored {
    background: transparent;
    backdrop-filter: none;
}

.delete-confirm-panel.anchored .delete-confirm-content {
    max-height: calc(100vh - 24px);
    overflow-y: auto;
}

.delete-confirm-content {
    width: 320px;
    max-width: calc(100vw - 40px);
    background: rgba(251, 249, 247, 0.98);
    border-radius: 10px;
    padding: var(--space-4-5);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.07),
        0 14px 34px rgba(0, 0, 0, 0.14);
}

.delete-confirm-content h2 {
    color: #1d1d1f;
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    margin: var(--space-0) var(--space-0) var(--space-2);
    text-wrap: balance;
}

.delete-confirm-content p {
    color: #6e6e73;
    font-size: var(--text-md);
    line-height: var(--leading-copy);
    margin: var(--space-0);
    text-wrap: pretty;
}

.delete-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

/* Article Import Panel */
.article-import-panel {
    align-items: center;
    background: rgba(251, 249, 247, 0.58);
    backdrop-filter: blur(4px);
    display: none;
    inset: 0;
    justify-content: center;
    position: fixed;
    z-index: 1180;
}

.article-import-panel.show {
    animation: fadeIn 0.18s ease;
    display: flex;
}

.article-import-panel.anchored {
    background: transparent;
    backdrop-filter: none;
}

.article-import-panel.anchored .article-import-content {
    max-height: calc(100vh - 24px);
    overflow-y: auto;
}

.article-import-content {
    background: rgba(251, 249, 247, 0.98);
    border-radius: 10px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.07),
        0 18px 42px rgba(0, 0, 0, 0.15);
    max-width: calc(100vw - 36px);
    overflow: hidden;
    width: 520px;
}

.article-import-header {
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: space-between;
    padding: var(--space-3-5) var(--space-4) var(--space-2-5);
}

.article-import-header h2 {
    color: #8e8e93;
    font-size: var(--text-sm);
    font-weight: var(--weight-strong);
    letter-spacing: var(--tracking-label);
    margin: var(--space-0);
    text-transform: uppercase;
}

.article-import-form {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-3-5) var(--space-4) var(--space-2-5);
}

.article-import-form input {
    background: rgba(255, 253, 249, 0.72);
    border: none;
    border-radius: 7px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.07);
    color: #1d1d1f;
    flex: 1;
    font-size: var(--text-md);
    min-height: 36px;
    min-width: 0;
    outline: none;
    padding: var(--space-0) var(--space-2-5);
    transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

.article-import-form input:focus {
    background: #fffdf9;
    box-shadow:
        inset 0 0 0 1px rgba(0, 122, 255, 0.36),
        0 0 0 3px rgba(0, 122, 255, 0.08);
}

.article-import-status {
    color: #8e8e93;
    font-size: var(--text-sm);
    min-height: 18px;
    padding: var(--space-0) var(--space-4) var(--space-2);
}

.article-import-status.is-error {
    color: #b42318;
}

.article-import-preview {
    padding: var(--space-0) var(--space-4) var(--space-4);
}

.article-import-card {
    background: #fffdf9;
    border-radius: 8px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.07);
    overflow: hidden;
}

.article-import-card-main {
    display: grid;
    gap: var(--space-2);
    padding: var(--space-3-5);
}

.article-import-source {
    color: #007aff;
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-label);
    line-height: var(--leading-solid);
    text-transform: uppercase;
}

.article-import-card h3 {
    color: #1d1d1f;
    font-size: var(--text-lg);
    font-weight: var(--weight-strong);
    letter-spacing: var(--tracking-none);
    line-height: var(--leading-snug);
    margin: var(--space-0);
    text-wrap: balance;
}

.article-import-meta,
.article-import-excerpt {
    color: #6e6e73;
    font-size: var(--text-md);
    line-height: var(--leading-copy);
    margin: var(--space-0);
    text-wrap: pretty;
}

.article-import-warnings {
    display: grid;
    gap: var(--space-1);
    margin-top: var(--space-1);
}

.article-import-warnings span {
    background: rgba(255, 149, 0, 0.1);
    border-radius: 6px;
    color: #7a4a00;
    font-size: var(--text-sm);
    line-height: var(--leading-ui);
    padding: var(--space-2) var(--space-2);
}

.article-import-actions {
    align-items: center;
    background: rgba(0, 0, 0, 0.025);
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
    padding: var(--space-2-5);
}

/* Settings Panel */
.settings-panel {
    position: fixed;
    top: 18px;
    left: 238px;
    width: 340px;
    max-width: calc(100vw - 40px);
    background: rgba(251, 249, 247, 0.98);
    backdrop-filter: blur(18px);
    border-radius: 10px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.07),
        0 12px 32px rgba(0, 0, 0, 0.11);
    display: none;
    z-index: 1100;
}

.settings-panel.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.app-container.desk-mode .settings-panel {
    left: auto;
    right: 32px;
    top: 78px;
}

.settings-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3-5) var(--space-4) var(--space-2-5);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.settings-panel-header h2 {
    color: #8e8e93;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--tracking-label);
    margin: var(--space-0);
    text-transform: uppercase;
}

.settings-close-btn {
    background: none;
    border: none;
    color: #8e8e93;
    cursor: pointer;
    font-size: var(--text-xl);
    line-height: var(--leading-solid);
    padding: var(--space-0-5) var(--space-1-5);
}

.settings-close-btn:hover {
    color: #1d1d1f;
}

.settings-content {
    padding: var(--space-3-5) var(--space-4) var(--space-4);
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1-5);
    margin-bottom: var(--space-3);
    position: relative;
}

.settings-field > span {
    color: #6e6e73;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
}

.settings-account {
    align-items: center;
    background: rgba(255, 255, 255, 0.58);
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.07);
    display: flex;
    gap: var(--space-3);
    justify-content: space-between;
    margin-bottom: var(--space-3);
    min-height: 52px;
    padding: var(--space-2-5);
}

.settings-account-label {
    color: #6e6e73;
    display: block;
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    letter-spacing: 0;
    margin-bottom: var(--space-0-5);
    text-transform: uppercase;
}

.settings-account strong {
    color: #1d1d1f;
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-account-actions {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    gap: var(--space-1);
}

.settings-field input,
.settings-field select {
    width: 100%;
    background: rgba(255, 255, 255, 0.68);
    border: none;
    border-radius: 6px;
    color: #1d1d1f;
    font: inherit;
    font-size: var(--text-md);
    padding: var(--space-2) var(--space-2-5);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.settings-field input:focus,
.settings-field select:focus {
    outline: none;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22);
}

.settings-field select.native-select-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    padding: var(--space-0);
    margin: var(--space-0);
    box-shadow: none;
}

.custom-select {
    position: relative;
    width: 100%;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2-5);
    width: 100%;
    min-height: 34px;
    appearance: none;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.68);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
    color: #1d1d1f;
    cursor: pointer;
    font: inherit;
    font-size: var(--text-md);
    line-height: var(--leading-snug);
    padding: var(--space-2) var(--space-8) var(--space-2) var(--space-2-5);
    position: relative;
    text-align: left;
    transition: background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.custom-select-trigger:hover {
    background: rgba(255, 255, 255, 0.84);
}

.custom-select-trigger:focus-visible,
.custom-select.open .custom-select-trigger {
    outline: none;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22);
}

.custom-select-trigger:active {
    transform: scale(0.96);
}

.custom-select-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.custom-select-icon {
    position: absolute;
    right: 11px;
    top: 50%;
    width: 15px;
    height: 15px;
    color: #8e8e93;
    transform: translateY(-50%);
    transition: transform 0.18s cubic-bezier(0.2, 0, 0, 1), color 0.16s ease;
}

.custom-select.open .custom-select-icon {
    color: #555a54;
    transform: translateY(-50%) rotate(180deg);
}

.custom-select-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 5px);
    z-index: 30;
    max-height: 218px;
    overflow-y: auto;
    padding: var(--space-1);
    background: rgba(255, 250, 242, 0.98);
    border-radius: 8px;
    backdrop-filter: blur(16px);
    box-shadow:
        inset 0 0 0 1px rgba(29, 29, 31, 0.07),
        inset 0 1px 0 rgba(255, 255, 255, 0.58),
        0 14px 34px rgba(49, 52, 46, 0.14);
}

.custom-select-option {
    display: block;
    width: 100%;
    min-height: 30px;
    appearance: none;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: #30342f;
    cursor: pointer;
    font: inherit;
    font-size: var(--text-md);
    line-height: var(--leading-snug);
    padding: var(--space-2) var(--space-2);
    text-align: left;
    transition: background-color 0.14s ease, color 0.14s ease;
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
    outline: none;
    background: rgba(42, 46, 40, 0.055);
}

.custom-select-option.selected {
    background: rgba(42, 46, 40, 0.075);
    color: #171a16;
    font-weight: var(--weight-semibold);
}

.model-custom-input {
    margin-top: var(--space-2);
}

.model-custom-input.hidden {
    display: none;
}

.settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: var(--space-3-5) var(--space-0) var(--space-2-5);
}

.settings-action-btn,
.version-panel-btn,
.version-action-btn {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 6px;
    color: #3a3a3c;
    cursor: pointer;
    font-size: var(--text-sm);
    min-height: 30px;
    padding: var(--space-1-5) var(--space-2-5);
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.settings-action-btn:hover,
.version-panel-btn:hover,
.version-action-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1d1d1f;
}

.settings-action-btn:active,
.version-panel-btn:active,
.version-action-btn:active {
    transform: scale(0.96);
}

.settings-action-btn.secondary,
.version-action-btn.secondary {
    background: transparent;
}

.settings-action-btn.danger {
    background: rgba(180, 35, 24, 0.08);
    color: #b42318;
}

.settings-action-btn.danger:hover {
    background: rgba(180, 35, 24, 0.12);
    color: #8f1d14;
}

.version-action-btn.danger:hover {
    color: #ff3b30;
}

.version-action-btn.primary {
    background: rgba(36, 40, 35, 0.88);
    color: #fffdf8;
}

.version-action-btn.primary:hover {
    background: rgba(36, 40, 35, 0.96);
    color: #fffdf8;
}

.settings-note {
    color: #8e8e93;
    font-size: var(--text-sm);
    line-height: var(--leading-copy);
    text-wrap: pretty;
}

body.clarke-extension-live-active {
    background: #fffdf9;
    overflow: hidden;
}

body.clarke-extension-companion {
    background: #fffdf9;
    overflow: hidden;
}

body.clarke-extension-live-active .app-container {
    display: none;
}

body.clarke-extension-companion .app-container {
    display: none;
}

.extension-live-panel {
    position: fixed;
    top: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 1200;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    width: min(420px, calc(100vw - 24px));
    min-height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: rgba(255, 253, 249, 0.98);
    box-shadow:
        inset 0 0 0 1px rgba(29, 29, 31, 0.08),
        0 24px 70px rgba(43, 45, 40, 0.22);
}

.extension-live-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3-5);
    padding: var(--space-3-5) var(--space-3-5) var(--space-3);
    border-bottom: 1px solid rgba(29, 29, 31, 0.07);
}

.extension-live-header h2 {
    margin: var(--space-0-5) var(--space-0) var(--space-0);
    color: #20221f;
    font-size: var(--text-readable);
    font-weight: var(--weight-strong);
    line-height: var(--leading-snug);
    overflow-wrap: anywhere;
}

.extension-live-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1-5);
    margin-top: var(--space-2-5);
}

.extension-live-icon-btn {
    position: relative;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    appearance: none;
    border: none;
    border-radius: 999px;
    background: rgba(29, 29, 31, 0.055);
    color: #5f665d;
    cursor: pointer;
    padding: var(--space-0);
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.extension-live-icon-btn::before {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 999px;
}

.extension-live-icon-btn:hover {
    background: rgba(29, 29, 31, 0.09);
    color: #20221f;
}

.extension-live-icon-btn.danger {
    color: #9b3c2c;
}

.extension-live-icon-btn.danger:hover {
    background: rgba(180, 35, 24, 0.09);
    color: #7a261a;
}

.extension-live-icon-btn:active {
    transform: scale(0.96);
}

.extension-live-kicker {
    color: #72786f;
    font-size: var(--text-2xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-caps);
    line-height: var(--leading-tight);
    text-transform: uppercase;
}

.extension-live-close {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    appearance: none;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #757b73;
    cursor: pointer;
    font-size: var(--text-2xl);
    line-height: var(--leading-solid);
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.extension-live-close:hover {
    background: rgba(29, 29, 31, 0.06);
    color: #1d1d1f;
}

.extension-live-close:active {
    transform: scale(0.94);
}

.extension-live-source {
    display: grid;
    gap: var(--space-2-5);
    max-height: 220px;
    overflow: auto;
    padding: var(--space-3) var(--space-3-5);
    border-bottom: 1px solid rgba(29, 29, 31, 0.06);
    background: rgba(247, 244, 238, 0.58);
}

.extension-live-source.notebook {
    gap: var(--space-3);
    max-height: min(46vh, 420px);
    padding: var(--space-3-5);
}

.extension-live-source img {
    display: block;
    width: 100%;
    max-height: 160px;
    object-fit: contain;
    border-radius: 6px;
    background: #ece8df;
}

.extension-live-source p {
    margin: var(--space-0);
    color: #4c5049;
    font-family: var(--font-serif);
    font-size: var(--text-md);
    line-height: var(--leading-prose);
    overflow-wrap: anywhere;
}

.extension-live-context-meta {
    color: #72786f;
    font-size: var(--text-2xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-caps);
    line-height: var(--leading-tight);
    text-transform: uppercase;
}

.extension-live-note-list {
    display: grid;
    gap: var(--space-1-5);
    padding-top: var(--space-0-5);
}

.extension-live-note-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    color: #72786f;
    font-size: var(--text-2xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-caps);
    line-height: var(--leading-tight);
    text-transform: uppercase;
}

.extension-live-note-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--space-2);
    align-items: center;
    width: 100%;
    appearance: none;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: inset 0 0 0 1px rgba(29, 29, 31, 0.07);
    color: #252923;
    cursor: pointer;
    padding: var(--space-2) var(--space-2-5);
    text-align: left;
    transition: background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.extension-live-note-item:hover,
.extension-live-note-item.active {
    background: rgba(255, 248, 224, 0.9);
    box-shadow: inset 0 0 0 1px rgba(155, 113, 33, 0.22);
}

.extension-live-note-item:active {
    transform: translateY(1px);
}

.extension-live-note-text {
    overflow: hidden;
    font-size: var(--text-sm);
    line-height: var(--leading-ui);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.extension-live-note-meta,
.extension-live-note-empty {
    color: #72786f;
    font-size: var(--text-xs);
    line-height: var(--leading-ui);
}

.extension-live-note-empty {
    border-radius: 6px;
    background: rgba(29, 29, 31, 0.035);
    padding: var(--space-2) var(--space-2-5);
}

.extension-live-source.notebook .extension-live-note-list {
    gap: var(--space-2);
}

.extension-live-source.notebook .extension-live-note-item {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-1);
    padding: var(--space-2-5);
}

.extension-live-source.notebook .extension-live-note-text {
    display: -webkit-box;
    font-size: var(--text-md);
    line-height: var(--leading-ui);
    overflow: hidden;
    text-overflow: initial;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.extension-live-source.notebook .extension-live-note-meta {
    font-size: var(--text-2xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
}

.extension-live-messages {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--space-3-5);
}

.extension-live-message {
    display: grid;
    gap: var(--space-1);
    margin-bottom: var(--space-3);
    padding: var(--space-2-5) var(--space-2-5);
    border-radius: 8px;
    background: rgba(29, 29, 31, 0.045);
}

.extension-live-message.user {
    background: rgba(76, 86, 66, 0.1);
}

.extension-live-message.is-loading {
    width: fit-content;
    min-width: 78px;
}

.extension-live-message p {
    margin: var(--space-0);
    color: #252923;
    font-size: var(--text-md);
    line-height: var(--leading-copy);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.extension-live-role {
    color: #72786f;
    font-size: var(--text-2xs);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-caps);
    line-height: var(--leading-tight);
    text-transform: uppercase;
}

.extension-live-thinking {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    height: 18px;
}

.extension-live-thinking span {
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: #8e8e93;
    opacity: 0.36;
    animation: extensionThinkingPulse 1.05s ease-in-out infinite;
}

.extension-live-thinking span:nth-child(2) {
    animation-delay: 0.14s;
}

.extension-live-thinking span:nth-child(3) {
    animation-delay: 0.28s;
}

.extension-live-empty,
.extension-live-error,
.extension-live-status {
    border-radius: 8px;
    color: #72786f;
    font-size: var(--text-md);
    line-height: var(--leading-copy);
    padding: var(--space-3);
    background: rgba(29, 29, 31, 0.04);
}

.extension-live-error {
    color: #9b2f22;
    background: rgba(180, 35, 24, 0.08);
}

.extension-live-status {
    color: #3f6f40;
    background: rgba(57, 139, 71, 0.1);
}

.extension-live-form {
    padding: var(--space-3);
    border-top: 1px solid rgba(29, 29, 31, 0.07);
    background: rgba(255, 253, 249, 0.98);
}

.extension-live-composer-shell {
    border-radius: 14px;
    box-shadow:
        0 0 0 1px rgba(29, 29, 31, 0.08),
        0 10px 28px rgba(29, 29, 31, 0.07);
}

.extension-live-composer-shell textarea {
    min-height: 86px;
    max-height: 156px;
    font-size: var(--text-md);
    padding: var(--space-3-5) var(--space-3-5) var(--space-3);
}

.extension-live-composer-bar {
    min-height: 46px;
    gap: var(--space-2);
    justify-content: space-between;
    padding: var(--space-1-5) var(--space-2) var(--space-1-5) var(--space-2-5);
}

.extension-live-save-btn {
    appearance: none;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #6e6e73;
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: var(--weight-strong);
    line-height: var(--leading-solid);
    padding: var(--space-2) var(--space-2-5);
    transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.extension-live-save-btn:hover {
    background: rgba(29, 29, 31, 0.055);
    color: #1d1d1f;
}

.extension-live-save-btn:active {
    transform: scale(0.97);
}

.extension-live-composer-bar .reader-send-icon-btn {
    width: 34px;
    height: 34px;
}

body.clarke-extension-live-active .extension-live-panel {
    inset: 0;
    width: auto;
    border-radius: 0;
    box-shadow: none;
}

body.clarke-extension-live-active .extension-live-header {
    padding-top: var(--space-3);
}

@keyframes extensionThinkingPulse {
    0%,
    80%,
    100% {
        opacity: 0.28;
        transform: translateY(0);
    }

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

/* Responsive Design */
@media (max-width: 768px) {
    .writing-container {
        padding: var(--space-10) var(--space-5) var(--space-25);
        /* Add bottom padding for fixed button */
        margin-right: var(--space-0) !important;
        /* Override sidebar margin on mobile */
    }

    .main-content {
        flex-direction: column;
    }

    .inspector-sidebar {
        position: fixed;
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        min-width: 100%;
        height: 0;
        min-height: 0;
        border-left: none;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
        transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1), min-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .inspector-sidebar.show {
        height: 50vh;
        min-height: 300px;
    }

    .analysis-controls {
        bottom: 20px;
        left: 20px;
        right: 20px;
        transform: none;
        justify-content: center;
    }

    .reanalyze-btn {
        flex: 1;
        max-width: 200px;
        justify-content: center;
    }

    .context-tags {
        gap: var(--space-1-5);
    }

    .tag,
    .tag-placeholder {
        font-size: var(--text-md);
        padding: var(--space-1) var(--space-2-5);
    }

    .text-editor {
        font-size: var(--text-lg);
    }

    .api-key-section {
        align-items: stretch;
        flex-direction: column;
        margin: calc(var(--space-1) * -1) var(--space-0) var(--space-6);
        flex-wrap: wrap;
    }

    .api-key-copy {
        min-width: 0;
    }

    #apiKeyInput {
        width: 100%;
    }

    .settings-panel {
        top: 20px;
        left: 20px;
    }

    .article-import-content {
        max-height: calc(100vh - 32px);
        overflow-y: auto;
        width: calc(100vw - 28px);
    }

    .article-import-form {
        align-items: stretch;
        flex-direction: column;
    }

    .article-import-actions {
        justify-content: stretch;
    }

    .article-import-actions .settings-action-btn {
        flex: 1;
    }

    .extension-live-panel {
        inset: 10px;
        width: auto;
    }

    .extension-live-composer-bar {
        gap: var(--space-1-5);
    }

    .overview-panel {
        position: relative;
        bottom: auto;
        left: auto;
        margin: var(--space-5);
        max-width: none;
    }
}

/* Smooth Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.annotation {
    animation: fadeIn 0.3s ease;
}

.tag {
    animation: slideIn 0.2s ease;
}

/* Version History Modal */
.version-modal {
    position: fixed;
    max-width: 280px;
    background: #fbf9f7;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 0px;
    padding: var(--space-6) var(--space-8) var(--space-8);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    display: none;
    z-index: 800;
    transition: all 0.3s ease;
}

.version-modal.show {
    display: block;
    animation: slideInUp 0.3s ease;
}

.version-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-5);
}

.version-modal-header h2 {
    font-size: var(--text-lg);
    font-weight: var(--weight-medium);
    color: #8e8e93;
    letter-spacing: var(--tracking-none);
    margin: var(--space-0);
}

.version-close-btn {
    background: none;
    border: none;
    font-size: var(--text-lg);
    color: #c7c7cc;
    cursor: pointer;
    padding: var(--space-1);
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.version-close-btn:hover {
    color: #8e8e93;
}

.version-content {
    line-height: var(--leading-prose);
    max-height: 300px;
    overflow-y: auto;
    /* Custom scrollbar styling to match sidebar */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.version-content::-webkit-scrollbar {
    width: 6px;
}

.version-content::-webkit-scrollbar-track {
    background: transparent;
}

.version-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.version-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.no-versions {
    color: #8e8e93;
    font-style: italic;
    margin-top: var(--space-10);
    font-size: var(--text-readable);
    line-height: var(--leading-loose);
}

.version-list {
    list-style: none;
    margin: var(--space-0);
    padding: var(--space-0);
}

.version-item {
    margin-bottom: var(--space-6);
    cursor: pointer;
    transition: all 0.2s ease;
}

.version-item:last-child {
    margin-bottom: var(--space-0);
}

.version-item:hover {
    transform: translateX(2px);
}

.version-item.current {
    position: relative;
}

.version-item.current::before {
    content: "·";
    position: absolute;
    left: -12px;
    color: #c7c7cc;
    font-size: var(--text-lg);
}

.version-header {
    margin-bottom: var(--space-1);
}

.version-time {
    font-weight: var(--weight-medium);
    color: #1d1d1f;
    font-size: var(--text-readable);
    line-height: var(--leading-loose);
}

.current-badge {
    color: #8e8e93;
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
    font-style: italic;
    margin-left: var(--space-2);
}

.version-stats {
    font-size: var(--text-base);
    color: #8e8e93;
    margin-bottom: var(--space-2);
    line-height: var(--leading-prose);
}

.version-actions {
    margin-top: var(--space-2);
}

.restore-btn {
    background: none;
    border: none;
    color: #8e8e93;
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
    cursor: pointer;
    padding: var(--space-0);
    transition: color 0.2s ease;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 2px;
}

.restore-btn:hover {
    color: #1d1d1f;
    text-decoration-color: #c7c7cc;
}

/* Versions button in analysis controls */
.versions-btn {
    background: none;
    color: #8e8e93;
    border: none;
    padding: var(--space-0);
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
    cursor: pointer;
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
    margin-left: var(--space-4);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 2px;
}

.versions-btn:hover {
    color: #1d1d1f;
    text-decoration-color: #c7c7cc;
}

.versions-btn svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.versions-btn:hover svg {
    opacity: 1;
}

.analysis-controls {
    display: flex;
    align-items: center;
}

/* Clarke Question Styles - harmonized with grey palette */
.question-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin: var(--space-2) var(--space-0);
    padding: var(--space-2);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    border-left: 3px solid #b0b0b0;
}

.question-mark {
    color: #8e8e93;
    font-weight: var(--weight-bold);
    font-size: var(--text-lg);
    margin-top: var(--space-0-5);
    flex-shrink: 0;
}

.question-text {
    color: #3a3a3c;
    font-style: italic;
    line-height: var(--leading-prose);
}

.audience-impact {
    margin-top: var(--space-3);
    padding: var(--space-2-5);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    border-left: 3px solid #c7c7cc;
}

.audience-impact h5 {
    color: #8e8e93;
    font-size: var(--text-md);
    font-weight: var(--weight-medium);
    margin-bottom: var(--space-1);
}

.audience-impact p {
    color: #3a3a3c;
    font-size: var(--text-base);
    line-height: var(--leading-prose);
}

.thinking-prompt {
    margin-top: var(--space-3);
    padding: var(--space-2-5);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    border-left: 3px solid #c7c7cc;
}

.thinking-prompt h5 {
    color: #8e8e93;
    font-size: var(--text-md);
    font-weight: var(--weight-medium);
    margin-bottom: var(--space-1);
}

.thinking-prompt p {
    color: #3a3a3c;
    font-size: var(--text-base);
    line-height: var(--leading-prose);
}

/* Clarke annotation colors - pastel palette */
.word-choice-annotation,
.word_choice-annotation,
.word_interrogation-annotation {
    background: rgba(232, 210, 170, 0.4);
    border-bottom: 2px solid #d4c4a0;
}

.structural-decision-annotation,
.structural_decision-annotation,
.structure-annotation {
    background: rgba(180, 200, 220, 0.4);
    border-bottom: 2px solid #a8b8c8;
}

.tone-shift-annotation,
.tone_shift-annotation {
    background: rgba(210, 190, 220, 0.4);
    border-bottom: 2px solid #c0b0d0;
}

.logic-gap-annotation,
.logic_gap-annotation,
.logic_probe-annotation {
    background: rgba(232, 180, 180, 0.4);
    border-bottom: 2px solid #d0a8a8;
}

.strategic-framing-annotation,
.strategic_framing-annotation,
.purpose_drift-annotation {
    background: rgba(220, 180, 195, 0.4);
    border-bottom: 2px solid #c8a0b0;
}

.audience-mismatch-annotation,
.audience_mismatch-annotation,
.audience_disconnect-annotation {
    background: rgba(230, 200, 175, 0.4);
    border-bottom: 2px solid #d0b8a0;
}

.assumption_challenge-annotation {
    background: rgba(200, 195, 220, 0.4);
    border-bottom: 2px solid #b0a8c8;
}

.evidence_question-annotation {
    background: rgba(180, 210, 190, 0.4);
    border-bottom: 2px solid #a0c0a8;
}

.contradiction_flag-annotation {
    background: rgba(232, 190, 180, 0.4);
    border-bottom: 2px solid #d0b0a0;
}

.clarity_probe-annotation {
    background: rgba(195, 210, 210, 0.4);
    border-bottom: 2px solid #a8c0c0;
}

.text-editor .annotation.block-annotation {
    border-bottom: 0;
    background: rgba(183, 111, 55, 0.06);
    box-shadow: none;
}

.text-editor .annotation:not(.block-annotation).highlighted {
    box-shadow: 0 0 0 2px rgba(29, 29, 31, 0.08);
}

/* Clarke inspector styles - harmonized grey palette */
.clarke-interrogation,
.virgil-interrogation {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    padding: var(--space-4);
    margin: var(--space-3) var(--space-0);
}

.question-item.primary {
    border-left: 3px solid #a0a0a0;
    padding-left: var(--space-3);
    margin-bottom: var(--space-3);
}

.question-item.consequence {
    border-left: 3px solid #b8b8b8;
    padding-left: var(--space-3);
    margin-bottom: var(--space-3);
}

.question-item.strategic {
    border-left: 3px solid #c0c0c0;
    padding-left: var(--space-3);
    margin-bottom: var(--space-3);
}

.audience-lens {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    padding: var(--space-3);
    margin: var(--space-3) var(--space-0);
    border-left: 3px solid #c7c7cc;
}

.audience-lens h5 {
    color: #8e8e93;
    margin: var(--space-0) var(--space-0) var(--space-2) var(--space-0);
    font-size: var(--text-md);
    font-weight: var(--weight-medium);
}

.thinking-prompt {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    border-left: 3px solid #c7c7cc;
    padding: var(--space-3);
    margin: var(--space-3) var(--space-0);
}

.thinking-prompt h5 {
    color: #8e8e93;
    margin: var(--space-0) var(--space-0) var(--space-2) var(--space-0);
    font-size: var(--text-md);
    font-weight: var(--weight-medium);
}

/* ─────────────────────────────────────────────────────────────
   Additional IDE Styles
   ───────────────────────────────────────────────────────────── */

/* Delete document button */
.delete-doc-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #c7c7cc;
    font-size: var(--text-lg);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
    padding: var(--space-1) var(--space-2);
}

.document-item:hover .delete-doc-btn {
    opacity: 1;
}

.delete-doc-btn:hover {
    color: #ff3b30;
}

/* Detail original text */
.detail-original {
    font-family: var(--font-serif);
    font-size: var(--text-readable);
    line-height: var(--leading-prose);
    color: #1d1d1f;
    padding: var(--space-3) var(--space-4);
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    margin-bottom: var(--space-4);
    font-style: italic;
}

/* Highlighted annotation in editor */
.text-editor .annotation.highlighted:not(.block-annotation) {
    border-radius: 2px;
    box-shadow: 0 0 0 2px rgba(29, 29, 31, 0.08);
}

.text-editor .annotation.block-annotation.highlighted {
    outline-color: rgba(183, 111, 55, 0.9);
    background: rgba(183, 111, 55, 0.12);
    box-shadow: none;
}

/* Version Panel (Timeline) */
.history-pane {
    background: linear-gradient(180deg, rgba(255, 253, 249, 0.5), rgba(251, 249, 247, 0));
}

.history-pane-actions {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-3-5);
    border-top: 1px solid rgba(29, 29, 31, 0.045);
    border-bottom: 1px solid rgba(29, 29, 31, 0.06);
}

.version-preview-banner {
    display: grid;
    gap: var(--space-2-5);
    margin: var(--space-3) var(--space-3-5) var(--space-0);
    padding: var(--space-3);
    border-radius: 8px;
    background: rgba(255, 250, 242, 0.78);
    box-shadow:
        inset 0 0 0 1px rgba(29, 29, 31, 0.06),
        0 8px 22px rgba(40, 35, 28, 0.055);
}

.version-preview-banner[hidden] {
    display: none;
}

.version-preview-copy {
    display: grid;
    gap: var(--space-1);
}

.version-preview-copy strong {
    color: #232522;
    font-size: var(--text-sm);
    font-weight: var(--weight-strong);
}

.version-preview-copy span {
    color: #757b73;
    font-size: var(--text-sm);
    line-height: var(--leading-ui);
}

.version-preview-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1-5);
}

.version-timeline {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    min-height: 0;
    padding: var(--space-4) var(--space-3-5) var(--space-4-5);
}

/* Timeline nodes */
.version-node {
    position: relative;
    padding: var(--space-0) var(--space-0) var(--space-5) var(--space-6);
    cursor: pointer;
}

.version-node:last-child {
    padding-bottom: var(--space-0);
}

.version-node::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 6px;
    bottom: -14px;
    width: 1px;
    background: rgba(0, 0, 0, 0.1);
}

.version-node:last-child::before {
    display: none;
}

.version-node::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 4px;
    width: 10px;
    height: 10px;
    background: #c7c7cc;
    border-radius: 50%;
    transition: background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.version-node.current::after {
    background: #8e8e93;
    box-shadow: 0 0 0 3px rgba(142, 142, 147, 0.2);
}

.version-node.previewing::after {
    background: #687261;
    box-shadow: 0 0 0 4px rgba(104, 114, 97, 0.16);
    transform: scale(1.12);
}

.version-node:hover::after {
    background: #8e8e93;
}

.version-node-time {
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    color: #1d1d1f;
    margin-bottom: var(--space-0-5);
}

.version-node-pill {
    border-radius: 999px;
    background: rgba(29, 29, 31, 0.06);
    color: #757b73;
    font-size: var(--text-2xs);
    font-weight: var(--weight-strong);
    line-height: var(--leading-solid);
    padding: var(--space-1) var(--space-1-5);
    text-transform: uppercase;
    letter-spacing: var(--tracking-label);
}

.version-node-pill.viewing {
    background: rgba(104, 114, 97, 0.12);
    color: #596350;
}

.version-node-meta {
    font-size: var(--text-sm);
    color: #8e8e93;
}

.version-node-message {
    font-size: var(--text-md);
    color: #3a3a3c;
    margin-top: var(--space-1);
    font-style: italic;
}

.version-node-actions {
    margin-top: var(--space-1-5);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1-5);
}

.version-restore-btn {
    background: none;
    border: none;
    color: #8e8e93;
    font-size: var(--text-sm);
    cursor: pointer;
    padding: var(--space-0);
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: all 0.2s ease;
}

.version-restore-btn:hover {
    color: #1d1d1f;
    text-decoration-color: #c7c7cc;
}
