:root {
    --bg-color: #fff8f6;
    --panel-bg: #ffffff;
    --panel-border: #ddc0ba;
    --text-primary: #241917;
    --text-secondary: #57423d;
    --accent-1: #a13e27;
    --accent-2: #865044;
    --accent-3: #006b5e;

    --glow-spread: 60px;
    --radius-lg: 16px;
    --radius-md: 10px;

    --font-heading: 'Newsreader', serif;
    --font-body: 'Inter', sans-serif;

    --transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding-top: 110px; /* header 68px + banner 42px */
}

/* Background Animated Orbs */
.glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: 0;
    pointer-events: none;
    opacity: 0.5;
    animation: drift 20s infinite alternate cubic-bezier(0.5, 0, 0.5, 1);
}

.orb-1 {
    width: 40vw;
    height: 40vw;
    background: rgba(161, 62, 39, 0.06);
    top: -10vw;
    left: -10vw;
}

.orb-2 {
    width: 30vw;
    height: 30vw;
    background: rgba(240, 121, 93, 0.05);
    bottom: -5vw;
    right: -5vw;
    animation-delay: -5s;
}

.orb-3 {
    width: 20vw;
    height: 20vw;
    background: rgba(134, 80, 68, 0.04);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 8s infinite alternate;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(30px, 50px) scale(1.1);
    }
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.3;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.4);
        opacity: 0.6;
    }
}

/* Container */
.container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.header {
    text-align: center;
}

.logo-title {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 0.5rem;
}

.gradient-text {
    background: linear-gradient(135deg, #a13e27, #f0795d);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
}

/* Glass Panel */
.glass-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
    transition: var(--transition);
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--accent-1);
    border-radius: var(--radius-md);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.5);
}

.drop-zone:hover,
.drop-zone.drag-active {
    border-color: var(--accent-1);
    background: rgba(99, 102, 241, 0.05);
}

.drop-icon {
    color: var(--text-secondary);
    transition: var(--transition);
}

.drop-zone:hover .drop-icon {
    color: var(--accent-1);
    transform: translateY(-5px);
}

.drop-text {
    font-size: 1.1rem;
    font-weight: 500;
}

.drop-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.browse-link {
    color: var(--accent-2);
    font-weight: 600;
}

#file-input {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

/* File Display (When selected) */
.file-display {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: rgba(241, 245, 249, 0.6);
    border: 1px solid var(--panel-border);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    overflow: hidden;
}

.file-icon {
    color: var(--accent-2);
    flex-shrink: 0;
}

.file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.remove-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.remove-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2rem;
}

.control-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.custom-select {
    width: 100%;
    appearance: none;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.custom-select:focus {
    outline: none;
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px rgba(161, 62, 39, 0.2);
}

.custom-select option {
    background: #fdfdf5;
    /* Light dropdown */
    color: var(--text-primary);
}

.chevron {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-secondary);
}

/* Toggles */
.toggles {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toggle-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.slider {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: rgba(100, 116, 139, 0.2);
    border-radius: 24px;
    transition: 0.4s;
    margin-right: 12px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.4s;
}

input:checked+.slider {
    background-image: linear-gradient(135deg, var(--accent-1), var(--accent-2));
}

input:checked+.slider:before {
    transform: translateX(18px);
}

.toggle-label {
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* Submit Button */
.submit-btn {
    width: 100%;
    margin-top: 2.5rem;
    padding: 1.25rem;
    border: none;
    border-radius: var(--radius-md);
    background: var(--accent-1);
    color: white;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 16px rgba(161, 62, 39, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.submit-btn:hover:not(:disabled)::before {
    left: 100%;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(240, 121, 93, 0.5);
}

.submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.submit-btn:disabled {
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.3);
    cursor: not-allowed;
    box-shadow: none;
}

.btn-text {
    transition: var(--transition);
}

/* Loader */
.loader {
    display: none;
    position: absolute;
    width: 24px;
    height: 24px;
}

.submit-btn.loading .btn-text {
    opacity: 0;
}

.submit-btn.loading .loader {
    display: block;
}

.spinner {
    animation: rotate 2s linear infinite;
    z-index: 2;
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -12px 0 0 -12px;
    width: 24px;
    height: 24px;
}

.spinner .path {
    stroke: #ffffff;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }

    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }

    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* Status Notifications */
.status-message {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-10px);
    transition: var(--transition);
    display: none;
}

.status-message.show {
    opacity: 1;
    transform: translateY(0);
    display: block;
}

.status-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    .logo-title {
        font-size: 2.5rem;
    }

    .glass-panel {
        padding: 1.5rem;
    }
}

/* =========================================================
   EPUB VALIDATOR
   ========================================================= */
.validator-panel {
    margin-top: 0;
    /* gap is handled by container */
}

.validator-header {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    margin-bottom: 2rem;
}

.validator-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(161, 62, 39, 0.2), rgba(240, 121, 93, 0.2));
    border: 1px solid rgba(161, 62, 39, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-2);
    flex-shrink: 0;
}

.validator-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.validator-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.validator-drop-zone {
    padding: 2rem;
    margin-bottom: 1.5rem;
    position: relative;
}

/* Hide the native file input absolutely */
#val-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Results */
.val-results {
    margin-top: 1.5rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

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

.val-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    margin-bottom: 1.2rem;
}

.val-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.val-badge-pass {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.val-badge-error {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.val-badge-warn {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.val-badge-info {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.val-clean {
    font-size: 0.9rem;
    color: #10b981;
    font-weight: 500;
}

.val-messages {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.val-messages::-webkit-scrollbar {
    width: 4px;
}

.val-messages::-webkit-scrollbar-track {
    background: transparent;
}

.val-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
}

.val-msg {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    border-left: 3px solid transparent;
    line-height: 1.4;
}

.val-msg-error {
    background: rgba(239, 68, 68, 0.08);
    border-left-color: #ef4444;
}

.val-msg-warn {
    background: rgba(245, 158, 11, 0.08);
    border-left-color: #f59e0b;
}

.val-msg-info {
    background: rgba(99, 102, 241, 0.07);
    border-left-color: #6366f1;
}

.val-sev {
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    opacity: 0.7;
    flex-shrink: 0;
}

.val-code {
    font-family: monospace;
    font-size: 0.78rem;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    flex-shrink: 0;
}

.val-text {
    flex: 1;
    min-width: 0;
    color: var(--text-primary);
}

.val-loc {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-family: monospace;
    word-break: break-all;
}

/* =========================================================
   EPUB READER OVERLAY
   ========================================================= */
.val-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2.5rem;
    width: 100%;
}

.val-actions .submit-btn {
    flex: 1;
    width: auto;
    margin-top: 0;
    /* Reset global submit-btn margin */
}

.read-btn {
    background: linear-gradient(135deg, #0f766e, #0284c7) !important;
    box-shadow: 0 10px 20px -5px rgba(7, 89, 133, 0.4) !important;
}

/* Full-screen overlay as dark backdrop */
.reader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    /* Darker backdrop to focus on the book */
    backdrop-filter: blur(8px);
    padding: 2rem;
}

/* The "iPad" device frame - WHITE MODE ONLY */
.reader-main {
    width: 720px;
    max-width: 95vw;
    height: 94vh;
    background: #ffffff;
    border-radius: 40px;
    border: 16px solid #000;
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    animation: readerScaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes readerScaleIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(30px);
    }

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

/* Sidebar (contained inside the device) */
.reader-sidebar {
    width: 280px;
    background: #f8fafc;
    backdrop-filter: blur(10px);
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.2, 0, 0.2, 1);
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
}

.reader-sidebar.sidebar-open {
    transform: translateX(0);
}

.reader-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.reader-sidebar-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1e293b;
}

.reader-toc {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.reader-toc-link {
    display: block;
    padding: 0.75rem 1.25rem;
    color: #64748b;
    text-decoration: none;
    font-size: 0.9rem;
    transition: 0.2s;
}

.reader-toc-link:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* Reader Top Bar - increased height and improved flex */
.reader-topbar {
    height: 72px;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
    z-index: 200;
}

.reader-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 0 0 auto;
    margin-left: auto;
}

.reader-chapter-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: #64748b;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 1rem;
}

/* Layout for content + nav buttons */
.reader-viewport-wrap {
    flex: 1;
    display: flex;
    position: relative;
    min-height: 0;
    z-index: 10;
    padding: 0 60px;
    /* Reduced to prevent inner overflow */
}

.reader-nav-btn {
    width: 60px;
    /* Hit area width matches outer padding */
    height: 100%;
    background: transparent !important;
    border: none !important;
    color: #94a3b8 !important;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    position: absolute;
    top: 0;
}

.reader-nav-btn svg {
    width: 32px;
    height: 32px;
}

.reader-nav-btn.prev-btn {
    left: 0;
}

.reader-nav-btn.next-btn {
    right: 0;
}

.reader-nav-btn:hover {
    background: rgba(0, 0, 0, 0.03) !important;
    color: #1e293b !important;
}

.reader-nav-btn:hover svg {
    transform: scale(1.1);
}

.reader-viewport {
    flex: 1;
    background: transparent;
}

/* Progress area */
.reader-progress-wrap {
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
}

.reader-progress-bar {
    height: 100%;
    background: var(--accent-1);
    width: 0%;
    transition: width 0.3s;
}

/* Icon Buttons Style */
.reader-icon-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #475569;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.reader-icon-btn:hover {
    background: #e2e8f0;
    color: #1a202c;
    transform: translateY(-1px);
}

.reader-close-btn {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.reader-close-btn:hover {
    background: #ef4444 !important;
    color: white !important;
    border-color: #ef4444;
}

.reader-toc-link.active-chapter {
    background: var(--accent-1);
    color: white;
    font-weight: 500;
}

/* =========================================================
   METADATA EDITOR
   ========================================================= */

.meta-icon {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.2)) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
    color: #10b981 !important;
}

.meta-form-wrap {
    animation: fadeIn 0.35s ease;
}

/* Divider with centered text */
.meta-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0 1.5rem;
}

.meta-divider::before,
.meta-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--panel-border);
}

.meta-divider span {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* 2-column responsive grid */
.meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
}

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

.meta-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.meta-field--full {
    grid-column: 1 / -1;
}

.meta-field label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

/* Shared input / textarea style */
.meta-input {
    width: 100%;
    background: rgba(241, 245, 249, 0.6);
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.meta-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

.meta-input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.meta-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

/* Save button — teal gradient, distinct from default purple */
.meta-save-btn {
    margin-top: 2rem;
    background: linear-gradient(135deg, #059669, #0891b2) !important;
    box-shadow: 0 10px 20px -5px rgba(5, 150, 105, 0.4) !important;
}

.meta-save-btn:hover:not(:disabled) {
    box-shadow: 0 15px 25px -5px rgba(5, 150, 105, 0.55) !important;
}

/* =========================================================
   COVER IMAGE INJECTOR
   ========================================================= */

.cover-icon {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(239, 68, 68, 0.2)) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
    color: #f59e0b !important;
}

/* Side-by-side two columns */
.cover-drop-row {
    display: flex;
    gap: 1.2rem;
    margin-bottom: 0.5rem;
}

.cover-drop-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.cover-col-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
}

/* Compact drop zone for the two small columns */
.cover-drop-zone {
    padding: 1.5rem 1rem !important;
    min-height: 160px;
    position: relative;
    align-items: center;
    justify-content: center;
}

/* Live cover preview image */
.cover-preview {
    position: absolute;
    inset: 6px;
    width: calc(100% - 12px);
    height: calc(100% - 12px);
    object-fit: contain;
    border-radius: 8px;
    pointer-events: none;
}

/* Small file-display row inside the cover column */
.cover-file-display {
    margin-bottom: 0;
    padding: 0.5rem 0.75rem;
}

.cover-file-display .file-name {
    font-size: 0.85rem;
}

/* Hint text under image drop */
.cover-hint-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Info row below image drop (filename + remove button) */
.cover-img-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(241, 245, 249, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 0.45rem 0.85rem;
}

.cover-img-info-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Stats chips row */
.cover-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1rem;
    animation: fadeIn 0.3s ease;
}

.cover-stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: #fbbf24;
}

/* Inject button – amber/orange gradient */
.cover-inject-btn {
    margin-top: 1.5rem;
    background: linear-gradient(135deg, #d97706, #dc2626) !important;
    box-shadow: 0 10px 20px -5px rgba(217, 119, 6, 0.4) !important;
}

.cover-inject-btn:hover:not(:disabled) {
    box-shadow: 0 15px 25px -5px rgba(217, 119, 6, 0.55) !important;
}

@media (max-width: 520px) {
    .cover-drop-row {
        flex-direction: column;
    }
}

/* =========================================================
   BATCH PROCESSING
   ========================================================= */

.batch-icon {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(59, 130, 246, 0.2)) !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
    color: #818cf8 !important;
}

/* Drop zone — taller for multiple files */
.batch-drop-zone {
    padding: 2.5rem 2rem;
}

/* File queue rows */
.batch-file-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1.2rem;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.batch-file-list::-webkit-scrollbar {
    width: 4px;
}

.batch-file-list::-webkit-scrollbar-track {
    background: transparent;
}

.batch-file-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
}

.batch-file-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    background: rgba(241, 245, 249, 0.6);
    border: 1px solid var(--panel-border);
    font-size: 0.88rem;
    transition: var(--transition);
}

.batch-file-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.batch-file-badge {
    flex-shrink: 0;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.batch-badge-queued {
    background: rgba(100, 116, 139, .15);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, .2);
}

.batch-badge-processing {
    background: rgba(99, 102, 241, .15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, .3);
    animation: batchPulse 1.2s infinite alternate;
}

.batch-badge-done {
    background: rgba(16, 185, 129, .13);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, .3);
}

.batch-badge-error {
    background: rgba(239, 68, 68, .12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, .3);
}

@keyframes batchPulse {
    from {
        opacity: 0.6;
    }

    to {
        opacity: 1.0;
    }
}

.batch-file-error-msg {
    font-size: 0.75rem;
    color: #f87171;
    margin-left: auto;
    flex-shrink: 0;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.batch-file-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: var(--transition);
    flex-shrink: 0;
}

.batch-file-remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, .1);
}

/* Collapsible options */
.batch-options {
    margin-top: 1.5rem;
    border-radius: var(--radius-md);
    background: rgba(241, 245, 249, 0.4);
    border: 1px solid var(--panel-border);
    overflow: hidden;
}

.batch-options-summary {
    padding: 0.85rem 1.2rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    list-style: none;
    user-select: none;
    transition: color var(--transition);
}

.batch-options-summary:hover {
    color: var(--text-primary);
}

.batch-options-summary::-webkit-details-marker {
    display: none;
}

.batch-options-body {
    padding: 0 1.2rem 1.2rem;
    border-top: 1px solid var(--panel-border);
}

/* Global progress bar */
.batch-progress-wrap {
    margin-top: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.batch-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.batch-progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 99px;
    overflow: hidden;
}

.batch-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
    border-radius: 99px;
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

.batch-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    animation: barShimmer 1.5s infinite;
}

@keyframes barShimmer {
    from {
        left: -60%;
    }

    to {
        left: 140%;
    }
}

/* Convert button */
.batch-convert-btn {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2)) !important;
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4) !important;
}

/* Download ZIP button */
.batch-download-btn {
    background: linear-gradient(135deg, #0ea5e9, #6366f1) !important;
    box-shadow: 0 10px 20px -5px rgba(14, 165, 233, 0.4) !important;
}

.batch-download-btn:hover:not(:disabled) {
    box-shadow: 0 15px 25px -5px rgba(14, 165, 233, 0.55) !important;
}

/* =========================================================
   AI SUMMARY GENERATOR
   ========================================================= */

.ai-icon {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(139, 92, 246, 0.2)) !important;
    border-color: rgba(236, 72, 153, 0.3) !important;
    color: #f472b6 !important;
}

.ai-config {
    margin-top: 1.5rem;
    border-radius: var(--radius-md);
    background: rgba(241, 245, 249, 0.4);
    border: 1px solid var(--panel-border);
    overflow: hidden;
}

.ai-config-summary {
    padding: 0.85rem 1.2rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    list-style: none;
    user-select: none;
    transition: color var(--transition);
}

.ai-config-summary:hover {
    color: var(--text-primary);
}

.ai-config-summary::-webkit-details-marker {
    display: none;
}

.ai-config-body {
    padding: 0 1.2rem 1.2rem;
    border-top: 1px solid var(--panel-border);
}

.ai-drop-zone {
    padding: 1.5rem 1rem !important;
    min-height: auto;
}

.ai-generate-btn {
    background: linear-gradient(135deg, #ec4899, #8b5cf6) !important;
    box-shadow: 0 10px 20px -5px rgba(236, 72, 153, 0.4) !important;
}

.ai-generate-btn:hover:not(:disabled) {
    box-shadow: 0 15px 25px -5px rgba(236, 72, 153, 0.55) !important;
}

/* Results */
.ai-results {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    animation: fadeIn 0.4s ease;
}

.ai-result-block {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.ai-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-result-header label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 0.2rem;
}

.ai-copy-btn {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid var(--panel-border);
    color: var(--text-secondary);
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.ai-copy-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

.ai-copy-btn.copied {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.3);
}

.ai-keywords-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.8rem;
    background: rgba(241, 245, 249, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    min-height: 46px;
}

.ai-keyword-chip {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* =========================================================
   CHAPTER MANAGER
   ========================================================= */

.chapter-icon {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(20, 184, 166, 0.2)) !important;
    border-color: rgba(34, 197, 94, 0.3) !important;
    color: #4ade80 !important;
}

.chapter-read-btn {
    background: linear-gradient(135deg, #10b981, #14b8a6) !important;
    box-shadow: 0 10px 20px -5px rgba(16, 185, 129, 0.4) !important;
}

.chapter-sortable-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chapter-item {
    display: flex;
    align-items: center;
    background: rgba(241, 245, 249, 0.6);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
    transition: background 0.2s, box-shadow 0.2s;
}

.chapter-item:hover,
.chapter-item.sortable-ghost {
    background: rgba(241, 245, 249, 0.9);
}

.chapter-item.sortable-drag {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    opacity: 0.9;
}

.chapter-drag-handle {
    cursor: grab;
    color: var(--text-tertiary);
    margin-right: 0.8rem;
    display: flex;
    align-items: center;
}

.chapter-drag-handle:active {
    cursor: grabbing;
}

.chapter-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chapter-item-title,
.chapter-item-title-input {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chapter-item-title-input {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: 0;
    outline: none;
    min-width: 0;
    cursor: pointer;
}

.chapter-item-title-input:focus,
.chapter-item-title-input-editing {
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(255, 255, 255, 0.72);
    border-radius: 4px;
    padding: 0.12rem 0.28rem;
    margin: -0.12rem -0.28rem;
    cursor: text;
}

.chapter-item-href {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chapter-item-remove {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 4px;
    opacity: 0.6;
    transition: var(--transition);
}

.chapter-item-remove:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
}

/* =========================================================
   EPUB EDITOR – two-column layout
   ========================================================= */

.epub-editor-layout {
    display: flex;
    gap: 0;
    height: min(78vh, 920px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

/* Left sidebar */
.epub-editor-sidebar {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--panel-border);
    background: rgba(241, 245, 249, 0.4);
}

.epub-editor-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--panel-border);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.epub-sidebar-hint {
    font-weight: 400;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    text-transform: none;
    letter-spacing: 0;
}

.epub-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

/* Active / modified chapter list items */
.chapter-item-active {
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
}

.chapter-item-modified .chapter-item-title::after {
    content: ' ●';
    color: #f59e0b;
    font-size: 0.65rem;
}

/* Right editor area */
.epub-editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.epub-editor-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.epub-editor-placeholder svg {
    opacity: 0.3;
}

.epub-editor-active-wrap {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.epub-editor-chapter-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--panel-border);
    background: rgba(241, 245, 249, 0.4);
}

.epub-editor-chapter-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ce-split-here-btn {
    background: rgba(161, 62, 39, 0.07);
    border: 1px solid #e2a07c !important;
    border-radius: 4px;
    padding: 4px 10px !important;
    font-size: 0.8rem;
    color: #a13e27 !important;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.ce-split-here-btn:hover {
    background: rgba(161, 62, 39, 0.15) !important;
    border-color: #a13e27 !important;
}
.ce-split-here-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.chapter-split-btn {
    margin-left: auto;
    background: none;
    border: 1px solid #e2a07c;
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 0.75rem;
    color: #a13e27;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}
.chapter-split-btn:hover {
    background: rgba(161, 62, 39, 0.08);
}
.chapter-split-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chapter-suggestions-wrap {
    border-bottom: 1px solid var(--panel-border, #e2e8f0);
    background: rgba(255, 248, 241, 0.75);
    padding: 0.9rem 1rem 0.8rem;
}

.chapter-suggestions-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.chapter-suggestions-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #8b3b22;
    letter-spacing: 0.01em;
}

.chapter-suggestions-summary {
    margin-top: 0.18rem;
    font-size: 0.74rem;
    color: #8a5a48;
}

.chapter-suggestions-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.chapter-suggestion-primary-btn,
.chapter-suggestion-secondary-btn {
    border-radius: 6px;
    padding: 0.38rem 0.72rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chapter-suggestion-primary-btn {
    border: 1px solid #cf7b58;
    background: #a13e27;
    color: #fff;
}

.chapter-suggestion-primary-btn:hover {
    background: #8b341f;
}

.chapter-suggestion-secondary-btn {
    border: 1px solid #e2b49e;
    background: rgba(255, 255, 255, 0.7);
    color: #8b3b22;
}

.chapter-suggestion-secondary-btn:hover {
    background: rgba(255, 255, 255, 0.95);
}

.chapter-suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-height: 170px;
    overflow-y: auto;
    padding-right: 0.2rem;
}

.chapter-suggestion-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    border: 1px solid rgba(161, 62, 39, 0.16);
    background: rgba(255, 255, 255, 0.85);
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
}

.chapter-suggestion-item input[type="checkbox"] {
    margin-top: 0.15rem;
    accent-color: #a13e27;
}

.chapter-suggestion-body {
    min-width: 0;
    flex: 1;
}

.chapter-suggestion-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: #3b241c;
    line-height: 1.35;
}

.chapter-suggestion-meta {
    margin-top: 0.12rem;
    font-size: 0.72rem;
    color: #8a5a48;
}

.ce-suggestion-candidate {
    scroll-margin-top: 18px;
}

.ce-suggestion-selected {
    outline: 2px solid rgba(161, 62, 39, 0.35);
    outline-offset: 3px;
    background: rgba(255, 243, 235, 0.7);
}

.epub-editor-badge {
    font-size: 0.7rem;
    font-weight: 600;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
    white-space: nowrap;
}

/* Quill dark theme overrides */
#quill-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.ql-toolbar.ql-snow {
    background: rgba(241, 245, 249, 0.6);
    border-color: var(--panel-border) !important;
    border-left: none;
    border-right: none;
    border-top: none;
}

.ql-container.ql-snow {
    border: none !important;
    font-size: 0.95rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.ql-editor {
    background: transparent;
    color: var(--text-primary);
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    font-family: var(--font-body, 'Inter', sans-serif);
    line-height: 1.7;
    padding: 1rem 1.2rem;
}

/* ── ContentEditable editor (replaces Quill) ─────────────────────────── */
.ce-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--panel-border, #e2e8f0);
    background: rgba(241, 245, 249, 0.5);
    border-radius: 8px 8px 0 0;
    flex-wrap: wrap;
}
.ce-toolbar button {
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    min-width: 28px;
    text-align: center;
}
.ce-toolbar button:hover {
    background: rgba(161, 62, 39, 0.08);
    border-color: var(--panel-border);
}
.ce-toolbar select {
    border: 1px solid var(--panel-border, #e2e8f0);
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 0.8rem;
    background: #fff;
    color: var(--text-primary);
    cursor: pointer;
}
.ce-sep {
    width: 1px;
    height: 20px;
    background: var(--panel-border, #e2e8f0);
    margin: 0 4px;
}

.ce-editor {
    background: #fff;
    color: #1a1a1a;
    min-height: 520px;
    max-height: none;
    overflow-y: auto;
    font-family: var(--font-body, 'Inter', sans-serif);
    line-height: 1.7;
    padding: 1.2rem 1.5rem;
    border: 1px solid var(--panel-border, #e2e8f0);
    border-top: none;
    border-radius: 0 0 8px 8px;
    outline: none;
}
.ce-editor:focus {
    box-shadow: inset 0 0 0 2px rgba(161, 62, 39, 0.15);
}
.ce-editor:empty::before {
    content: 'Select a chapter to edit…';
    color: var(--text-tertiary);
    font-style: italic;
}

/* Images & SVGs in the editor */
.ce-editor img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0.5rem 0;
}
.ce-editor svg {
    max-width: 100%;
    height: auto;
    max-height: 400px;
    display: block;
}

/* Quill toolbar icon colours */
.ql-snow .ql-stroke {
    stroke: var(--text-secondary) !important;
}

.ql-snow .ql-fill {
    fill: var(--text-secondary) !important;
}

.ql-snow .ql-picker {
    color: var(--text-secondary) !important;
}

.ql-snow .ql-picker-options {
    background: #ffffff !important;
    border-color: var(--panel-border) !important;
    color: var(--text-primary) !important;
}

.ql-snow .ql-picker-item:hover,
.ql-snow .ql-picker-item.ql-selected {
    color: #4ade80 !important;
}

.ql-snow button:hover .ql-stroke,
.ql-snow button.ql-active .ql-stroke {
    stroke: #4ade80 !important;
}

.ql-snow button:hover .ql-fill,
.ql-snow button.ql-active .ql-fill {
    fill: #4ade80 !important;
}

.ql-snow .ql-picker-label:hover,
.ql-snow .ql-picker-label.ql-active {
    color: #4ade80 !important;
}

.ql-snow .ql-picker-label:hover .ql-stroke,
.ql-snow .ql-picker-label.ql-active .ql-stroke {
    stroke: #4ade80 !important;
}

/* =========================================================
   FONT EMBEDDING
   ========================================================= */

.font-icon {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(167, 139, 250, 0.2)) !important;
    border-color: rgba(139, 92, 246, 0.3) !important;
    color: #a78bfa !important;
}

.font-submit-btn {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed) !important;
    box-shadow: 0 10px 20px -5px rgba(139, 92, 246, 0.4) !important;
}

.font-epub-drop-zone.drag-active,
.font-file-drop-zone.drag-active {
    border-color: var(--accent-primary);
    background: rgba(139, 92, 246, 0.05);
}

/* =========================================================
   DIFF VIEWER
   ========================================================= */

.diff-icon {
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.2), rgba(74, 222, 128, 0.2)) !important;
    border-color: rgba(248, 113, 113, 0.3) !important;
    color: #f87171 !important;
}

.diff-submit-btn {
    background: linear-gradient(135deg, #f87171, #4ade80) !important;
    box-shadow: 0 10px 20px -5px rgba(248, 113, 113, 0.3) !important;
}

.diff-output-container {
    background: rgba(241, 245, 249, 0.6);
    border-radius: 12px;
    border: 1px solid var(--panel-border);
    overflow: hidden;
    animation: slideUp 0.4s ease-out;
}

.diff-a-drop-zone.drag-active {
    border-color: #f87171;
    background: rgba(248, 113, 113, 0.05);
}

.diff-b-drop-zone.drag-active {
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.05);
}

/* Override diff2html defaults */
.d2h-file-header {
    background-color: rgba(241, 245, 249, 0.8) !important;
    border-bottom: 1px solid var(--panel-border) !important;
}

.d2h-file-name-wrapper {
    color: var(--text-primary) !important;
}

.d2h-code-line-ctn {
    color: var(--text-primary) !important;
}

/* =========================================================
   AUDIOBOOK GENERATOR
   ========================================================= */

.audio-icon {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(251, 191, 36, 0.2)) !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
    color: #f59e0b !important;
}

.audio-submit-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    box-shadow: 0 10px 20px -5px rgba(245, 158, 11, 0.4) !important;
}

.audio-drop-zone.drag-active {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

/* SITE HEADER */
.site-header { position:fixed; top:0; left:0; right:0; z-index:100; background:rgba(255,255,255,0.92); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px); border-bottom:1px solid var(--panel-border); height:68px; }
.site-header-inner { max-width:1200px; margin:0 auto; padding:0 2rem; height:68px; display:flex; align-items:center; gap:2rem; }
.site-logo { font-family:Outfit,sans-serif; font-size:1.55rem; font-weight:800; color:var(--text-primary); text-decoration:none; flex-shrink:0; letter-spacing:-0.01em; }
.logo-accent { color:var(--accent-1); }
.site-logo-img { height:44px; width:auto; display:block; }
.site-nav { display:flex; gap:2rem; margin-left:auto; align-items:center; }
.nav-link { color:var(--text-secondary); text-decoration:none; font-family:Inter,sans-serif; font-size:0.92rem; font-weight:500; transition:color 0.2s; }
.nav-link:hover { color:var(--accent-1); }
.hamburger { display:none; flex-direction:column; gap:5px; background:none; border:none; cursor:pointer; padding:0.3rem; margin-left:auto; }
.hamburger span { display:block; width:22px; height:2px; background:var(--text-primary); border-radius:2px; transition:all 0.3s; }

/* PROMO BANNER */
.promo-banner { background:#fdf0ec; color:var(--text-primary); text-align:center; padding:0.6rem 1rem; font-family:Outfit,sans-serif; font-size:0.9rem; font-weight:500; display:flex; align-items:center; justify-content:center; gap:0.5rem; border-bottom:1px solid var(--panel-border); margin-bottom: 2rem; }
.promo-banner svg { color:var(--accent-1); flex-shrink:0; }
.promo-banner a { color:var(--accent-1); font-weight:700; text-decoration:none; border-bottom:2px solid var(--accent-1); padding-bottom:1px; }

/* HERO */
.hero-section { background:linear-gradient(135deg, #822712 0%, #3d0600 55%, #241917 100%); padding:6rem 2rem 5rem; text-align:center; position:relative; overflow:hidden; }
.hero-section::before { content:''; position:absolute; inset:0; background:radial-gradient(ellipse 80% 60% at 50% 0%, rgba(240,121,93,0.18) 0%, transparent 70%); pointer-events:none; }
.hero-inner { max-width:760px; margin:0 auto; position:relative; z-index:1; }
.hero-badge { display:inline-block; background:rgba(240,121,93,0.2); border:1px solid rgba(240,121,93,0.4); color:#ffb4a3; padding:0.35rem 1rem; border-radius:999px; font-family:Inter,sans-serif; font-size:0.82rem; font-weight:600; margin-bottom:1.5rem; }
.hero-title { font-family:Newsreader,serif; font-size:clamp(2.4rem,6vw,4rem); font-weight:800; line-height:1.1; letter-spacing:-1.5px; color:#ffffff; margin-bottom:1.25rem; }
.hero-subtitle { font-family:Inter,sans-serif; font-size:clamp(1rem,2vw,1.15rem); color:#94a3b8; max-width:580px; margin:0 auto 2.5rem; line-height:1.75; }
.hero-ctas { display:flex; gap:1rem; justify-content:center; flex-wrap:wrap; margin-bottom:3rem; }
.btn-primary { background:var(--accent-1); color:#fff; padding:0.875rem 2rem; border-radius:999px; font-family:Inter,sans-serif; font-weight:600; font-size:0.95rem; text-decoration:none; border:none; cursor:pointer; transition:background 0.2s,transform 0.15s,box-shadow 0.2s; display:inline-block; box-shadow:0 4px 15px rgba(161,62,39,0.4); }
.btn-primary:hover { background:var(--accent-2); transform:translateY(-2px); box-shadow:0 6px 20px rgba(161,62,39,0.5); }
.btn-outline { background:transparent; color:#fff; padding:0.875rem 2rem; border-radius:999px; font-family:Inter,sans-serif; font-weight:600; font-size:0.95rem; text-decoration:none; border:2px solid rgba(255,255,255,0.3); cursor:pointer; transition:all 0.2s; display:inline-block; }
.btn-outline:hover { background:rgba(255,255,255,0.1); border-color:rgba(255,255,255,0.6); transform:translateY(-2px); }
.btn-lg { padding:1rem 2.5rem; font-size:1rem; }
.hero-stats { display:flex; gap:2rem; justify-content:center; align-items:center; flex-wrap:wrap; }
.hero-stat { display:flex; flex-direction:column; align-items:center; gap:0.15rem; }
.hero-stat strong { font-family:Outfit,sans-serif; font-size:1.5rem; font-weight:800; color:#ffffff; }
.hero-stat span { font-family:Inter,sans-serif; font-size:0.8rem; color:#94a3b8; text-transform:uppercase; letter-spacing:0.5px; }
.hero-stat-sep { width:1px; height:40px; background:rgba(255,255,255,0.15); }

/* SECTIONS */
.section-header { text-align:center; margin-bottom:3rem; }
.section-header h2 { font-family:Newsreader,serif; font-size:clamp(1.8rem,4vw,2.4rem); font-weight:800; color:var(--text-primary); margin-bottom:0.5rem; letter-spacing:-0.5px; }
.section-header p { font-family:Inter,sans-serif; font-size:1rem; color:var(--text-secondary); }

/* TOOLS GRID */
.tools-section { max-width:1200px; margin:0 auto; padding:3rem 2rem 5rem; }
.tools-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:1.25rem; }
.tool-card { background:var(--panel-bg); border:1px solid var(--panel-border); border-radius:var(--radius-lg); padding:1.25rem 1.5rem; display:flex; align-items:center; gap:1.1rem; cursor:pointer; transition:transform 0.2s,box-shadow 0.2s,border-color 0.2s; box-shadow:0 2px 8px rgba(15,23,42,0.06); text-decoration:none; }
.tool-card:hover { transform:translateY(-3px); box-shadow:0 10px 28px rgba(15,23,42,0.12); border-color:#c7d2fe; }
.tool-card-icon { width:50px; height:50px; border-radius:12px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.tool-card-body { flex:1; min-width:0; }
.tool-card-body h3 { font-family:Newsreader,serif; font-size:1.15rem; font-weight:700; color:var(--text-primary); margin-bottom:0.25rem; }
.tool-card-body p { font-family:Inter,sans-serif; font-size:0.8rem; color:var(--text-secondary); line-height:1.4; }
.tool-card-arrow { color:var(--text-secondary); font-size:1.1rem; flex-shrink:0; transition:transform 0.2s,color 0.2s; }
.tool-card:hover .tool-card-arrow { transform:translateX(4px); color:var(--accent-1); }

/* Locked tool card badge */
.tool-card-locked { position:relative; }
.tool-lock-badge {
    display:inline-block;
    background:linear-gradient(135deg,#f0795d,#a13e27);
    color:#fff;
    font-size:0.65rem;
    font-weight:700;
    letter-spacing:0.04em;
    padding:0.2rem 0.55rem;
    border-radius:999px;
    white-space:nowrap;
    flex-shrink:0;
    text-transform:uppercase;
}

/* HOW IT WORKS */
.hiw-section { background:#f1f5f9; border-top:1px solid var(--panel-border); border-bottom:1px solid var(--panel-border); padding:5rem 2rem; }
.hiw-steps { display:flex; align-items:center; gap:1.5rem; max-width:900px; margin:0 auto; flex-wrap:wrap; justify-content:center; }
.hiw-step { flex:1; min-width:200px; max-width:280px; text-align:center; padding:2rem 1.5rem; background:var(--panel-bg); border:1px solid var(--panel-border); border-radius:var(--radius-lg); }
.hiw-num { width:48px; height:48px; background:var(--accent-1); color:#fff; border-radius:50%; display:flex; align-items:center; justify-content:center; font-family:Outfit,sans-serif; font-size:1.25rem; font-weight:800; margin:0 auto 1rem; }
.hiw-step h3 { font-family:Newsreader,serif; font-size:1.15rem; font-weight:700; color:var(--text-primary); margin-bottom:0.5rem; }
.hiw-step p { font-family:Inter,sans-serif; font-size:0.88rem; color:var(--text-secondary); line-height:1.6; }
.hiw-arrow { color:var(--text-secondary); flex-shrink:0; }

/* PRICING */
.pricing-section { max-width:1100px; margin:0 auto; padding:5rem 2rem; }
.pricing-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:1.5rem; max-width:1060px; margin:0 auto; }
.pricing-card { background:var(--panel-bg); border:1px solid var(--panel-border); border-radius:var(--radius-lg); padding:2rem; position:relative; display:flex; flex-direction:column; box-shadow:0 4px 14px rgba(36,25,23,0.07); }
.pricing-card-featured { border-color:var(--accent-1); box-shadow:0 8px 32px rgba(161,62,39,0.18); }
.pricing-card-sub { border-color:#2d8b4f; box-shadow:0 8px 28px rgba(45,139,79,0.13); }
.pricing-card-enterprise { border-style:dashed; opacity:0.85; }
.pricing-popular-badge { position:absolute; top:-13px; left:50%; transform:translateX(-50%); background:var(--accent-1); color:#fff; padding:0.2rem 1rem; border-radius:999px; font-family:Inter,sans-serif; font-size:0.72rem; font-weight:700; white-space:nowrap; text-transform:uppercase; letter-spacing:0.5px; }
.pricing-popular-badge-green { background:#2d8b4f; }
.pricing-tier { font-family:Outfit,sans-serif; font-size:1.2rem; font-weight:800; color:var(--text-primary); margin-bottom:0.4rem; }
.pricing-price { display:flex; align-items:baseline; gap:0.3rem; margin-bottom:0.4rem; }
.price-amount { font-family:Outfit,sans-serif; font-size:2.4rem; font-weight:800; color:var(--text-primary); }
.price-period { font-family:Inter,sans-serif; font-size:0.88rem; color:var(--text-secondary); }
.pricing-tagline { font-family:Inter,sans-serif; font-size:0.87rem; color:var(--text-secondary); margin-bottom:1.5rem; }
.pricing-features { list-style:none; display:flex; flex-direction:column; gap:0.7rem; margin-bottom:2rem; flex:1; }
.pricing-features li { display:flex; align-items:flex-start; gap:0.55rem; font-family:Inter,sans-serif; font-size:0.875rem; color:var(--text-primary); line-height:1.4; }
.pricing-feature-muted { color:var(--text-secondary) !important; }
.check-icon { width:15px; height:15px; stroke:#2d8b4f; flex-shrink:0; margin-top:2px; }
.x-icon { width:15px; height:15px; stroke:#c53030; flex-shrink:0; margin-top:2px; }
.pricing-btn { display:block; text-align:center; padding:0.8rem 1.5rem; border-radius:999px; font-family:Inter,sans-serif; font-weight:600; font-size:0.9rem; text-decoration:none; cursor:pointer; border:none; transition:all 0.2s; }
.pricing-btn-outline { border:2px solid var(--accent-1); color:var(--accent-1); background:transparent; }
.pricing-btn-outline:hover { background:var(--accent-1); color:#fff; }
.pricing-btn-primary { background:var(--accent-1); color:#fff; }
.pricing-btn-primary:hover { background:var(--accent-2); }
.pricing-btn-sub { background:#2d8b4f; color:#fff; }
.pricing-btn-sub:hover { background:#236040; }

/* FAQ */
.faq-section { background:#f1f5f9; border-top:1px solid var(--panel-border); border-bottom:1px solid var(--panel-border); padding:5rem 2rem; }
.faq-list { max-width:780px; margin:0 auto; border:1px solid var(--panel-border); border-radius:var(--radius-lg); overflow:hidden; }
.faq-item { border-bottom:1px solid var(--panel-border); background:var(--panel-bg); }
.faq-item:last-child { border-bottom:none; }
.faq-item summary { padding:1.2rem 1.5rem; cursor:pointer; font-family:Inter,sans-serif; font-weight:600; font-size:0.93rem; color:var(--text-primary); list-style:none; display:flex; justify-content:space-between; align-items:center; gap:1rem; user-select:none; }
.faq-item summary::-webkit-details-marker { display:none; }
.faq-item summary::after { content:"+"; font-size:1.2rem; color:var(--accent-1); flex-shrink:0; }
.faq-item[open] summary::after { content:"-"; }
.faq-item p { padding:0 1.5rem 1.25rem; font-family:Inter,sans-serif; font-size:0.88rem; color:var(--text-secondary); line-height:1.75; }

/* CONTACT */
.contact-section { max-width:1100px; margin:0 auto; padding:5rem 2rem; text-align:center; }
.contact-inner { max-width:480px; margin:0 auto; }
.contact-inner h2 { font-family:Newsreader,serif; font-size:2.2rem; font-weight:800; color:var(--text-primary); margin-bottom:0.75rem; }
.contact-inner p { font-family:Inter,sans-serif; color:var(--text-secondary); margin-bottom:1.5rem; line-height:1.7; }
.contact-email { display:inline-block; color:var(--accent-1); font-family:Inter,sans-serif; font-weight:700; font-size:1.05rem; text-decoration:none; border-bottom:2px solid var(--accent-1); padding-bottom:2px; transition:opacity 0.2s; }
.contact-email:hover { opacity:0.7; }

/* TOOL VIEW */
#tool-view { min-height:60vh; }
.tool-view-nav { position:sticky; top:110px; z-index:90; background:rgba(248,250,252,0.97); backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px); border-bottom:1px solid var(--panel-border); padding:0.75rem 2rem; display:flex; align-items:center; gap:1.25rem; }
.back-btn { display:flex; align-items:center; gap:0.5rem; background:none; border:1px solid var(--panel-border); color:var(--text-primary); padding:0.45rem 1rem; border-radius:999px; cursor:pointer; font-family:Inter,sans-serif; font-size:0.85rem; font-weight:600; transition:all 0.2s; }
.back-btn:hover { background:var(--accent-1); color:#fff; border-color:var(--accent-1); }
.tool-view-title { font-family:Newsreader,serif; font-size:1.25rem; font-weight:700; color:var(--text-primary); }
.tool-container { max-width:860px; margin:0 auto; padding:2rem; display:flex; flex-direction:column; gap:0; }

/* STATIC PAGES */
.static-page { max-width:780px; margin:0 auto; padding:3rem 2rem 6rem; min-height:60vh; }
.static-page h1 { font-family:Outfit,sans-serif; font-size:2.2rem; font-weight:800; color:var(--text-primary); margin-bottom:0.5rem; letter-spacing:-0.5px; }
.static-page h2 { font-family:Outfit,sans-serif; font-size:1.2rem; font-weight:700; color:var(--text-primary); margin:2rem 0 0.6rem; }
.static-page p, .static-page li { font-family:Inter,sans-serif; font-size:0.93rem; color:var(--text-secondary); line-height:1.85; margin-bottom:0.6rem; }
.static-page ul { padding-left:1.5rem; margin-bottom:1rem; }
.page-back-btn { margin-bottom:2rem; }

/* FOOTER */
.site-footer { background:#f1f5f9; border-top:1px solid var(--panel-border); padding:4rem 2rem 2rem; }
.footer-inner { max-width:1200px; margin:0 auto; }
.footer-top { display:grid; grid-template-columns:210px 1fr; gap:3rem; margin-bottom:3rem; }
.footer-logo { font-family:Outfit,sans-serif; font-size:1.3rem; font-weight:800; color:var(--text-primary); margin-bottom:0.65rem; }
.footer-logo span { color:var(--accent-1); }
.footer-brand p { font-family:Inter,sans-serif; font-size:0.83rem; color:var(--text-secondary); line-height:1.6; }
.footer-nav { display:grid; grid-template-columns:repeat(4,1fr); gap:2rem; }
.footer-nav-col { display:flex; flex-direction:column; gap:0.55rem; }
.footer-nav-col strong { font-family:Inter,sans-serif; font-size:0.75rem; font-weight:700; color:var(--text-primary); text-transform:uppercase; letter-spacing:0.6px; margin-bottom:0.2rem; }
.footer-nav-col a { font-family:Inter,sans-serif; font-size:0.855rem; color:var(--text-secondary); text-decoration:none; transition:color 0.2s; cursor:pointer; }
.footer-nav-col a:hover { color:var(--accent-1); }
.footer-bottom { border-top:1px solid var(--panel-border); padding-top:1.5rem; display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:0.75rem; }
.footer-bottom p { font-family:Inter,sans-serif; font-size:0.78rem; color:var(--text-secondary); }
.cookie-settings-link { font-family:Inter,sans-serif; font-size:0.78rem; color:var(--text-secondary); text-decoration:none; border-bottom:1px solid currentColor; cursor:pointer; }

/* COOKIE BANNER */
.cookie-banner { position:fixed; bottom:1.5rem; left:50%; transform:translateX(-50%); width:calc(100% - 3rem); max-width:800px; z-index:200; background:var(--panel-bg); backdrop-filter:blur(16px); -webkit-backdrop-filter:blur(16px); border:1px solid var(--panel-border); border-radius:var(--radius-lg); box-shadow:0 8px 40px rgba(0,0,0,0.1); padding:1.25rem 1.5rem; }
.cookie-banner-inner { display:flex; align-items:center; gap:1.5rem; flex-wrap:wrap; }
.cookie-banner-inner p { font-family:Inter,sans-serif; font-size:0.875rem; color:var(--text-secondary); flex:1; min-width:200px; line-height:1.5; }
.cookie-banner-inner p a { color:var(--accent-1); text-decoration:underline; cursor:pointer; }
.cookie-banner-btns { display:flex; gap:0.75rem; flex-shrink:0; }
.cookie-btn { padding:0.5rem 1.25rem; border-radius:999px; font-family:Inter,sans-serif; font-size:0.83rem; font-weight:600; cursor:pointer; border:none; transition:all 0.2s; }
.cookie-btn-accept { background:var(--accent-1); color:#fff; }
.cookie-btn-accept:hover { background:var(--accent-2); }
.cookie-btn-reject { background:transparent; border:1px solid var(--panel-border); color:var(--text-secondary); }
.cookie-btn-reject:hover { background:rgba(15,23,42,0.05); }

/* RESPONSIVE */
@media (max-width:900px) {
    .footer-top { grid-template-columns:1fr; gap:2rem; }
    .footer-nav { grid-template-columns:repeat(2,1fr); gap:1.5rem; }
}
@media (max-width:768px) {
    .site-nav { display:none; }
    .site-nav.open { display:flex; flex-direction:column; position:fixed; top:110px; left:0; right:0; background:rgba(255,255,255,0.98); padding:1.5rem 2rem; gap:1.2rem; border-bottom:1px solid var(--panel-border); z-index:98; box-shadow:0 8px 20px rgba(0,0,0,0.05); }
    .hamburger { display:flex; }
    .hiw-steps { flex-direction:column; align-items:stretch; }
    .hiw-arrow { transform:rotate(90deg); display:flex; justify-content:center; }
    .hiw-step { max-width:100%; }
    .tools-grid { grid-template-columns:1fr; }
    .pricing-grid { grid-template-columns:1fr; }
    .tool-container { padding:1rem; }
    .tool-view-nav { top:110px; padding:0.6rem 1rem; }
}
@media (max-width:480px) {
    .hero-ctas { flex-direction:column; align-items:center; }
    .cookie-banner-btns { width:100%; }
    .cookie-btn { flex:1; text-align:center; }
    .footer-nav { grid-template-columns:1fr; }
    .header-auth { display: none; }
}

/* ═══════════════════════════════════════════
   HEADER AUTH CONTROLS
═══════════════════════════════════════════ */
.header-auth {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
    border-radius: 8px;
}

/* btn-outline inside the light header needs dark colours */
.header-auth .btn-outline {
    color: var(--text-primary);
    border-color: var(--panel-border);
    background: transparent;
}
.header-auth .btn-outline:hover {
    background: var(--panel-bg);
    border-color: var(--accent-1);
    color: var(--accent-1);
    transform: none;
}

.header-user {
    position: relative;
    margin-left: 12px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-primary);
    transition: var(--transition);
}
.user-badge:hover { border-color: var(--accent-1); }

.plan-chip {
    background: var(--accent-1);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.plan-chip.pro   { background: #059669; }
.plan-chip.one_book { background: #d97706; }

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 8px;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
    z-index: 200;
}
.user-dropdown hr { border: none; border-top: 1px solid var(--panel-border); margin: 6px 0; }
.user-dropdown-email { font-size: 0.78rem; color: var(--text-secondary); padding: 4px 8px; word-break: break-all; }
.user-dropdown a {
    display: block;
    padding: 8px 10px;
    font-size: 0.85rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.15s;
}
.user-dropdown a:hover { background: var(--bg-color); }

/* ═══════════════════════════════════════════
   AUTH MODAL
═══════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.55);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-box {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    padding: 32px 28px 28px;
    width: 100%;
    max-width: 420px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.15s;
}
.modal-close:hover { background: var(--bg-color); }

.modal-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-color);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 20px;
}
.promo-banner {
    background: #fdf0ec;
    color: var(--text-primary);
    text-align: center;
    padding: 0.6rem 1rem;
    font-family: Outfit, sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--panel-border);
    margin-bottom: 2rem;
}
.modal-tab {
    flex: 1;
    padding: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    background: none;
    border-radius: 7px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}
.modal-tab.active {
    background: #fff;
    color: var(--accent-1);
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.btn-google {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 11px;
    background: #fff;
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
    margin-bottom: 16px;
}
.btn-google:hover { border-color: #4285F4; box-shadow: 0 2px 8px rgba(66,133,244,0.15); }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--panel-border);
}

.form-group {
    margin-bottom: 14px;
}
.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
}
.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--bg-color);
    color: var(--text-primary);
    transition: border-color 0.2s;
}
.form-group input:focus {
    outline: none;
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px rgba(161,62,39,0.1);
}

.input-pw-wrap {
    position: relative;
}
.input-pw-wrap input { padding-right: 40px; }
.pw-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 2px;
}

.btn-full { width: 100%; margin-top: 4px; }

.auth-switch-text {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 14px;
}
.auth-switch-text a { color: var(--accent-1); }

.auth-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.85rem;
    margin-bottom: 14px;
}

/* =========================================================
   TOOL VIEW – Sidebar Layout
   ========================================================= */
.tool-layout {
    display: flex;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 70vh;
}

.tool-sidebar {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 130px;
    align-self: flex-start;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.tool-sidebar-heading {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    padding: 0 0.5rem;
}

.tool-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tool-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.tool-sidebar-link:hover {
    background: rgba(161, 62, 39, 0.06);
    color: var(--text-primary);
}

.tool-sidebar-link.active {
    background: rgba(161, 62, 39, 0.1);
    color: var(--accent-1);
    font-weight: 600;
    border-left-color: var(--accent-1);
}

.tool-sidebar-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Tip Cards */
.tool-sidebar-tips {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.tool-tip-card {
    border-radius: 10px;
    padding: 1rem;
    border-left: 3px solid;
}

.tool-tip-card h5 {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.tool-tip-card p {
    font-family: var(--font-body);
    font-size: 0.78rem;
    line-height: 1.55;
}

.tool-tip-card--warm {
    background: rgba(240, 121, 93, 0.08);
    border-left-color: var(--accent-1);
}
.tool-tip-card--warm h5 { color: var(--accent-1); }
.tool-tip-card--warm p { color: var(--accent-2); }

.tool-tip-card--teal {
    background: rgba(0, 107, 94, 0.06);
    border-left-color: #006b5e;
}
.tool-tip-card--teal h5 { color: #006b5e; }
.tool-tip-card--teal p { color: #57423d; }

/* Override tool-container inside layout */
.tool-layout .tool-container {
    flex: 1;
    min-width: 0;
    max-width: none;
    padding: 0;
}

/* Responsive: collapse sidebar on small screens */
@media (max-width: 900px) {
    .tool-layout {
        flex-direction: column;
        padding: 1rem;
    }
    .tool-sidebar {
        width: 100%;
        position: static;
        max-height: none;
        flex-direction: row;
        overflow-x: auto;
        gap: 0.5rem;
    }
    .tool-sidebar-section { width: 100%; }
    .tool-sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        gap: 4px;
        padding-bottom: 0.5rem;
    }
    .tool-sidebar-link {
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: 0.5rem 0.75rem;
    }
    .tool-sidebar-link.active {
        border-left-color: transparent;
        border-bottom-color: var(--accent-1);
    }
    .tool-sidebar-tips { display: none; }
    .tool-sidebar-heading { display: none; }
}
