:root {
    color-scheme: light;
    --bg: #f4f7fb;
    --panel: rgba(255, 255, 255, 0.92);
    --panel-strong: #ffffff;
    --border: #dde6f2;
    --text: #172033;
    --muted: #64748b;
    --primary: #3867ff;
    --primary-soft: rgba(56, 103, 255, 0.12);
    --success: #24b47e;
    --shadow: 0 20px 50px rgba(31, 52, 102, 0.10);
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --bg-gradient-1: #f8fbff;
    --bg-gradient-2: #f3f6fb;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f172a;
    --panel: rgba(30, 41, 59, 0.85);
    --panel-strong: #1e293b;
    --border: #334155;
    --text: #f8fafc;
    --muted: #94a3b8;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    --primary-soft: rgba(56, 103, 255, 0.2);
    --bg-gradient-1: #0f172a;
    --bg-gradient-2: #020617;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background:
        radial-gradient(circle at top right, rgba(56, 103, 255, 0.08), transparent 30%),
        linear-gradient(180deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 100%);
    color: var(--text);
    min-height: 100vh;
}

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

button {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 22px; height: 22px; vertical-align: middle; margin-right: 8px; }

.icon-excel { color: #217346; }
.icon-json { color: #f59e0b; }
.icon-csv { color: #3b82f6; }
.icon-markdown { color: #6366f1; }
.icon-html { color: #ef4444; }
.icon-sql { color: #ec4899; }
.icon-xml { color: #8b5cf6; }
.icon-mysql { color: #00758f; }

.app-shell {
    width: min(1380px, calc(100% - 32px));
    margin: 24px auto 40px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 18px 24px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
    position: relative;
    z-index: 20;
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-mark {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    background: white;
    border-radius: 50%;
    overflow: hidden;
    padding: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.brand-mark:hover {
    transform: scale(1.1) rotate(3deg);
    box-shadow: 0 8px 20px rgba(56, 103, 255, 0.2);
}

[data-theme="dark"] .brand-mark {
    background: #ffffff;
    box-shadow: 0 0 15px rgba(56, 103, 255, 0.3);
}

.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.eyebrow,
.panel-kicker {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    color: var(--muted);
    margin: 0 0 6px;
    font-weight: 700;
}

.brand-wrap h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #3867ff 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.01em;
}

.hero-card h2,
.panel h3,
.panel h4 {
    margin: 0;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.menu-dropdown {
    position: relative;
}

.menu-dropdown summary,
.ghost-link {
    list-style: none;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel-strong);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    font-size: 0.9rem;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--panel-strong);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

[data-theme="dark"] .theme-toggle {
    background: var(--panel-strong);
    color: #fcd34d;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(56, 103, 255, 0.1);
}

.menu-dropdown summary::-webkit-details-marker {
    display: none;
}

.menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 280px;
    padding: 12px;
    background: var(--panel-strong);
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-panel.grid-menu {
    width: 520px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.menu-panel.wide {
    width: 580px;
    display: block; /* Let menu-grid handle the layout */
}

.menu-panel.left {
    right: auto;
    left: 0;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 10px;
}

.menu-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-col h6 {
    margin: 0 0 4px 8px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 800;
}

.menu-item {
    border: 0;
    background: var(--bg);
    padding: 12px 14px;
    text-align: left;
    border-radius: 12px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s, box-shadow 0.2s, color 0.2s;
}

.menu-item:hover {
    background: var(--panel-strong);
    box-shadow: 0 4px 12px rgba(56, 103, 255, 0.1);
    color: var(--primary);
}

.menu-item:hover,
.tab:hover,
.primary-btn:hover,
.secondary-btn:hover,
.ghost-link:hover,
.menu-dropdown summary:hover {
    transform: translateY(-1px);
}

.hero-card,
.panel {
    background: var(--panel);
    border: 1px solid rgba(221, 230, 242, 0.9);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.hero-card {
    margin-top: 20px;
    padding: 40px;
    background: linear-gradient(135deg, var(--panel-strong) 0%, var(--bg) 100%);
    border: 1px solid rgba(56, 103, 255, 0.15);
    position: relative;
    overflow: hidden;
}

.hero-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(56, 103, 255, 0.05) 0%, transparent 70%);
    z-index: 0;
}

.hero-card > div {
    position: relative;
    z-index: 1;
}

.hero-card h2 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-top: 16px;
    background: linear-gradient(135deg, var(--text) 0%, var(--muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-card p {
    color: var(--muted);
    line-height: 1.7;
    max-width: 760px;
}

.badge,
.soft-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    padding: 8px 14px;
    font-size: 0.9rem;
    font-weight: 700;
}

.soft-pill {
    padding: 7px 12px;
    font-size: 0.82rem;
}

.soft-pill.green {
    background: rgba(36, 180, 126, 0.12);
    color: var(--success);
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.stat-card {
    padding: 20px;
    border-radius: 20px;
    background: var(--panel-strong);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-card span {
    color: var(--muted);
    font-size: 0.9rem;
}


.stat-card strong {
    font-size: 2rem;
}

.stat-card.accent {
    background: linear-gradient(135deg, rgba(56, 103, 255, 0.08), rgba(88, 164, 255, 0.18));
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(380px, 480px) minmax(0, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.panel {
    padding: 24px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.panel h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
}

.panel-header.compact {
    margin-bottom: 16px;
}

.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}

.field-control,
.text-input,
.mini-field {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel-strong);
    color: var(--text);
    padding: 13px 15px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field-control:focus,
.text-input:focus,
.mini-field:focus {
    border-color: rgba(56, 103, 255, 0.7);
    box-shadow: 0 0 0 4px rgba(56, 103, 255, 0.10);
}

.text-input.large {
    min-height: 250px;
    resize: vertical;
}

.hint-box {
    margin-bottom: 16px;
    border-radius: 14px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(56, 103, 255, 0.08), rgba(76, 153, 255, 0.03));
    color: var(--primary);
    border: 1px solid rgba(56, 103, 255, 0.14);
}

.data-size-tip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
    border-radius: 14px;
    padding: 12px 16px;
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.28);
    font-size: 0.88rem;
    line-height: 1.6;
}

.data-size-tip .tip-icon {
    flex-shrink: 0;
    color: #d97706;
    margin-top: 2px;
}

.data-size-tip strong {
    color: #78350f;
}

.data-size-tip em {
    font-style: normal;
    font-weight: 700;
    color: #b45309;
}

.upload-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    margin-top: 18px;
}

.upload-box {
    border: 1.6px dashed rgba(56, 103, 255, 0.35);
    border-radius: 18px;
    padding: 18px;
    background: rgba(56, 103, 255, 0.04);
    display: flex;
    align-items: center;
    gap: 14px;
}

.upload-box.dragover {
    background: rgba(56, 103, 255, 0.10);
    border-color: rgba(56, 103, 255, 0.7);
}

.upload-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--panel-strong);
    color: var(--primary);
    font-size: 1.4rem;
    font-weight: 800;
}

.upload-box p,
.upload-tips ul,
.message-box,
.empty-state p,
.output-topline p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.upload-tips {
    background: var(--panel-strong);
    border-radius: 18px;
    border: 1px solid var(--border);
    padding: 16px 18px;
}

.upload-tips h4 {
    margin: 0 0 10px;
}

.upload-tips ul {
    padding-left: 18px;
}

.action-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.action-row.slim {
    margin-top: 0;
}

.primary-btn,
.secondary-btn {
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 700;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.primary-btn {
    color: white;
    background: linear-gradient(135deg, #3867ff, #538dff);
    box-shadow: 0 18px 30px rgba(56, 103, 255, 0.24);
}

.secondary-btn {
    background: var(--panel-strong);
    color: var(--text);
    border: 1px solid var(--border);
}

.message-box {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid transparent;
}

.message-box.success {
    background: rgba(36, 180, 126, 0.10);
    color: #12704e;
    border-color: rgba(36, 180, 126, 0.18);
}

.message-box.error {
    background: rgba(255, 98, 91, 0.10);
    color: #b42318;
    border-color: rgba(255, 98, 91, 0.20);
}

.hidden {
    display: none !important;
}

.preview-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.table-frame {
    min-height: 520px;
    background: var(--panel-strong);
    border-radius: 20px;
    border: 1px solid var(--border);
    overflow: auto;
}

.empty-state {
    min-height: 520px;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 30px;
}

.empty-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 12px;
}

.sheet-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.sheet-table thead tr:first-child th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.sheet-table th,
.sheet-table td {
    border: 1px solid var(--border);
    padding: 12px 14px;
    text-align: left;
    white-space: nowrap;
}

.sheet-table .corner,
.sheet-table .col-letter,
.sheet-table .row-index {
    background: var(--bg);
    color: var(--muted);
    font-weight: 700;
}

.sheet-table .header-cell {
    background: var(--bg);
    font-weight: 700;
}

.outputs-panel {
    margin-top: 20px;
}

.tabs {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 20px;
}

.tabs::-webkit-scrollbar {
    height: 4px;
}

.tabs::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.tab {
    border: 1px solid var(--border);
    background: var(--panel-strong);
    color: var(--text);
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 700;
}

.tab.active {
    background: linear-gradient(135deg, #3867ff, #538dff);
    color: white;
    border-color: transparent;
    box-shadow: 0 16px 30px rgba(56, 103, 255, 0.22);
}

.outputs-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 18px;
}

.settings-panel,
.output-card {
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--panel-strong);
}

.settings-panel {
    padding: 20px;
    display: grid;
    align-content: start;
    gap: 18px;
}

.setting-group {
    display: grid;
    gap: 12px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text);
}

.output-card {
    padding: 18px;
}

.output-topline {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}

.code-output {
    min-height: 420px;
    resize: vertical;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.94rem;
    line-height: 1.6;
    background: var(--bg);
}

.command-controls {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.mini-field {
    min-height: 48px;
}

.command-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.command-area {
    min-height: 300px;
    resize: vertical;
}

.command-area.result {
    background: linear-gradient(135deg, rgba(145, 255, 145, 0.12), rgba(198, 255, 211, 0.25));
}

.command-result-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.3s, backdrop-filter 0.3s;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-card {
    background: var(--panel-strong);
    width: min(480px, 95%);
    max-height: 90vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 40px 100px rgba(0,0,0,0.2);
    animation: slideUp 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.close-btn {
    background: var(--border);
    border: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--muted);
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
}

.close-btn:hover {
    background: var(--bg);
    color: var(--primary);
}

.tool-desc {
    margin-bottom: 20px;
    color: var(--muted);
    font-size: 0.95rem;
}

.tool-upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 40px;
    text-align: center;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.icon-xl { width: 48px; height: 48px; color: var(--primary); }

.tool-file-list {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.file-item {
    padding: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--panel-strong);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s, color 0.2s;
}

[data-theme="dark"] .theme-toggle {
    background: var(--panel-strong);
    color: #fcd34d;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(56, 103, 255, 0.1);
}

.tool-result {
    margin-top: 20px;
    padding: 20px;
    background: rgba(36, 180, 126, 0.08);
    border-radius: var(--radius-md);
    text-align: center;
}

.success-text {
    color: var(--success);
    font-weight: 700;
    margin-bottom: 12px;
}

.full-width { width: 100%; }

.setting-group {
    margin-bottom: 20px;
    padding: 18px;
    background: var(--bg);
    border-radius: 14px;
    border: 1px solid var(--border);
}

.field-label {
    display: block;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text);
}

.field-control {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
}

.progress-container {
    margin-top: 20px;
    text-align: center;
}

.progress-bar-wrap {
    width: 100%;
    height: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #3867ff, #58a4ff);
    transition: width 0.4s ease;
}

#progressText {
    font-size: 0.9rem;
    color: var(--muted);
    font-weight: 600;
}

@media (max-width: 1120px) {
    .hero-card,
    .workspace-grid,
    .outputs-layout,
    .command-grid,
    .command-controls {
        grid-template-columns: 1fr;
    }

    .topbar {
        position: static;
    }
}

@media (max-width: 720px) {
    .app-shell {
        width: min(100% - 18px, 100%);
        margin: 12px auto 26px;
    }

    .topbar,
    .panel,
    .hero-card {
        padding: 18px;
    }

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

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

    .tabs,
    .action-row,
    .command-result-head {
        flex-direction: column;
        align-items: stretch;
    }
}

/* File Transfer Section */
.transfer-panel {
    margin-top: 24px;
}

.badge.purple {
    background: rgba(139, 92, 246, 0.12);
    color: #8b5cf6;
}

.transfer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.drop-large {
    border: 2px dashed rgba(139, 92, 246, 0.3);
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.04), rgba(167, 139, 250, 0.08));
    padding: 60px 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: transform 0.3s, background-color 0.3s, border-color 0.3s;
}

.drop-large:hover, .drop-large.dragover {
    background: rgba(139, 92, 246, 0.12);
    border-color: #8b5cf6;
    transform: scale(1.01);
}

.magic-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--panel-strong);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.2);
    display: grid;
    place-items: center;
    color: #8b5cf6;
    margin-bottom: 8px;
}

.transfer-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.purple-btn {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    box-shadow: 0 18px 30px rgba(139, 92, 246, 0.24);
}

.purple-btn:hover {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6);
}


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

.spin {
    animation: spin 1s linear infinite;
}

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

.tool-error-message {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 98, 91, 0.10);
    color: #b42318;
    border: 1px solid rgba(255, 98, 91, 0.20);
    font-size: 0.88rem;
    text-align: left;
    line-height: 1.5;
    width: 100%;
}

/* Merge PDF Editor Styles */
.modal-card.modal-wide {
    width: min(1200px, 95vw);
}

.merge-pdf-editor {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.merge-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.pdf-card {
    background: var(--panel-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    cursor: grab;
    transition: all 0.2s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.pdf-card:active {
    cursor: grabbing;
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.pdf-card-preview {
    aspect-ratio: 3/4;
    background: #f1f5f9;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #e11d48;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.pdf-card-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.pdf-card-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.card-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.card-action-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.card-action-btn.delete:hover {
    background: #e11d48;
    border-color: #e11d48;
}

.merge-add-more {
    display: flex;
    justify-content: center;
}

.add-more-btn {
    padding: 12px 24px;
    border: 2px dashed var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.add-more-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

.sortable-ghost {
    opacity: 0.4;
    border: 2px dashed var(--primary);
}



.pdf-page-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 5;
    backdrop-filter: blur(4px);
}

.pdf-card-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

