/* ── Variables ── */
:root {
    --primary:       #e74c3c;
    --primary-dark:  #c0392b;
    --primary-light: #fadbd8;
    --bg:            #f5f6f8;
    --card:          #ffffff;
    --border:        #dee2e6;
    --text:          #212529;
    --muted:         #6c757d;
    --success:       #27ae60;
    --success-dark:  #219a52;
    --radius:        10px;
    --shadow:        0 2px 10px rgba(0,0,0,0.07);
    --nav-h:         3.5rem;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ── Navbar ── */
.navbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    height: var(--nav-h);
    gap: 1.5rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    text-decoration: none;
    color: var(--primary);
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.3px;
    flex-shrink: 0;
}

.nav-brand-icon { font-size: 1.3rem; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    flex: 1;
    margin: 0;
    padding: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--muted);
    transition: all 0.15s;
    white-space: nowrap;
}

.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-link-icon { font-size: 1rem; }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.35rem;
    color: var(--text);
    border-radius: 6px;
    margin-left: auto;
    transition: background 0.15s;
}
.nav-toggle:hover { background: var(--bg); }

@media (max-width: 640px) {
    .nav-toggle { display: flex; align-items: center; }
    .nav-links {
        display: none;
        position: fixed;
        top: var(--nav-h);
        left: 0;
        right: 0;
        background: var(--card);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        align-items: stretch;
        padding: 0.5rem 1rem 0.75rem;
        gap: 0.2rem;
        box-shadow: 0 4px 16px rgba(0,0,0,0.1);
        z-index: 99;
    }
    .nav-links.open { display: flex; }
    .nav-link { padding: 0.65rem 0.75rem; }
}

/* ── Page Content ── */
.page-content { min-height: calc(100vh - var(--nav-h)); }

/* ── Home Page ── */
.home-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2.5rem 1.25rem 4rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.home-header { text-align: center; }
.home-logo { font-size: 3.25rem; line-height: 1; }

.home-header h1 {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.home-header p {
    color: var(--muted);
    margin-top: 0.5rem;
    font-size: 1rem;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.55;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.tool-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border: 1px solid var(--border);
    transition: box-shadow 0.2s, transform 0.15s;
}

.tool-card:not(.tool-card-disabled):hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.11);
    transform: translateY(-2px);
}

.tool-card-disabled { opacity: 0.6; }

.tool-card-icon { font-size: 2rem; line-height: 1; }

.tool-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.tool-card-title { font-size: 1rem; font-weight: 700; color: var(--text); }

.tool-card-desc { font-size: 0.855rem; color: var(--muted); line-height: 1.5; }

.tool-card-badge {
    display: inline-block;
    background: #f1f5f9;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    align-self: flex-start;
    border: 1px solid var(--border);
}

.btn-use-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
    align-self: flex-start;
}
.btn-use-tool:hover { background: var(--primary-dark); transform: translateY(-1px); }

.home-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.home-privacy {
    text-align: left;
    font-size: 0.875rem;
    color: var(--muted);
    background: var(--card);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
}
.home-logo-row {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.75rem;
}
.home-logo-row .btn-header-action {
    position: absolute;
    width: 3.25rem;
    height: 3.25rem;
    font-size: 1.5rem;
}
.home-logo-row .btn-home-left  { left: 0; }
.home-logo-row .btn-home-right { right: 0; }

/* ── Help modal ── */
.help-intro {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text);
}
.help-tool-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.help-tool-list li {
    display: grid;
    grid-template-columns: 2rem 1fr;
    align-items: baseline;
    gap: 0 0.5rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
}
.help-tool-list li:last-child { border-bottom: none; }
.help-tool-icon {
    font-size: 1.1rem;
    line-height: 1.4;
    justify-self: center;
}
.help-tool-text { display: flex; flex-direction: column; gap: 0.15rem; }
.help-tool-text strong { font-size: 0.875rem; color: var(--text); font-weight: 600; }
.help-tool-text span { font-size: 0.8rem; color: var(--muted); line-height: 1.4; }
.help-privacy {
    font-size: 0.8rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    margin: 0;
    line-height: 1.5;
}

/* ── Tool Page ── */
.tool-page {
    max-width: 820px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 4rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.tool-page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.tool-page-back {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
    color: var(--muted);
    font-size: 0.875rem;
    transition: color 0.15s;
    flex-shrink: 0;
}
.tool-page-back:hover { color: var(--primary); }

.tool-page-title-group { flex: 1; min-width: 0; }

.tool-page-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.tool-page-subtitle { color: var(--muted); font-size: 0.875rem; margin-top: 0.15rem; }

.tool-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* ── Not Found ── */
.not-found-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 5rem 1.25rem;
    text-align: center;
    color: var(--muted);
}

/* ── Drop Zone ── */
.drop-zone {
    background: var(--card);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    transition: border-color 0.2s, background 0.2s;
}
.drop-zone.dragging {
    border-color: var(--primary);
    background: var(--primary-light);
}
.drop-zone.has-file {
    border-style: solid;
    border-color: var(--primary);
    padding: 1rem 1.5rem;
}
.drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}
.drop-icon { font-size: 2.5rem; }
.drop-text { font-size: 1.05rem; color: var(--muted); }
.drop-or   { font-size: 0.85rem; color: var(--muted); }

.btn-select-file {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.5rem;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}
.btn-select-file:hover { background: var(--primary-dark); transform: translateY(-1px); }
.hidden-input { display: none; }

.file-loaded {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.file-icon-loaded { font-size: 1.75rem; flex-shrink: 0; }
.file-details { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-name  { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-pages { color: var(--muted); font-size: 0.875rem; margin-top: 1px; }

.btn-clear-file {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    flex-shrink: 0;
    color: var(--muted);
    font-size: 0.75rem;
    transition: all 0.18s;
}
.btn-clear-file:hover { background: #fee2e2; border-color: var(--primary); color: var(--primary); }

/* ── Header action buttons (help / suggestions) ── */
.btn-header-action {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 2.25rem;
    height: 2.25rem;
    cursor: pointer;
    font-size: 1rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s;
    box-shadow: var(--shadow);
    font-weight: 700;
}
.btn-header-action:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* ── Error Banner ── */
.error-banner {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #991b1b;
    font-size: 0.9rem;
}
.error-banner button {
    background: none;
    border: none;
    cursor: pointer;
    color: #991b1b;
    font-size: 1rem;
    padding: 0 0.25rem;
}

/* ── Tabs ── */
.tabs-container {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.tabs-header {
    display: flex;
    border-bottom: 1px solid var(--border);
}
.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 0.9rem 1rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--muted);
    transition: color 0.15s, background 0.15s;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    font-weight: 500;
}
.tab-btn:hover { color: var(--text); background: var(--bg); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }

.tab-panel { padding: 1.5rem; }

/* ── Fixed Tab ── */
.fixed-tab { display: flex; flex-direction: column; gap: 1rem; }

.field-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.field-label { font-weight: 500; min-width: 160px; }

.num-input {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    width: 110px;
    text-align: center;
    transition: border-color 0.15s, outline 0.15s;
}
.num-input:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }

.info-text {
    background: var(--bg);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: var(--muted);
    border-left: 3px solid var(--primary);
}
.info-text strong { color: var(--text); }

/* ── Custom Tab ── */
.custom-tab { display: flex; flex-direction: column; gap: 1rem; }

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

.preview-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}
.toggle-label { font-size: 0.9rem; color: var(--muted); transition: color 0.15s; }
.preview-toggle input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; }
.preview-toggle input[type="checkbox"]:checked + .toggle-label { color: var(--text); }

.ranges-table-wrapper { overflow-x: auto; }

.ranges-table { width: 100%; border-collapse: collapse; }
.ranges-table th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    border-bottom: 2px solid var(--border);
}
.th-preview { width: 200px; }
.th-page    { width: 90px; }

.ranges-table td { padding: 0.45rem 0.75rem; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }

.range-row:hover td { background: var(--bg); }

.td-preview { width: 200px; }
.preview-thumb {
    width: 180px;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    display: block;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.preview-loading {
    width: 180px;
    height: 240px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: 4px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.td-page-readonly { color: var(--muted); font-weight: 500; font-size: 0.9rem; }

.td-page-editable { width: 100px; }
.page-input-inline {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    font-size: 0.9rem;
    width: 84px;
    text-align: center;
    transition: border-color 0.15s, outline 0.15s;
}
.page-input-inline:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: transparent; }

/* ── Action Bar ── */
.action-bar { display: flex; justify-content: center; }

.btn-split {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 0.9rem 3.5rem;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 200px;
    justify-content: center;
}
.btn-split:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(231, 76, 60, 0.35);
}
.btn-split:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

.spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Results ── */
.results-section {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid #e8f5e9;
}
.results-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fef9;
}
.results-header h2 { font-size: 0.95rem; font-weight: 700; color: var(--text); }

.btn-download-all {
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}
.btn-download-all:hover { background: var(--success-dark); transform: translateY(-1px); }

.results-list { padding: 0.5rem 0; }

.result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.5rem;
    transition: background 0.12s;
}
.result-item:hover { background: var(--bg); }

.result-icon { font-size: 1.25rem; flex-shrink: 0; }

.result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.result-name {
    font-size: 0.875rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.result-size { font-size: 0.775rem; color: var(--muted); }

.btn-download-one {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
    cursor: pointer;
    flex-shrink: 0;
    color: var(--muted);
    transition: all 0.18s;
    white-space: nowrap;
}
.btn-download-one:hover {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

/* ── Modals ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 1rem;
}
.modal-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    width: 100%;
    max-width: 480px;
    text-align: left;
    overflow: hidden;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.05rem; font-weight: 700; }
.btn-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 1rem;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.15s;
}
.btn-modal-close:hover { color: var(--primary); }
.modal-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }

.help-steps { padding-left: 1.25rem; display: flex; flex-direction: column; gap: 0.6rem; font-size: 0.9rem; line-height: 1.55; }
.help-steps ul { margin-top: 0.3rem; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.25rem; }
.help-note { font-size: 0.85rem; color: var(--muted); background: var(--bg); border-radius: 6px; padding: 0.65rem 0.9rem; border-left: 3px solid var(--primary); }

.modal-card-form { max-width: 540px; }
.modal-subtitle { font-size: 0.85rem; color: var(--muted); margin-top: 0.2rem; }

.sug-field { display: flex; flex-direction: column; gap: 0.35rem; }
.sug-label { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.sug-input {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.15s, outline 0.15s;
    background: var(--card);
    color: var(--text);
    width: 100%;
}
.sug-input:focus { outline: 2px solid #3b82f6; outline-offset: 0; border-color: transparent; }
.sug-input:disabled { opacity: 0.6; cursor: not-allowed; }
.sug-select { cursor: pointer; appearance: auto; }
.sug-textarea {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 0.85rem;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    width: 100%;
    transition: border-color 0.15s, outline 0.15s;
    color: var(--text);
}
.sug-textarea:focus { outline: 2px solid #3b82f6; outline-offset: 0; border-color: transparent; }
.sug-textarea:disabled { opacity: 0.6; cursor: not-allowed; }
.sug-counter { font-size: 0.78rem; color: var(--muted); }
.sug-error { font-size: 0.85rem; color: #b91c1c; background: #fee2e2; border-radius: 6px; padding: 0.5rem 0.75rem; }

.btn-suggest-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.7rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    align-self: flex-start;
}
.btn-suggest-send:hover:not(:disabled) { background: #1d4ed8; transform: translateY(-1px); }
.btn-suggest-send:disabled { opacity: 0.65; cursor: not-allowed; transform: none; }

.suggestion-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 0;
    text-align: center;
    color: var(--success);
    font-weight: 600;
}
.suggestion-success-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: #dcfce7;
    color: var(--success);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Blazor error UI ── */
#blazor-error-ui {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    max-width: 500px;
    width: 90%;
    display: none;
    font-size: 0.875rem;
    z-index: 1000;
}
#blazor-error-ui .reload { font-weight: 600; margin-left: 0.5rem; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }

/* ── Options card ── */
.options-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.options-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}
.options-col { display: flex; flex-direction: column; gap: 1rem; }
.options-field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 140px; }
.options-field--full { flex: 1 1 100%; }
.sel-input {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.45rem 0.65rem;
    font-size: 0.9rem;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
}
.text-input-full {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    width: 100%;
    background: var(--bg);
    color: var(--text);
}
.text-input-full:focus, .sel-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* ── File list (Merge / Images-to-PDF) ── */
.file-list-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--muted);
}
.btn-clear-all {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    color: var(--muted);
    cursor: pointer;
}
.btn-clear-all:hover { background: var(--bg); }
.file-list { list-style: none; }
.file-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
}
.file-list-item:last-child { border-bottom: none; }
.file-list-icon { font-size: 1.4rem; flex-shrink: 0; }
.file-list-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid var(--border);
}
.file-list-info { flex: 1; min-width: 0; }
.file-list-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-list-meta { display: block; font-size: 0.78rem; color: var(--muted); }
.file-list-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.btn-move {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    width: 28px; height: 28px;
    font-size: 0.6rem;
    cursor: pointer;
    color: var(--text);
    display: flex; align-items: center; justify-content: center;
}
.btn-move:hover:not(:disabled) { background: var(--primary-light); }
.btn-move:disabled { opacity: 0.35; cursor: default; }
.btn-remove {
    background: none;
    border: 1px solid var(--border);
    border-radius: 5px;
    width: 28px; height: 28px;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--muted);
    display: flex; align-items: center; justify-content: center;
}
.btn-remove:hover { background: #fdecea; color: var(--primary); border-color: var(--primary-light); }

/* ── Quality grid (Compress) ── */
.quality-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}
.quality-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 0.75rem;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s, box-shadow 0.15s;
    user-select: none;
}
.quality-card:hover { border-color: var(--primary-light); }
.quality-card.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.quality-card-name { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.3rem; }
.quality-card-desc { font-size: 0.75rem; color: var(--muted); line-height: 1.3; }

/* ── Compress result ── */
.compress-result {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.compress-stat { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; }
.compress-stat-label { font-size: 0.78rem; color: var(--muted); }
.compress-stat-value { font-size: 1.1rem; font-weight: 600; }
.compress-stat-value--green { color: var(--success); }
.compress-arrow { font-size: 1.5rem; color: var(--muted); }

/* ── Images grid (PDF to Images) ── */
.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}
.image-result-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.image-result-thumb {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: contain;
    background: #f0f0f0;
    display: block;
}
.image-result-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.6rem;
    border-top: 1px solid var(--border);
    gap: 0.4rem;
}
.image-result-label { font-size: 0.72rem; color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-download-img {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 5px;
    width: 26px; height: 26px;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.btn-download-img:hover { background: var(--primary-dark); }

/* ── Permissions list (Protect PDF) ── */
.permissions-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 0.25rem;
}
.permission-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
}
.permission-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}
.field-warning {
    font-size: 0.82rem;
    color: #b91c1c;
    margin-top: -0.25rem;
}
.field-note {
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.5;
    margin-top: 0.3rem;
}
.required { color: var(--primary); }

/* ── Color presets (Watermark) ── */
.color-presets { display: flex; gap: 0.5rem; flex-wrap: wrap; padding-top: 0.2rem; }
.color-preset-btn {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
    flex-shrink: 0;
}
.color-preset-btn:hover { transform: scale(1.15); }
.color-preset-btn.selected { border-color: var(--text); transform: scale(1.1); }

/* ── Responsive ── */
@media (max-width: 600px) {
    .tool-page { padding: 1.25rem 0.875rem 3rem; gap: 1.25rem; }
    .tool-page-title { font-size: 1.25rem; }
    .tool-page-header { gap: 0.75rem; }
    .home-container { padding: 1.5rem 0.875rem 3rem; }
    .home-header h1 { font-size: 1.75rem; }
    .tools-grid { grid-template-columns: 1fr; }
    .btn-split { width: 100%; }
    .results-header { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
    .field-row { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .quality-grid { grid-template-columns: repeat(2, 1fr); }
    .images-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .compress-result { gap: 1rem; padding: 0.75rem 1rem; }
    .options-row { flex-direction: column; }
    .options-field { min-width: unset; width: 100%; }
}
