/* ── AbstractBuddy Design System v2 ── */
/* Palette: Forest Green + Warm Gold + Glassy Whites */

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

:root {
    --ab-dark:      #145A32;
    --ab-green:     #1B7A3E;
    --ab-vivid:     #22A050;
    --ab-light:     #5DCC80;
    --ab-mint:      #7EEEA0;
    --ab-gold:      #FFD34E;
    --ab-gold-deep: #E6A817;
    --ab-gold-btn:  linear-gradient(135deg, #FFD34E, #E6A817);
    --ab-sidebar:   linear-gradient(160deg, #145A32 0%, #1B7A3E 60%, #1E8A45 100%);
    --ab-btn-green: linear-gradient(135deg, #22A050, #145A32);
    --ab-bg:        #F2FBF4;
    --ab-surface:   #FFFFFF;
    --ab-border:    rgba(27, 122, 62, 0.12);
    --ab-border-md: rgba(27, 122, 62, 0.22);
    --ab-text:      #0D2818;
    --ab-muted:     #5A8A6A;
    --ab-muted-lt:  #8AB89A;
    --green-ok:     #059669;
    --red-err:      #DC2626;
    --amber-warn:   #D97706;
    --radius-sm:    6px;
    --radius-md:    10px;
    --radius-lg:    14px;
    --radius-xl:    20px;
    --shadow-sm:    0 1px 4px rgba(0,0,0,0.06);
    --shadow-md:    0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg:    0 8px 40px rgba(0,0,0,0.12);
    --sidebar-w:    210px;
    --topbar-h:     60px;
}

/* ── Base ── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--ab-bg);
    color: var(--ab-text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .page-title, .card-title, .brand-name {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
}

/* ── Layout ── */
.app-layout { display: flex; min-height: 100vh; }
.main-content { margin-left: var(--sidebar-w); flex: 1; padding-top: var(--topbar-h); }
.main-inner { padding: 28px 32px; max-width: 1200px; }

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--ab-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 18px 16px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-coin {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; }
.brand-name {
    color: var(--ab-mint);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.3px;
    line-height: 1.2;
}
.brand-tagline {
    color: rgba(255,255,255,0.35);
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-top: 1px;
}

.sidebar-nav { padding: 14px 10px; flex: 1; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(126,238,160,0.1); color: rgba(255,255,255,0.85); }
.nav-item--active { background: rgba(126,238,160,0.16); color: var(--ab-mint); }
.nav-item--logout { color: rgba(255,255,255,0.3); font-size: 12px; margin-top: 4px; }
.nav-item--logout:hover { color: rgba(255,255,255,0.6); background: rgba(255,255,255,0.05); }
.nav-item--logout-btn {
    width: 100%;
    background: transparent;
    border: 0;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}
.nav-icon { font-size: 15px; flex-shrink: 0; }

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.user-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(126,238,160,0.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
    color: var(--ab-mint);
    flex-shrink: 0;
}
.user-email { font-size: 11px; color: rgba(255,255,255,0.4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Top navbar ── */
.topbar {
    position: fixed;
    top: 0; left: var(--sidebar-w); right: 0;
    height: var(--topbar-h);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--ab-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 100;
}
.topbar-left { display: flex; flex-direction: column; }
.topbar-title { font-size: 16px; font-weight: 700; color: var(--ab-text); letter-spacing: -0.3px; }
.topbar-sub { font-size: 12px; color: var(--ab-muted); margin-top: 1px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ── Page header ── */
.page-header { margin-bottom: 24px; }
.page-title { font-size: 22px; font-weight: 800; color: var(--ab-text); letter-spacing: -0.5px; }
.page-subtitle { font-size: 13px; color: var(--ab-muted); margin-top: 3px; }

/* ── Cards ── */
.card {
    background: rgba(255,255,255,0.82);
    border: 1px solid var(--ab-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px 24px;
    margin-bottom: 16px;
    backdrop-filter: blur(8px);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--ab-border);
}
.card-title { font-size: 15px; font-weight: 700; color: var(--ab-text); }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
    font-family: inherit;
}
.btn--primary {
    background: var(--ab-btn-green);
    color: white;
    box-shadow: 0 4px 12px rgba(34,160,80,0.3);
}
.btn--primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(34,160,80,0.35); }

.btn--gold {
    background: var(--ab-gold-btn);
    color: var(--ab-dark);
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(255,211,78,0.3);
}
.btn--gold:hover { opacity: 0.9; transform: translateY(-1px); }

.btn--ghost {
    background: rgba(255,255,255,0.7);
    color: var(--ab-muted);
    border: 1px solid var(--ab-border-md);
}
.btn--ghost:hover { background: white; color: var(--ab-text); }

.btn--danger { background: var(--red-err); color: white; }
.btn--danger:hover { opacity: 0.9; }

/* ── Confirm modal ── */
.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: none;
}
.confirm-modal--open {
    display: block;
}
.confirm-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.46);
}
.confirm-modal__panel {
    position: relative;
    width: min(92vw, 440px);
    margin: 14vh auto 0;
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--ab-border);
    box-shadow: var(--shadow-lg);
    padding: 20px 22px;
}
.confirm-modal__title {
    font-size: 17px;
    font-weight: 700;
    color: var(--ab-text);
    margin-bottom: 8px;
}
.confirm-modal__message {
    font-size: 13px;
    line-height: 1.55;
    color: var(--ab-muted);
}
.confirm-modal__actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.btn--sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn--locked { opacity: 0.4; cursor: not-allowed !important; pointer-events: none; }

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}
.badge--pending { background: #FEF3C7; color: #92400E; }
.badge--processing { background: #DCFCE7; color: #166534; }
.badge--completed { background: #DCFCE7; color: #166534; }
.badge--failed { background: #FEE2E2; color: #991B1B; }

/* ── Progress bar ── */
.progress-wrap { margin: 12px 0; }
.progress-label { font-size: 13px; color: var(--ab-muted); margin-bottom: 6px; }
.progress-label--with-spinner { display: inline-flex; align-items: center; gap: 8px; }
.inline-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(27, 122, 62, 0.2);
    border-top-color: var(--ab-vivid);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
.progress-bar { background: rgba(34,160,80,0.12); border-radius: 100px; height: 7px; overflow: hidden; }
.progress-bar__fill {
    background: linear-gradient(90deg, var(--ab-vivid), var(--ab-light));
    height: 100%;
    border-radius: 100px;
    transition: width 0.4s ease;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: var(--radius-md); font-size: 13px; margin-bottom: 14px; }
.alert--success { background: #DCFCE7; color: #166534; border-left: 3px solid var(--ab-vivid); }
.alert--error { background: #FEE2E2; color: #991B1B; border-left: 3px solid var(--red-err); }
.alert--info { background: #EFF6FF; color: #1E40AF; border-left: 3px solid #3B82F6; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 12px; font-weight: 700; color: var(--ab-text); margin-bottom: 6px; letter-spacing: 0.02em; }
.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--ab-border-md);
    border-radius: var(--radius-md);
    font-size: 13px;
    background: rgba(255,255,255,0.9);
    color: var(--ab-text);
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}
.form-input:focus {
    outline: none;
    border-color: var(--ab-vivid);
    box-shadow: 0 0 0 3px rgba(34,160,80,0.12);
}
.form-help { font-size: 12px; color: var(--ab-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--red-err); margin-top: 4px; }

/* ── Upload zone ── */
.upload-zone {
    border: 2px dashed var(--ab-border-md);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: rgba(255,255,255,0.5);
}
.upload-zone:hover { border-color: var(--ab-vivid); background: rgba(34,160,80,0.04); }
.upload-zone__icon { font-size: 44px; margin-bottom: 12px; }
.upload-zone__title { font-size: 16px; font-weight: 700; color: var(--ab-text); margin-bottom: 6px; }
.upload-zone__sub { font-size: 13px; color: var(--ab-muted); }

/* ── Lease list cards ── */
.lease-grid { display: flex; flex-direction: column; gap: 10px; }
.lease-card {
    background: rgba(255,255,255,0.82);
    border: 1px solid var(--ab-border);
    border-radius: var(--radius-lg);
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
    backdrop-filter: blur(8px);
    border-left: 3px solid transparent;
}
.lease-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    border-left-color: var(--ab-vivid);
}
.lease-card__name { font-size: 15px; font-weight: 700; color: var(--ab-text); }
.lease-card__meta { font-size: 12px; color: var(--ab-muted); margin-top: 3px; }
.lease-card__right { display: flex; align-items: center; gap: 10px; }

/* ── Tab navigation ── */
.tab-nav {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--ab-border);
    margin-bottom: 20px;
}
.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: var(--ab-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
    font-family: inherit;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab-btn:hover { color: var(--ab-text); }
.tab-btn--active { color: var(--ab-vivid); border-bottom-color: var(--ab-vivid); font-weight: 700; }

/* ── Abstract table ── */
.abstract-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.abstract-table__section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 18px;
    background: var(--ab-btn-green);
    color: white;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.abstract-table__th {
    padding: 9px 14px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ab-muted);
    background: rgba(242,251,244,0.8);
    border-bottom: 1px solid var(--ab-border);
    white-space: nowrap;
}
.abstract-table__th--check { width: 44px; text-align: center; }
.abstract-table__th--label { width: 180px; }
.abstract-table__th--value { min-width: 220px; }
.abstract-table__th--evidence { min-width: 180px; }
.abstract-table__th--confidence { width: 90px; text-align: center; }

.abstract-table__row { border-bottom: 1px solid rgba(27,122,62,0.06); transition: background 0.1s; }
.abstract-table__row:hover { background: rgba(34,160,80,0.03); }
.abstract-table__row--reviewed { background: rgba(220,252,231,0.35); }
.abstract-table__row--reviewed:hover { background: rgba(220,252,231,0.5); }
.abstract-table__row:focus-within { background: rgba(34,160,80,0.1); }

.abstract-table__cell { padding: 10px 14px; vertical-align: top; line-height: 1.5; }
.abstract-table__cell--check { text-align: center; padding-top: 12px; }
.abstract-table__cell--label { font-weight: 600; color: var(--ab-green); }
.abstract-table__cell--value { color: var(--ab-text); }
.abstract-table__cell--evidence { color: var(--ab-muted); font-size: 12px; }
.abstract-table__cell--confidence { text-align: center; }
.inline-value-display {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    cursor: text;
}
.inline-value-text { flex: 1; }
.inline-edit-btn {
    opacity: 0;
    transition: opacity 0.12s ease;
    padding: 4px 8px;
    font-size: 11px;
}
.abstract-table__row:hover .inline-edit-btn,
.inline-value-display:focus-within .inline-edit-btn { opacity: 1; }
.inline-value-editor { display: flex; flex-direction: column; gap: 8px; }
.inline-edit-input { font-size: 12px; line-height: 1.45; padding: 8px 10px; }
.inline-edit-actions { display: flex; gap: 6px; justify-content: flex-end; }
.abstract-table__cell input:focus,
.abstract-table__cell textarea:focus {
    border-color: var(--ab-vivid);
    background: rgba(126,238,160,0.08);
    box-shadow: 0 0 0 3px rgba(34,160,80,0.2);
}

/* ── Review checkbox ── */
.review-checkbox {
    width: 22px; height: 22px;
    border: 1.5px solid rgba(27,122,62,0.25);
    border-radius: 6px;
    background: white;
    color: white;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
    font-family: inherit;
}
.review-checkbox:hover { border-color: var(--ab-vivid); background: rgba(34,160,80,0.06); }
.review-checkbox--checked { background: var(--ab-vivid); border-color: var(--ab-vivid); color: white; }
.review-checkbox--checked:hover { background: var(--ab-green); border-color: var(--ab-green); }

/* ── Field label link ── */
.field-label-link { color: var(--ab-green); text-decoration: none; font-weight: 600; font-size: 13px; }
.field-label-link:hover { color: var(--ab-vivid); text-decoration: underline; }

/* ── Evidence + badges ── */
.evidence-snippet { display: block; font-style: italic; color: var(--ab-muted-lt); font-size: 11px; margin-top: 3px; line-height: 1.4; }
.page-badge { display: inline-block; background: rgba(34,160,80,0.1); color: var(--ab-vivid); font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; margin-bottom: 3px; letter-spacing: 0.03em; }
.doc-source-badge { display: inline-block; background: rgba(255,211,78,0.15); color: var(--ab-gold-deep); font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; margin-left: 4px; }
.confidence-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.confidence-badge--high { background: #DCFCE7; color: #166534; }
.confidence-badge--medium { background: #FEF9C3; color: #854D0E; }
.confidence-badge--low { background: #FEE2E2; color: #991B1B; }
.edited-badge { display: inline-block; background: rgba(255,211,78,0.2); color: var(--ab-gold-deep); font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 8px; margin-left: 6px; }
.empty-field { color: var(--ab-muted-lt); font-style: italic; font-size: 12px; }

/* ── Chat widget — anchored dropdown ── */
.chat-widget-anchor { position: relative; display: inline-block; }

.chat-widget-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 420px;
    max-height: 560px;
    background: rgba(255,255,255,0.96);
    border: 1px solid var(--ab-border-md);
    border-radius: var(--radius-xl);
    box-shadow: 0 12px 48px rgba(0,0,0,0.16);
    backdrop-filter: blur(16px);
    z-index: 500;
    flex-direction: column;
    overflow: hidden;
    animation: chatDropIn 0.2s ease;
}
.chat-widget-dropdown--open { display: flex; }

@keyframes chatDropIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-widget-header {
    background: var(--ab-btn-green);
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.chat-widget-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ab-mint);
    display: flex;
    align-items: center;
    gap: 8px;
}
.chat-widget-coin { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.chat-widget-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    width: 26px; height: 26px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    transition: background 0.15s;
    font-family: inherit;
}
.chat-widget-close:hover { background: rgba(255,255,255,0.25); color: white; }

.chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 200px;
    max-height: 360px;
    scroll-behavior: smooth;
}

.chat-widget-input {
    padding: 12px 14px;
    border-top: 1px solid var(--ab-border);
    background: rgba(242,251,244,0.5);
    flex-shrink: 0;
}
.chat-input-row { display: flex; gap: 8px; }
.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--ab-border-md);
    border-radius: var(--radius-md);
    font-size: 13px;
    background: white;
    color: var(--ab-text);
    resize: none;
    font-family: inherit;
    line-height: 1.4;
}
.chat-input:focus { outline: none; border-color: var(--ab-vivid); box-shadow: 0 0 0 2px rgba(34,160,80,0.1); }
.chat-send-btn {
    background: var(--ab-btn-green);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
    font-family: inherit;
    white-space: nowrap;
}
.chat-send-btn:hover { opacity: 0.9; }

/* ── Chat messages ── */
.message { max-width: 88%; }
.message--user { align-self: flex-end; }
.message--assistant { align-self: flex-start; }
.message__bubble { padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.6; }
.message--user .message__bubble {
    background: var(--ab-btn-green);
    color: white;
    border-radius: 14px 14px 2px 14px;
}
.message--assistant .message__bubble {
    background: white;
    border: 1px solid var(--ab-border);
    border-radius: 14px 14px 14px 2px;
    color: var(--ab-text);
}
.message__citations { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.citation {
    padding: 7px 10px;
    background: rgba(34,160,80,0.06);
    border-left: 2px solid var(--ab-vivid);
    border-radius: 0 6px 6px 0;
    font-size: 11px;
}
.citation__page { font-weight: 700; color: var(--ab-vivid); font-size: 10px; margin-bottom: 2px; }
.citation__text { color: var(--ab-muted); font-style: italic; line-height: 1.5; }
.citation-group { margin-top: 6px; }
.citation-group__summary {
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    color: var(--ab-muted);
    user-select: none;
    list-style: none;
}
.citation-group__summary::-webkit-details-marker { display: none; }
.citation-group__summary::before { content: "▸ "; color: var(--ab-vivid); }
.citation-group[open] .citation-group__summary::before { content: "▾ "; }
.citation-group__list { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.chat-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--ab-muted);
}
.chat-empty__icon { font-size: 32px; margin-bottom: 8px; }
.chat-empty__title { font-size: 14px; font-weight: 600; color: var(--ab-text); margin-bottom: 4px; }
.chat-empty__sub { font-size: 12px; }
.chat-thinking { display: flex; gap: 4px; padding: 10px 14px; }
.chat-thinking span {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--ab-light);
    animation: thinking 1.2s infinite;
}
.chat-thinking span:nth-child(2) { animation-delay: 0.2s; }
.chat-thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinking { 0%,80%,100%{opacity:0.3;transform:scale(0.8)} 40%{opacity:1;transform:scale(1)} }

/* ── Document viewer ── */
.doc-viewer { display: flex; flex-direction: column; }
.doc-viewer__toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ab-border);
    background: rgba(242,251,244,0.6);
    gap: 12px;
    flex-shrink: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.doc-viewer__toolbar-left { display: flex; align-items: center; gap: 10px; flex: 1; }
.doc-viewer__toolbar-right { display: flex; gap: 6px; }
.doc-viewer__select {
    padding: 7px 10px;
    border: 1px solid var(--ab-border-md);
    border-radius: var(--radius-md);
    font-size: 13px;
    background: white;
    color: var(--ab-text);
    max-width: 340px;
    font-family: inherit;
}
.doc-viewer__meta { font-size: 11px; color: var(--ab-muted); }
.doc-viewer__title-bar {
    padding: 10px 16px;
    background: var(--ab-btn-green);
    color: white;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.doc-viewer__doc-type { font-size: 11px; color: var(--ab-mint); font-weight: 600; }

.doc-viewer__search-bar { border-bottom: 1px solid var(--ab-border); }
.doc-viewer__search-input-row { display: flex; gap: 8px; padding: 12px 14px; }
.doc-viewer__search-results { overflow-y: auto; max-height: 520px; }
.doc-viewer__search-hint { padding: 24px 16px; font-size: 13px; color: var(--ab-muted); text-align: center; }
.doc-viewer__search-result { padding: 14px 16px; border-bottom: 1px solid var(--ab-border); transition: background 0.1s; }
.doc-viewer__search-result:hover { background: rgba(34,160,80,0.03); }
.doc-viewer__result-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; color: var(--ab-muted); flex-wrap: wrap; }
.doc-viewer__result-text {
    font-size: 13px;
    line-height: 1.7;
    color: var(--ab-text);
    font-family: Georgia, 'Times New Roman', serif;
}
.doc-viewer__result-text mark {
    background: rgba(255,211,78,0.4);
    color: var(--ab-dark);
    border-radius: 2px;
    padding: 0 2px;
}

.doc-viewer__full { overflow-y: auto; max-height: 620px; }
.doc-viewer__pages { padding: 0; }
.doc-viewer__page { margin-bottom: 0; border-bottom: 1px solid var(--ab-border); }
.doc-viewer__page-header {
    padding: 6px 16px;
    background: #E1F2E8;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ab-muted);
    border-bottom: 1px solid var(--ab-border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.doc-viewer__page-content { padding: 20px 24px; background: white; }

/* Document text formatting */
.doc-viewer__page-text {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 13.5px;
    line-height: 1.9;
    color: var(--ab-text);
    white-space: normal;
    overflow-wrap: anywhere;
}
.doc-viewer__page-text p { 
    margin-bottom: 14px; 
    line-height: 1.85;
}
.doc-viewer__page-text strong { 
    display: block;
    font-weight: 700;
    color: var(--ab-text);
    margin-top: 18px;
    margin-bottom: 6px;
    font-size: 13px;
    letter-spacing: 0.02em;
}
.doc-viewer__page-text p:last-child { margin-bottom: 0; }

/* ── Utilities ── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--ab-muted); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--ab-muted); }
.empty-state__icon { font-size: 44px; margin-bottom: 12px; }
.empty-state__title { font-size: 18px; font-weight: 700; color: var(--ab-text); margin-bottom: 8px; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }

/* ── Document type badges ── */
.doc-type-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.doc-type-original_lease { background: #DBEAFE; color: #1E40AF; }
.doc-type-amendment { background: rgba(255,211,78,0.25); color: #92400E; }
.doc-type-exhibit { background: rgba(27,122,62,0.1); color: var(--ab-green); }
.doc-type-side_letter { background: #EDE9FE; color: #5B21B6; }
.doc-type-guaranty { background: #DCFCE7; color: #166534; }
.doc-type-snda { background: #FEE2E2; color: #991B1B; }
.doc-type-unknown { background: rgba(0,0,0,0.06); color: #6B7280; }

/* ── Field review page ── */
.field-review-card { max-width: 760px; }
.reasoning-block {
    padding: 12px 16px;
    background: rgba(255,211,78,0.1);
    border-left: 3px solid var(--ab-gold);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-bottom: 18px;
}
.reasoning-label { font-size: 10px; font-weight: 700; color: var(--ab-gold-deep); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.reasoning-text { font-size: 13px; color: var(--ab-muted); line-height: 1.6; }
.evidence-block { margin-bottom: 18px; }
.evidence-label { font-size: 10px; font-weight: 700; color: var(--ab-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.evidence-item {
    padding: 10px 14px;
    background: rgba(34,160,80,0.05);
    border-left: 2px solid var(--ab-vivid);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 6px;
}
.evidence-page { font-size: 10px; font-weight: 700; color: var(--ab-vivid); margin-bottom: 3px; }
.evidence-text { font-size: 12px; color: var(--ab-muted); font-style: italic; line-height: 1.5; font-family: Georgia, serif; }
/* ── AbstractBuddy Design System v2 ── */
/* Palette: Forest Green + Warm Gold + Glassy Whites */

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