/* ── Design tokens ────────────────────────────────────────── */
:root {
    --bg:         #0A0E1A;
    --bg-surface: #111827;
    --bg-raised:  #1C2436;
    --bg-hover:   #232D42;
    --border:     #2A3550;
    --border-dim: #1E2A3F;

    --text:       #E8EEFF;
    --text-muted: #6B7A9A;
    --text-dim:   #3D4F70;

    --blue:       #3B82F6;
    --blue-dim:   #1E3A5F;
    --blue-hover: #2563EB;
    --teal:       #14B8A6;
    --teal-dim:   #0D3D38;
    --red:        #EF4444;
    --red-dim:    #3D1515;
    --amber:      #F59E0B;

    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
    --font-ui:   'Inter', -apple-system, sans-serif;

    --radius:    6px;
    --radius-lg: 10px;
    --shadow:    0 4px 16px rgba(0,0,0,.5);
}

/* ── Reset + Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

input, select, textarea, button {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* ── Topnav ───────────────────────────────────────────────── */
.topnav {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topnav__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    flex-shrink: 0;
}
.brand-icon { font-size: 16px; }
.brand-version {
    font-size: 10px;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 5px;
}

.topnav__links {
    display: flex;
    gap: 4px;
    flex: 1;
}
.topnav__links a {
    padding: 4px 10px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.topnav__links a:hover, .topnav__links a.active {
    background: var(--bg-raised);
    color: var(--text);
}
.topnav__links a.active { color: var(--blue); }

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

.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}
.status-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #22C55E;
    box-shadow: 0 0 6px #22C55E80;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background .15s, border-color .15s, opacity .15s;
    white-space: nowrap;
}
.btn--primary {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}
.btn--primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn--ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}
.btn--ghost:hover { background: var(--bg-raised); }
.btn--danger {
    background: transparent;
    border-color: var(--red-dim);
    color: var(--red);
}
.btn--danger:hover { background: var(--red-dim); }
.btn--sm { padding: 4px 10px; font-size: 12px; }
.btn--full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-raised); color: var(--text); }
.icon-btn--danger:hover { background: var(--red-dim); color: var(--red); }

/* ── Main content ─────────────────────────────────────────── */
.main-content { height: calc(100vh - 48px); overflow: hidden; }

/* ── Dashboard layout ─────────────────────────────────────── */
.dashboard {
    display: grid;
    grid-template-columns: 220px 1fr;
    height: 100%;
    overflow: hidden;
}

.sidebar {
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.sidebar__header {
    padding: 14px 16px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    border-bottom: 1px solid var(--border-dim);
}
.sidebar__nav { flex: 1; padding: 8px 8px; }
.sidebar__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    transition: background .15s, color .15s;
    margin-bottom: 2px;
}
.sidebar__item:hover, .sidebar__item.active {
    background: var(--bg-raised);
    color: var(--text);
    text-decoration: none;
}
.sidebar__item.active { color: var(--blue); }
.sidebar__icon { font-size: 12px; flex-shrink: 0; width: 16px; text-align: center; }
.sidebar__count {
    margin-left: auto;
    font-size: 11px;
    font-family: var(--font-mono);
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1px 6px;
    color: var(--text-muted);
}
.sidebar__footer { padding: 12px; border-top: 1px solid var(--border-dim); }

.dashboard__main {
    overflow-y: auto;
    padding: 20px 24px;
}

/* ── Stats strip ──────────────────────────────────────────── */
.stats-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
}
.stat-card--accent { border-color: var(--teal-dim); background: color-mix(in srgb, var(--teal-dim) 40%, var(--bg-surface)); }
.stat-card__value {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    line-height: 1;
    margin-bottom: 4px;
}
.stat-card--accent .stat-card__value { color: var(--teal); }
.stat-card__label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }

/* ── Section header ───────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.section-header h2 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.section-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--blue-dim);
    color: var(--blue);
    border: 1px solid var(--blue);
    font-weight: 400;
}
.section-actions { display: flex; gap: 8px; }

/* ── Template grid ────────────────────────────────────────── */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.template-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color .2s, box-shadow .2s;
}
.template-card:hover { border-color: var(--blue-dim); box-shadow: var(--shadow); }
.template-card--featured { border-color: var(--blue); }

.template-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 0;
}
.template-card__cat {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}
.template-card__menu { display: flex; gap: 2px; }
.template-card__body { padding: 10px 12px; flex: 1; }
.template-card__name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.template-card__desc { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.template-card__meta { display: flex; gap: 10px; font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.template-card__actions {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--border-dim);
    background: var(--bg);
}

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state__icon { font-size: 40px; margin-bottom: 12px; opacity: .4; }
.empty-state p { margin-bottom: 16px; }

/* ── Modal ────────────────────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal[hidden] { display: none; }
.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.7);
}
.modal__box {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 480px;
    max-width: 95vw;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}
.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal__header h3 { font-size: 15px; font-weight: 600; }
.modal__body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.modal__footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ── Form fields ──────────────────────────────────────────── */
.field-group { margin-bottom: 14px; }
.field-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 5px;
}
.field-group input[type=text],
.field-group input[type=number],
.field-group input[type=file],
.field-group select,
.field-group textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 10px;
    color: var(--text);
    transition: border-color .15s;
    outline: none;
}
.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus { border-color: var(--blue); }
.field-group small { display: block; margin-top: 4px; color: var(--text-muted); font-size: 11px; }
.field-group.field-row label { display: flex; align-items: center; gap: 8px; }
.field-row input[type=checkbox] { width: auto; }
.code-preview {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    max-height: 200px;
    overflow-y: auto;
    white-space: pre;
}

/* ── Editor layout ────────────────────────────────────────── */
.editor-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Toolbar */
.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    height: 44px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-shrink: 0;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex: 1; }
.toolbar-right { justify-content: flex-end; }
.toolbar-center {
    display: flex;
    align-items: center;
    gap: 12px;
}
.editor-title {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.toolbar-badge { font-size: 11px; color: var(--teal); }
.toolbar-upload { cursor: pointer; }

.tool-group {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2px;
}
.tool-btn {
    width: 28px; height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    transition: background .15s, color .15s;
}
.tool-btn:hover { background: var(--bg-raised); color: var(--text); }
.tool-btn.active { background: var(--blue-dim); color: var(--blue); }
.zoom-display, .coord-display {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    min-width: 40px;
    text-align: center;
}
.coord-display { min-width: 100px; }

/* Page bar */
.page-bar {
    display: flex;
    gap: 4px;
    padding: 6px 12px;
    background: var(--bg);
    border-bottom: 1px solid var(--border-dim);
    flex-shrink: 0;
}
.page-btn {
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
}
.page-btn.active { border-color: var(--blue); color: var(--blue); background: var(--blue-dim); }

/* Editor body */
.editor-body {
    display: grid;
    grid-template-columns: 1fr 320px;
    flex: 1;
    overflow: hidden;
}

/* Canvas area */
.canvas-area {
    overflow: auto;
    background: var(--bg);
    position: relative;
}
.canvas-wrapper {
    position: relative;
    display: inline-block;
    margin: 20px auto;
    display: block;
    width: fit-content;
    margin: 20px auto;
}
#pdf-canvas { display: block; box-shadow: 0 0 0 1px var(--border), var(--shadow); }
.fields-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.fields-overlay.draw-mode { pointer-events: all; cursor: crosshair; }

.canvas-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: var(--text-muted);
    text-align: center;
    gap: 12px;
}
.canvas-placeholder__icon { font-size: 48px; opacity: .3; }

/* Field overlay rects */
.field-rect {
    position: absolute;
    border: 2px solid var(--blue);
    background: rgba(59,130,246,.12);
    cursor: move;
    pointer-events: all;
    box-sizing: border-box;
}
.field-rect.selected {
    border-color: var(--blue);
    background: rgba(59,130,246,.22);
    box-shadow: 0 0 0 1px var(--blue);
}
.field-rect.type-boxed_text, .field-rect.type-date_boxes {
    border-color: var(--teal);
    background: rgba(20,184,166,.12);
}
.field-rect.type-boxed_text.selected, .field-rect.type-date_boxes.selected {
    border-color: var(--teal);
    background: rgba(20,184,166,.22);
    box-shadow: 0 0 0 1px var(--teal);
}
.field-rect__label {
    position: absolute;
    top: -20px;
    left: 0;
    font-size: 10px;
    white-space: nowrap;
    background: var(--blue);
    color: #fff;
    padding: 1px 4px;
    border-radius: 2px;
    font-family: var(--font-mono);
    pointer-events: none;
}
.field-rect.type-boxed_text .field-rect__label,
.field-rect.type-date_boxes .field-rect__label { background: var(--teal); color: #000; }

.field-rect__resize {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 8px; height: 8px;
    background: var(--blue);
    border-radius: 2px;
    cursor: se-resize;
}

/* Field panel */
.field-panel {
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.panel-header h3 { font-size: 13px; font-weight: 600; }
.panel-count { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

/* Field list */
.field-list { padding: 8px; flex-shrink: 0; }
.field-list__empty { padding: 12px; text-align: center; color: var(--text-muted); font-size: 12px; }
.field-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s;
    margin-bottom: 2px;
}
.field-item:hover { background: var(--bg-raised); }
.field-item.active { background: var(--blue-dim); border-color: var(--blue-dim); }
.field-item__dot {
    width: 8px; height: 8px;
    border-radius: 2px;
    background: var(--blue);
    flex-shrink: 0;
}
.field-item__dot--teal { background: var(--teal); }
.field-item__key {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.field-item__type { font-size: 10px; color: var(--text-muted); }

/* Field config */
.field-config { border-top: 1px solid var(--border); flex: 1; display: flex; flex-direction: column; }
.config-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}
.config-tab {
    flex: 1;
    padding: 8px 4px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
}
.config-tab:hover { color: var(--text); }
.config-tab.active { color: var(--blue); border-bottom-color: var(--blue); }

.config-tab-body { padding: 12px 14px; flex: 1; overflow-y: auto; }

.coords-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.align-btns { display: flex; gap: 4px; }
.align-btn {
    padding: 5px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.align-btn:hover { background: var(--bg-raised); }
.align-btn.active { background: var(--blue-dim); border-color: var(--blue); color: var(--blue); }

.box-info { background: var(--teal-dim); border: 1px solid var(--teal); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 12px; font-size: 12px; }
.box-preview {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.box-preview-cell {
    width: 18px; height: 22px;
    border: 1px solid var(--teal);
    border-radius: 2px;
    background: var(--teal-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--teal);
}

.config-actions {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* ── Status bar ───────────────────────────────────────────── */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 14px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    flex-shrink: 0;
    height: 28px;
}
.status-hints { opacity: .6; }

/* ── Fill layout ──────────────────────────────────────────── */
.fill-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    height: 100%;
    overflow: hidden;
}

.fill-form-panel {
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.fill-header { display: flex; flex-direction: column; gap: 10px; }
.fill-header__info h2 { font-size: 15px; font-weight: 600; }
.fill-header__hint {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--teal-dim);
    border: 1px solid var(--teal);
    border-radius: var(--radius);
    padding: 8px 10px;
    margin-top: 6px;
}
.fill-header__hint strong { color: var(--teal); }

.fields-section { margin-bottom: 16px; }
.fields-section__title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-dim);
}

.fill-field { margin-bottom: 14px; }
.fill-field label { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 5px; }

.fill-field input[type=text],
.fill-field textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 10px;
    color: var(--text);
    outline: none;
    transition: border-color .15s;
    font-family: var(--font-mono);
}
.fill-field input:focus, .fill-field textarea:focus { border-color: var(--blue); }
.fill-field input.is-valid { border-color: #22C55E; }
.fill-field input.is-invalid { border-color: var(--red); }

.req-star { color: var(--red); }
.field-badge {
    display: inline-block;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid var(--border);
    color: var(--text-muted);
    margin-left: 6px;
    vertical-align: middle;
    font-family: var(--font-mono);
}
.field-badge--blue { border-color: var(--blue); color: var(--blue); background: var(--blue-dim); }
.field-badge--teal { border-color: var(--teal); color: var(--teal); background: var(--teal-dim); }

.field-error { font-size: 11px; color: var(--red); margin-top: 4px; }

/* Boxed input */
.boxed-input {
    display: flex;
    gap: 3px;
    align-items: center;
    flex-wrap: wrap;
    padding: 6px 0;
    outline: none;
}
.box-cell {
    width: 28px; height: 32px;
    border: 1px solid var(--teal-dim);
    border-radius: 3px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--teal);
    cursor: text;
    transition: border-color .15s, background .15s;
    position: relative;
}
.box-cell.active {
    border-color: var(--teal);
    background: var(--teal-dim);
    box-shadow: 0 0 0 2px rgba(20,184,166,.3);
}
.box-cell.filled { border-color: var(--teal); }
.boxed-input:focus-within .box-cell { border-color: var(--border); }
.boxed-input:focus-within .box-cell.active { border-color: var(--teal); }

.fill-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}
.validation-summary {
    background: var(--red-dim);
    border: 1px solid var(--red);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 12px;
    color: var(--red);
    margin-top: 8px;
}

/* Fill preview panel */
.fill-preview-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}
.preview-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    font-size: 12px;
    color: var(--text-muted);
}
.preview-toolbar__label { flex: 1; font-size: 12px; }
#preview-page-display { font-family: var(--font-mono); font-size: 11px; min-width: 60px; text-align: center; }
.preview-canvas-area {
    flex: 1;
    overflow: auto;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
}
#preview-canvas { box-shadow: var(--shadow); }
.preview-overlay {
    position: absolute;
    pointer-events: none;
}

/* Text overlays on preview */
.preview-text {
    position: absolute;
    font-family: 'Helvetica', sans-serif;
    color: #000;
    white-space: pre;
    pointer-events: none;
    line-height: 1;
}

/* ── Scrollbars ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Smart Paste panel ────────────────────────────────────── */
.paste-trigger { margin-bottom: .75rem; }

.paste-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.25rem;
}
.paste-panel__hint {
    font-size: .8rem;
    color: var(--text-dim);
    margin: 0 0 .6rem;
}
.paste-textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: 'IBM Plex Mono', monospace;
    font-size: .78rem;
    padding: .6rem .75rem;
    resize: vertical;
    box-sizing: border-box;
}
.paste-textarea:focus { outline: none; border-color: var(--blue); }
.paste-panel__footer {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .6rem;
}
.paste-result { font-size: .8rem; }
.paste-result--ok { color: var(--teal); }
.paste-result--err { color: #f87171; }
