* { box-sizing: border-box; font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif; }
html, body { min-height: 100%; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }

.login-body {
    min-height: 100vh;
    background: radial-gradient(circle at top left, #3d414a, #17191d 55%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.login-card {
    width: min(420px, 100%);
    background: #fff;
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 24px 80px rgba(0,0,0,.28);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.login-card h1 { margin: 0; color: #0f172a; font-size: 1.55rem; letter-spacing: -.04em; }
.login-card p { margin: 0 0 8px; color: #64748b; font-size: .9rem; }
.login-card label, .field-label { color: #475569; font-size: 12px; font-weight: 800; letter-spacing: .03em; }
.login-card input { width: 100%; padding: 13px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; }
.login-card small { color: #94a3b8; font-size: 11px; }
.login-mark { color: #e62e3d; font-size: 2.5rem; font-weight: 950; letter-spacing: -.07em; }

.app-body {
    background-color: #2b2d31;
    padding: 20px;
    display: flex;
    gap: 25px;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
}
.sidebar {
    width: 430px;
    min-width: 360px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 40px);
    overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.sidebar-header {
    padding: 18px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 12px 12px 0 0;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.sidebar-header h2 { margin: 0; font-size: 1.1rem; color: #0f172a; letter-spacing: -0.5px; }
.sidebar-header p { margin: 5px 0 0; font-size: 0.8rem; color: #64748b; }
.sidebar-header a { color: #e62e3d; font-weight: 700; }
.new-link { background: #e62e3d; color: #fff !important; padding: 9px 12px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.sidebar-content { padding: 20px; display: flex; flex-direction: column; gap: 24px; }
.sidebar-content section { display: flex; flex-direction: column; gap: 10px; }
.section-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; color: #94a3b8; margin: 0; font-weight: 800; }

input[type="text"], input[type="email"], input[type="password"], textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    font-size: 13px;
    color: #334155;
    transition: border-color 0.2s, background .2s;
}
input:focus, textarea:focus { outline: none; border-color: #94a3b8; background: #fff; }
textarea { height: 230px; font-family: 'Courier New', monospace; resize: vertical; line-height: 1.45; }
.btn {
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn.compact { width: auto; padding: 11px 13px; }
.btn-primary { background: #e62e3d; color: white; }
.btn-primary:hover { background: #c92432; transform: translateY(-1px); }
.btn-outline { background: white; border: 1px solid #e2e8f0; color: #475569; }
.btn-outline:hover { background: #f1f5f9; }
.btn-dark { background: #0f172a; color: white; }
.btn-dark:hover { background: #1e293b; }
.search-form { display: flex; gap: 8px; align-items: center; }
.alert { padding: 12px; border-radius: 10px; font-size: 12px; font-weight: 700; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.empty-state { padding: 15px; text-align: center; color: #94a3b8; font-size: 12px; background: #f8fafc; border-radius: 8px; border: 1px dashed #cbd5e1; }
.library-list { display: flex; flex-direction: column; gap: 10px; max-height: 330px; overflow-y: auto; padding-right: 3px; }
.lib-item { background: white; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px; transition: box-shadow 0.2s, border-color .2s; }
.lib-item:hover, .lib-item.active { box-shadow: 0 4px 12px rgba(0,0,0,0.05); border-color: #cbd5e1; }
.lib-item.active { outline: 2px solid rgba(230,46,61,.08); }
.lib-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.lib-title { font-size: 13px; font-weight: 800; color: #1e293b; line-height: 1.4; word-break: break-word; }
.lib-date { font-size: 11px; color: #94a3b8; margin-top: 4px; display: block; }
.badge { font-size: 10px; padding: 5px 9px; border-radius: 20px; font-weight: 800; text-transform: uppercase; cursor: pointer; border: none; white-space: nowrap; }
.badge.draft { background: #f1f5f9; color: #64748b; }
.badge.sent { background: #dcfce3; color: #166534; }
.lib-actions { display: flex; gap: 8px; border-top: 1px solid #f1f5f9; padding-top: 10px; }
.lib-actions form { margin: 0; }
.action-icon { background: none; border: none; font-size: 12px; cursor: pointer; color: #64748b; padding: 5px 7px; border-radius: 4px; display: inline-flex; }
.action-icon:hover { background: #f1f5f9; color: #0f172a; }
.action-icon.delete:hover { color: #e62e3d; background: #fef2f2; }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; background: #f8fafc; padding: 10px; border-radius: 8px; border: 1px solid #e2e8f0; }
.toolbar button { padding: 6px 12px; border: 1px solid #cbd5e1; background: white; cursor: pointer; border-radius: 6px; font-size: 12px; font-weight: 700; color: #475569; }
.toolbar button:hover { background: #e2e8f0; color: #0f172a; }
.upload-box { background: #f8fafc; padding: 12px; border-radius: 8px; border: 1px solid #e2e8f0; display: flex; flex-direction: column; gap: 8px; }
.upload-box label { font-size: 11px; font-weight: 800; color: #64748b; }
.upload-box input[type="file"] { font-size: 11px; width: 100%; }
.upload-box small { color: #94a3b8; font-size: 11px; }

.align-tools {
    background: #fff7ed;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #fed7aa;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.align-tools label {
    font-size: 11px;
    font-weight: 900;
    color: #9a3412;
    letter-spacing: .04em;
}
.align-tools small {
    color: #9a3412;
    font-size: 11px;
    line-height: 1.45;
}
.mini-tool {
    width: 100%;
    border: 1px solid #fdba74;
    background: #ffffff;
    color: #7c2d12;
    border-radius: 8px;
    padding: 9px 10px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
}
.mini-tool:hover { background: #ffedd5; }

.document-container { height: calc(100vh - 40px); overflow-y: auto; padding-right: 15px; }
.document-container::-webkit-scrollbar { width: 8px; }
.document-container::-webkit-scrollbar-track { background: transparent; }
.document-container::-webkit-scrollbar-thumb { background: #475569; border-radius: 10px; }
.document-wrapper { display: flex; flex-direction: column; gap: 20px; align-items: center; }
.a4-page { width: 210mm; min-height: 297mm; margin: 0; box-shadow: 0 4px 20px rgba(0,0,0,0.4); box-sizing: border-box; position: relative; }
.cover-page { background-color: #e62e3d; color: white; overflow: hidden; }
.cover-guide {
    display: none;
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 5;
    pointer-events: none;
    border-left: 1px dashed rgba(255,255,255,.78);
}
.cover-guide::after {
    content: 'İç sayfa metin hizası';
    position: absolute;
    top: 12px;
    left: 8px;
    white-space: nowrap;
    background: rgba(15,23,42,.7);
    color: #fff;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .02em;
}
.guide-left { left: var(--guide-left, 25mm); }
.guide-right { left: var(--guide-right, 185mm); opacity: .32; }
.guide-right::after { content: 'Sağ güvenli alan'; }
.cover-page.guides-active .cover-guide,
.cover-page.guides-pinned .cover-guide { display: block; }
.draggable-item { position: absolute; z-index: 10; }
.draggable-item.is-snapped { outline: 1px dashed rgba(255,255,255,.85); outline-offset: 4px; }
.drag-handle { background: rgba(0, 0, 0, 0.4); color: white; text-align: center; padding: 4px; font-size: 11px; cursor: grab; opacity: 0; transition: opacity 0.2s; border-radius: 4px 4px 0 0; user-select: none; }
.draggable-item:hover .drag-handle, .cover-page.guides-active .drag-handle { opacity: 1; }
.drag-handle:active { cursor: grabbing; background: rgba(0, 0, 0, 0.8); }
#bengLogo { width: 100%; display: block; pointer-events: none; }
#textBox { width: 85%; }
.cover-text-content { border-top: 1px solid rgba(255, 255, 255, 0.6); padding-top: 25px; text-align: left; font-weight: bold; outline: none; }
.cover-text-content #cvMeta { font-size: 1.3rem; line-height: 1.3; margin-bottom: 15px; }
.cover-text-content #cvMarka { font-size: 7.5rem; margin: 0 0 15px; font-weight: 950; letter-spacing: -2px; line-height: .9; }
.cover-text-content #cvKisa { font-size: 2.4rem; margin: 0 0 20px; line-height: 1.2; letter-spacing: -.5px; }
.cover-text-content #cvUzun { font-size: 1.3rem; margin: 0; opacity: .95; }
.content-page { background-color: #Fdfbf7; color: #1a3322; padding: 25mm; font-size: 15px; line-height: 1.7; outline: none; overflow: visible; }
.content-page h2 { font-size: 1.8em; border-bottom: 2px solid #e62e3d; padding-bottom: 8px; margin-top: 40px; text-transform: uppercase; break-after: avoid; }
.content-page h3 { font-size: 1.4em; margin-top: 30px; font-weight: bold; break-after: avoid; }
.content-page h4 { font-size: 1.1em; margin-top: 20px; font-weight: bold; color: #1a3322; break-after: avoid; }
.content-page p { margin-bottom: 15px; }
.content-page ul, .content-page ol { margin-bottom: 20px; padding-left: 20px; }
.content-page li { margin-bottom: 8px; }
.price-tag { font-size: 2em; font-weight: bold; color: #e62e3d; display: block; margin: 15px 0; }
.opt-price { color: #e62e3d; font-weight: bold; }
.date-badge { display: block; text-align: right; font-size: .9em; color: #666; margin-top: 30px; }

@media (max-width: 1100px) {
    .app-body { flex-direction: column; height: auto; min-height: 100vh; overflow: auto; padding: 12px; }
    .sidebar { width: 100%; min-width: 0; height: auto; max-height: none; }
    .document-container { height: auto; overflow: visible; padding-right: 0; }
    .document-wrapper { transform-origin: top center; }
    .a4-page { width: min(100%, 210mm); min-height: 1200px; }
    .cover-text-content #cvMarka { font-size: clamp(3rem, 16vw, 7.5rem); }
    .cover-text-content #cvKisa { font-size: clamp(1.5rem, 6vw, 2.4rem); }
}

@media print {
    @page { size: 210mm 297mm; margin: 0; }
    html, body {
        width: 210mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        height: auto !important;
        overflow: visible !important;
    }
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    .sidebar { display: none !important; }
    .document-container {
        width: 210mm !important;
        height: auto !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
    }
    .document-wrapper {
        width: 210mm !important;
        display: block !important;
        gap: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .drag-handle,
    .cover-guide { display: none !important; }
    .a4-page {
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        overflow: hidden !important;
        box-shadow: none !important;
        margin: 0 !important;
        border: 0 !important;
        page-break-after: always;
        break-after: page;
    }
    .document-wrapper .a4-page:last-child {
        page-break-after: auto !important;
        break-after: auto !important;
    }
    .cover-page { background-color: #e62e3d !important; }
    .content-page { background-color: #Fdfbf7 !important; padding: 25mm !important; }
}

/* === PDF / PRINT FAZLA SAYFA DÜZELTMESİ === */

@page {
    size: A4;
    margin: 0;
}

@media print {
    html,
    body {
        width: 210mm !important;
        min-width: 210mm !important;
        max-width: 210mm !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        overflow: visible !important;
    }

    body {
        display: block !important;
    }

    .sidebar,
    .drag-handle,
    .guide-line,
    .cover-guide,
    .alignment-guide {
        display: none !important;
    }

    .document-container {
        display: block !important;
        width: 210mm !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: transparent !important;
    }

    .document-wrapper {
        display: block !important;
        width: 210mm !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        gap: 0 !important;
        background: transparent !important;
    }

    .a4-page {
        display: block !important;
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: none !important;
        outline: none !important;
        overflow: hidden !important;
        box-sizing: border-box !important;

        page-break-before: auto !important;
        page-break-inside: avoid !important;
        page-break-after: always !important;

        break-before: auto !important;
        break-inside: avoid !important;
        break-after: page !important;
    }

    .a4-page:last-child {
        page-break-after: auto !important;
        break-after: auto !important;
    }

    .cover-page {
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        background-color: #e62e3d !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .content-page {
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        padding: 25mm !important;
        background-color: #Fdfbf7 !important;
        box-sizing: border-box !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .document-wrapper::before,
    .document-wrapper::after,
    .document-container::before,
    .document-container::after,
    body::before,
    body::after {
        display: none !important;
        content: none !important;
    }
}
/* === KAPAK ÜSTÜ HİZALAMA BUTONLARI === */

.drag-handle {
    height: 28px;
    min-height: 28px;
    background: rgba(0, 0, 0, 0.42);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 3px 6px;
    font-size: 11px;
    cursor: grab;
    border-radius: 4px 4px 0 0;
    user-select: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.draggable-item:hover .drag-handle {
    opacity: 1;
}

.drag-title {
    flex: 1;
    text-align: center;
    font-weight: 700;
    pointer-events: none;
}

.drag-align-btn {
    border: 1px solid rgba(255,255,255,0.55);
    background: rgba(255,255,255,0.16);
    color: #ffffff;
    border-radius: 4px;
    padding: 3px 7px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}

.drag-align-btn:hover {
    background: rgba(255,255,255,0.28);
}

/* Düzenlenebilir içerik alanları */
.editable-content {
    cursor: text;
}

.editable-content:focus {
    outline: 1px dashed rgba(230, 46, 61, 0.65);
    outline-offset: 6px;
}

/* Tarayıcının çirkin siyah focus kutusunu engeller */
.content-page [contenteditable="true"]:focus,
.cover-text-content:focus {
    outline: 1px dashed rgba(230, 46, 61, 0.65) !important;
}

/* Print sırasında düzenleme çizgileri gözükmesin */
@media print {
    .editable-content:focus,
    .content-page [contenteditable="true"]:focus,
    .cover-text-content:focus {
        outline: none !important;
    }

    .drag-align-btn,
    .drag-title {
        display: none !important;
    }
}
/* =========================================================
   NİZAMİ ACCORDION + TEKLİF PANELİ GELİŞTİRMELERİ
   Ana layout'a dokunmaz: .app-body, .sidebar, .document-container korunur.
   ========================================================= */

.sidebar-accordion {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.sidebar-accordion + .sidebar-accordion,
.sidebar-accordion + .internal-note-panel,
.internal-note-panel + .sidebar-accordion {
    margin-top: 0;
}

.accordion-summary {
    list-style: none;
    min-height: 46px;
    padding: 12px 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-bottom: 1px solid transparent;
    user-select: none;
}

.accordion-summary::-webkit-details-marker {
    display: none;
}

.accordion-summary strong {
    display: block;
    color: #0f172a;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.accordion-summary small {
    display: block;
    margin-top: 3px;
    color: #94a3b8;
    font-size: 10px;
    line-height: 1.35;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
}

.accordion-caret {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #64748b;
    font-size: 15px;
    line-height: 1;
    transition: transform .18s ease, background .18s ease, color .18s ease;
}

.sidebar-accordion[open] > .accordion-summary {
    border-bottom-color: #e2e8f0;
}

.sidebar-accordion[open] > .accordion-summary .accordion-caret {
    transform: rotate(180deg);
    background: #fff1f2;
    color: #e62e3d;
}

.accordion-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.accordion-library .accordion-body {
    gap: 11px;
}

/* Eski section title accordion içinde tekrar etmesin */
.sidebar-accordion .section-title {
    margin-bottom: 2px;
}

/* Teklif bilgileri kartı */
.proposal-info-box {
    background: #ffffff;
    padding: 0;
}

.proposal-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.proposal-info-grid .span-2 {
    grid-column: span 2;
}

.input-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    font-size: 13px;
    color: #334155;
}

.input-select:focus {
    outline: none;
    border-color: #94a3b8;
    background: #ffffff;
}

/* Durum filtreleri */
.status-filter-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.status-filter-row::-webkit-scrollbar {
    height: 4px;
}

.status-filter-row::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.status-pill {
    flex: 0 0 auto;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #475569;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-pill span {
    background: #f1f5f9;
    color: #64748b;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 10px;
}

.status-pill.active {
    border-color: #e62e3d;
    color: #e62e3d;
    background: #fff1f2;
}

.status-select {
    width: 126px;
    border: none;
    border-radius: 999px;
    padding: 6px 8px;
    font-size: 10px;
    font-weight: 900;
    cursor: pointer;
    text-transform: uppercase;
}

.status-select.draft { background: #f1f5f9; color: #64748b; }
.status-select.sent { background: #dbeafe; color: #1d4ed8; }
.status-select.revision { background: #fef3c7; color: #92400e; }
.status-select.approved { background: #dcfce7; color: #166534; }
.status-select.rejected { background: #fee2e2; color: #991b1b; }
.status-select.archive { background: #e5e7eb; color: #374151; }

.lib-code,
.lib-brand {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-top: 3px;
}

.lib-code {
    font-weight: 900;
    color: #e62e3d;
}

/* Hazır bölüm ekleme */
.ready-blocks {
    background: #ffffff;
    padding: 0;
}

.ready-block-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.ready-block-btn {
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #334155;
    border-radius: 8px;
    padding: 9px 8px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
}

.ready-block-btn:hover {
    border-color: #e62e3d;
    color: #e62e3d;
    background: #fff1f2;
}

.ready-block-help {
    display: block;
    margin-top: 8px;
    color: #94a3b8;
    font-size: 11px;
    line-height: 1.45;
}

/* İç not alanı */
.internal-note-panel {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.08);
}

.internal-note-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.internal-note-head strong {
    color: #9a3412;
    font-size: 12px;
    letter-spacing: .06em;
}

.internal-note-head span {
    color: #c2410c;
    font-size: 10px;
    font-weight: 800;
    background: #ffedd5;
    padding: 4px 7px;
    border-radius: 999px;
}

.internal-note-panel textarea {
    height: 140px;
    min-height: 120px;
    resize: vertical;
    background: #fffaf5;
    border-color: #fed7aa;
}

.internal-note-panel small {
    display: block;
    margin-top: 7px;
    color: #9a3412;
    font-size: 10px;
    line-height: 1.45;
}

/* Çok geniş ekranda sağ boşlukta görünür. Laptopta sidebar içinde kalır. */
@media screen and (min-width: 1680px) {
    .internal-note-panel {
        position: fixed;
        right: 20px;
        top: 20px;
        width: 280px;
        z-index: 60;
        max-height: calc(100vh - 40px);
        overflow: auto;
    }

    .internal-note-panel textarea {
        height: 220px;
    }
}

/* PDF'ye basılacak teklif bilgileri şeridi */
.proposal-meta-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 22px 0;
    padding: 10px;
    border: 1px solid rgba(230, 46, 61, .18);
    background: rgba(230, 46, 61, .035);
    border-radius: 8px;
}

.proposal-meta-strip div {
    min-width: 0;
}

.proposal-meta-strip span {
    display: block;
    color: #64748b;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 3px;
}

.proposal-meta-strip strong {
    display: block;
    color: #1a3322;
    font-size: 11px;
    font-weight: 900;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Düzenlenebilir alanların ekran yüksekliğinde kaybolmasını engeller */
@media screen {
    .a4-page.content-page {
        height: auto !important;
        min-height: 297mm !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .content-page {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
}

/* Laptop düzeni: ana konum korunur, içerik kartları sıkışmaz */
@media screen and (min-width: 1101px) and (max-width: 1380px) {
    .proposal-info-grid,
    .ready-block-grid {
        grid-template-columns: 1fr;
    }

    .proposal-info-grid .span-2 {
        grid-column: span 1;
    }

    .status-select {
        width: 112px;
        font-size: 9px;
    }

    .accordion-summary {
        padding: 11px 12px;
    }
}

@media screen and (max-width: 1100px) {
    .proposal-info-grid,
    .ready-block-grid,
    .proposal-meta-strip {
        grid-template-columns: 1fr;
    }

    .proposal-info-grid .span-2 {
        grid-column: span 1;
    }

    .internal-note-panel {
        position: static;
    }
}

@media print {
    .sidebar-accordion .accordion-body {
        display: block !important;
    }

    .internal-note-panel,
    .ready-blocks,
    .status-filter-row {
        display: none !important;
    }

    .proposal-meta-strip {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
}

/* === FINAL: KAYIT + PDF ÇIKTI DÜZELTME BLOĞU === */
/* Sadece düzeltme amaçlıdır; ekran yerleşimini ve sol teklif menüsünü bozmaz. */

@media screen {
    .sidebar {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        overscroll-behavior: contain;
    }

    .sidebar-content {
        min-height: 0 !important;
        padding-bottom: 180px !important;
    }

    .a4-page.content-page,
    #proposalContent {
        height: auto !important;
        min-height: 297mm !important;
        max-height: none !important;
        overflow: visible !important;
    }

    #contentFit,
    .content-fit {
        transform: none !important;
        width: 100% !important;
    }
}

.proposal-meta-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

@page {
    size: A4;
    margin: 0;
}

@media print {
    html,
    body {
        width: 210mm !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        overflow: visible !important;
    }

    body.app-body {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #ffffff !important;
        overflow: visible !important;
    }

    .sidebar,
    .internal-note-panel,
    .ready-blocks,
    .status-filter-row,
    .drag-handle,
    .drag-align-btn,
    .drag-title,
    .cover-guide {
        display: none !important;
    }

    .document-container {
        display: block !important;
        width: 210mm !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: transparent !important;
    }

    .document-wrapper {
        display: block !important;
        width: 210mm !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        gap: 0 !important;
        overflow: visible !important;
        background: transparent !important;
    }

    .a4-page {
        display: block !important;
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: 0 !important;
        outline: 0 !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
        page-break-after: always !important;
        break-after: page !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .document-wrapper .a4-page:last-child {
        page-break-after: auto !important;
        break-after: auto !important;
    }

    .cover-page {
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        background-color: #e62e3d !important;
        overflow: hidden !important;
    }

    .content-page,
    #proposalContent {
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        padding: 18mm 18mm !important;
        background-color: #Fdfbf7 !important;
        color: #1a3322 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        font-size: 14.6px !important;
        line-height: 1.56 !important;
        page-break-after: auto !important;
        break-after: auto !important;
    }

    #contentFit,
    .content-fit {
        transform: none !important;
        width: 100% !important;
    }

    .content-page h2 {
        font-size: 1.72em !important;
        line-height: 1.16 !important;
        margin: 24px 0 14px !important;
        padding-bottom: 7px !important;
        border-bottom: 2px solid #e62e3d !important;
        letter-spacing: -0.02em !important;
        text-transform: uppercase !important;
        break-after: avoid !important;
        page-break-after: avoid !important;
    }

    .content-page h2:first-child {
        margin-top: 0 !important;
    }

    .content-page h3 {
        font-size: 1.32em !important;
        margin: 22px 0 11px !important;
        line-height: 1.2 !important;
        break-after: avoid !important;
        page-break-after: avoid !important;
    }

    .content-page h4 {
        font-size: 1.06em !important;
        margin: 16px 0 8px !important;
        line-height: 1.25 !important;
        break-after: avoid !important;
        page-break-after: avoid !important;
    }

    .content-page p {
        margin: 0 0 12px !important;
        line-height: 1.56 !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .content-page ul,
    .content-page ol {
        margin: 0 0 14px !important;
        padding-left: 20px !important;
    }

    .content-page li {
        margin-bottom: 6px !important;
    }

    .price-tag {
        font-size: 1.95em !important;
        margin: 12px 0 13px !important;
        line-height: 1.2 !important;
    }

    .date-badge {
        margin: 10px 0 12px !important;
        font-size: 0.88em !important;
    }

    .proposal-meta-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        margin: 0 0 18px !important;
        padding: 8px 10px !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .proposal-meta-strip span {
        font-size: 8px !important;
    }

    .proposal-meta-strip strong {
        font-size: 10px !important;
    }

    .document-wrapper::before,
    .document-wrapper::after,
    .document-container::before,
    .document-container::after,
    body::before,
    body::after {
        display: none !important;
        content: none !important;
    }
}

/* === MAC SAFARI PDF PRINT DÜZELTMESİ === */
/* Sadece Safari PDF çıktısını stabilize eder. Ekran ve Windows çıktısı bozulmaz. */

@media print {
    @page {
        size: A4;
        margin: 0;
    }

    html,
    body {
        width: 210mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        overflow: visible !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body.app-body {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #ffffff !important;
        overflow: visible !important;
    }

    .sidebar,
    .internal-note-panel,
    .ready-blocks,
    .status-filter-row,
    .drag-handle,
    .drag-align-btn,
    .drag-title,
    .cover-guide {
        display: none !important;
    }

    .document-container,
    .document-wrapper {
        display: block !important;
        width: 210mm !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: transparent !important;
    }

    .a4-page {
        display: block !important;
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: none !important;
        outline: none !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
        page-break-after: always !important;
        break-after: page !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .document-wrapper .a4-page:last-child {
        page-break-after: auto !important;
        break-after: auto !important;
    }

    .cover-page {
        background-color: #e62e3d !important;
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        overflow: hidden !important;
    }

    .content-page,
    #proposalContent {
        width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        padding: 18mm !important;
        background-color: #Fdfbf7 !important;
        color: #1a3322 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        font-size: 14.6px !important;
        line-height: 1.56 !important;
    }
}

/* Safari, A4 yüksekliğini bazen 1-2 mm taşırıp boş sayfa üretir.
   Bu sınıf sadece Safari print sırasında JS ile eklenir. */
@media print {
    body.safari-print .a4-page {
        height: 296mm !important;
        min-height: 296mm !important;
        max-height: 296mm !important;
    }

    body.safari-print .cover-page {
        height: 296mm !important;
        min-height: 296mm !important;
        max-height: 296mm !important;
        background-color: #e62e3d !important;
    }

    body.safari-print .content-page,
    body.safari-print #proposalContent {
        height: 296mm !important;
        min-height: 296mm !important;
        max-height: 296mm !important;
        padding: 18mm !important;
    }
}

/* === ACCORDION + SOL PANEL SCROLL DÜZELTME === */
/* Ana layout'a dokunmaz. Sadece sol panel accordion davranışını düzeltir. */

.sidebar {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    min-height: 0 !important;
    overscroll-behavior: contain;
}

.sidebar-content {
    min-height: 0 !important;
    padding-bottom: 220px !important;
}

#proposalForm {
    min-height: 0 !important;
}

.sidebar-accordion,
.accordion-item,
.accordion-section,
.proposal-info-box,
.ready-blocks,
.internal-note-panel {
    flex-shrink: 0 !important;
}

/* Accordion kartları */
.sidebar-accordion,
.accordion-item {
    border: 1px solid #dbe4f0;
    border-radius: 14px;
    background: #ffffff;
    overflow: visible !important;
}

/* Accordion başlığı */
.accordion-toggle,
.accordion-header,
.accordion-head {
    width: 100%;
    border: 0;
    background: #ffffff;
    color: #0f172a;
    padding: 15px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
    border-radius: 14px;
}

.accordion-toggle strong,
.accordion-header strong,
.accordion-head strong {
    display: block;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.accordion-toggle small,
.accordion-header small,
.accordion-head small {
    display: block;
    margin-top: 3px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 800;
}

/* Ok butonu */
.accordion-icon,
.accordion-arrow {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 999px;
    background: #f8fafc;
    color: #64748b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: transform .18s ease, background .18s ease, color .18s ease;
}

/* İçerik alanı */
.accordion-content,
.accordion-panel,
.accordion-body {
    display: none;
    padding: 0 14px 14px 14px;
    overflow: visible !important;
    max-height: none !important;
}

/* Açık durum */
.sidebar-accordion.is-open,
.accordion-item.is-open {
    border-color: #cbd5e1;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.sidebar-accordion.is-open .accordion-content,
.sidebar-accordion.is-open .accordion-panel,
.sidebar-accordion.is-open .accordion-body,
.accordion-item.is-open .accordion-content,
.accordion-item.is-open .accordion-panel,
.accordion-item.is-open .accordion-body {
    display: block !important;
    max-height: none !important;
    overflow: visible !important;
}

.sidebar-accordion.is-open .accordion-icon,
.sidebar-accordion.is-open .accordion-arrow,
.accordion-item.is-open .accordion-icon,
.accordion-item.is-open .accordion-arrow {
    transform: rotate(180deg);
    background: #fff1f2;
    color: #e62e3d;
}

/* İç içe form taşmalarını engelle */
.accordion-content input,
.accordion-content textarea,
.accordion-content select,
.accordion-panel input,
.accordion-panel textarea,
.accordion-panel select,
.accordion-body input,
.accordion-body textarea,
.accordion-body select {
    max-width: 100%;
}

/* Laptopta en alta kadar inebilmesi için */
@media screen and (min-width: 1101px) {
    .sidebar {
        height: calc(100vh - 40px) !important;
        overflow-y: auto !important;
    }

    .sidebar-content {
        padding-bottom: 260px !important;
    }
}

@media screen and (max-width: 1100px) {
    .sidebar {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .sidebar-content {
        padding-bottom: 50px !important;
    }
}
/* === SAYFA KONTROLLÜ JSON / ÇOKLU A4 İÇERİK DÜZELTMESİ === */
/* Bu blok en altta kalmalı. Ana sol panel yerleşimini bozmaz. */

.page-break-marker {
    display: none !important;
}

.json-page-hint {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    color: #64748b;
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 11px;
    line-height: 1.45;
}

.json-page-hint strong {
    color: #0f172a;
}

.json-page-hint code {
    background: #e2e8f0;
    color: #0f172a;
    border-radius: 5px;
    padding: 1px 5px;
    font-weight: 800;
}

.content-pages {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    width: 100%;
}

.generated-content-page {
    background-color: #Fdfbf7;
    color: #1a3322;
}

.content-page-inner {
    width: 100%;
    min-height: 20px;
    outline: none;
}

.content-page-inner:focus {
    outline: 1px dashed rgba(230, 46, 61, 0.55);
    outline-offset: 6px;
}

/* Eski accordion çakışmalarını details yapısına göre ezer */
details.sidebar-accordion {
    display: block !important;
    overflow: visible !important;
    flex-shrink: 0 !important;
}

details.sidebar-accordion > summary.accordion-summary {
    display: flex !important;
    list-style: none !important;
    cursor: pointer !important;
}

details.sidebar-accordion > summary.accordion-summary::-webkit-details-marker {
    display: none !important;
}

details.sidebar-accordion:not([open]) > .accordion-body {
    display: none !important;
}

details.sidebar-accordion[open] > .accordion-body {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    padding: 12px !important;
}

details.sidebar-accordion[open] .accordion-caret {
    transform: rotate(180deg) !important;
    background: #fff1f2 !important;
    color: #e62e3d !important;
}

.sidebar {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.sidebar-content {
    min-height: max-content !important;
    padding-bottom: 280px !important;
}

@media screen {
    .a4-page.content-page,
    .generated-content-page {
        height: auto !important;
        min-height: 297mm !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 25mm !important;
        box-sizing: border-box !important;
    }
}

@media print {
    @page {
        size: A4;
        margin: 0;
    }

    html,
    body,
    body.app-body {
        width: 210mm !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        overflow: visible !important;
    }

    .sidebar,
    .internal-note-panel,
    .ready-blocks,
    .status-filter-row,
    .drag-handle,
    .drag-align-btn,
    .drag-title,
    .cover-guide {
        display: none !important;
    }

    .document-container,
    .document-wrapper,
    .content-pages {
        display: block !important;
        width: 210mm !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        gap: 0 !important;
        overflow: visible !important;
        background: transparent !important;
    }

    .a4-page {
        width: 210mm !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: 0 !important;
        outline: 0 !important;
        box-sizing: border-box !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .cover-page {
        height: 297mm !important;
        min-height: 297mm !important;
        max-height: 297mm !important;
        overflow: hidden !important;
        background-color: #e62e3d !important;
        page-break-after: always !important;
        break-after: page !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .a4-page.content-page,
    .generated-content-page {
        height: auto !important;
        min-height: 297mm !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 18mm !important;
        background-color: #Fdfbf7 !important;
        color: #1a3322 !important;
        font-size: 14.6px !important;
        line-height: 1.56 !important;
        page-break-after: always !important;
        break-after: page !important;
        page-break-inside: auto !important;
        break-inside: auto !important;
    }

    .document-wrapper .a4-page:last-child,
    .content-pages .a4-page:last-child {
        page-break-after: auto !important;
        break-after: auto !important;
    }

    .content-page-inner {
        outline: none !important;
    }

    .content-page h2,
    .content-page h3,
    .content-page h4 {
        break-after: avoid-page !important;
        page-break-after: avoid !important;
    }

    .content-page h2 {
        font-size: 1.72em !important;
        line-height: 1.16 !important;
        margin: 24px 0 14px !important;
        padding-bottom: 7px !important;
        border-bottom: 2px solid #e62e3d !important;
        letter-spacing: -0.02em !important;
    }

    .content-page h2:first-child {
        margin-top: 0 !important;
    }

    .content-page h3 {
        font-size: 1.32em !important;
        margin: 22px 0 11px !important;
        line-height: 1.2 !important;
    }

    .content-page h4 {
        font-size: 1.06em !important;
        margin: 16px 0 8px !important;
        line-height: 1.25 !important;
    }

    .content-page p,
    .content-page li {
        line-height: 1.56 !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .content-page p {
        margin: 0 0 12px !important;
    }

    .price-tag {
        font-size: 1.95em !important;
        margin: 12px 0 13px !important;
        line-height: 1.2 !important;
    }

    .page-break-marker,
    .json-page-hint {
        display: none !important;
    }
}

@media print {
    body.safari-print .cover-page {
        height: 296mm !important;
        min-height: 296mm !important;
        max-height: 296mm !important;
    }
}
