body { background-color: #f1f5f9; font-size: 13px; font-family: Arial, Helvetica, sans-serif; user-select: none; color: #334155; }

#appInitSpinner { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: #0f172a; z-index: 10000; display: flex; flex-direction: column; align-items: center; justify-content: center; color: white; }
#loginOverlay { position: fixed; top:0; left:0; width:100%; height:100%; background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); z-index: 9999; display: flex; align-items: center; justify-content: center; }

.a4-wrapper { overflow-x: auto; padding: 15px; }

/* DÜZELTİLMİŞ KESİN 1 SAYFA A4 CONTAINER */
.a4-container {
    width: 794px; height: 1120px; max-height: 1120px; background: white;
    position: relative; margin: 0 auto; padding: 30px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08); border-radius: 8px;
    box-sizing: border-box; overflow: hidden; page-break-inside: avoid; page-break-after: avoid;
}

.a4-container.show-grid {
    background-image: linear-gradient(to right, #e2e8f0 1px, transparent 1px), linear-gradient(to bottom, #e2e8f0 1px, transparent 1px);
    background-size: 20px 20px;
}

.drag-widget { position: absolute; touch-action: none; padding: 6px; border: 1px dashed transparent; border-radius: 6px; background: rgba(255, 255, 255, 0.98); z-index: 10; }
.drag-widget.editable { cursor: move; }
.drag-widget.editable:hover { border-color: #c8102e !important; }

.kale-red { color: #c8102e; }
.bg-kale-red { background-color: #c8102e; color: white; }
.card { border: none; border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.03); }

#toastContainer { position: fixed; bottom: 20px; right: 20px; z-index: 1050; }

@media print {
    .no-print { display: none !important; }
    body { background: white !important; margin: 0 !important; }
    .a4-wrapper { padding: 0 !important; }
    .a4-container { box-shadow: none !important; margin: 0 !important; width: 100% !important; height: 1120px !important; padding: 25px !important; }
}

/* Kale Teklif Portalı v8: responsive/mobile-first polish */
:root{--kale-red:#c8102e;--ink:#172033;--muted:#64748b;--surface:#fff;--line:#e2e8f0}
*{box-sizing:border-box} body{user-select:auto;background:#f3f6fb;color:#1e293b;font-size:14px} button,input,select,textarea{font:inherit} .navbar-brand{white-space:normal}.nav-tabs{flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin}.nav-tabs .nav-link{white-space:nowrap}.tab-pane{min-width:0}.card{overflow:hidden}.card-header{padding:.75rem 1rem}.form-control,.form-select{min-height:40px}.btn{min-height:38px}.quote-summary-card{border:1px solid #e3e8f0}.quote-summary-card .card-header{background:#fff}.quote-mini-item{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;padding:10px;border:1px solid #e5eaf1;border-radius:10px;background:#fff}.quote-mini-item .small{color:#64748b}.a4-wrapper{width:100%;min-width:0;overflow:auto;padding:12px}.a4-container{flex:none;transform-origin:top left;border-radius:5px}.editor-toolbar{position:sticky;top:0;z-index:30}.drag-widget{touch-action:none;max-width:none;overflow-wrap:anywhere}.drag-widget.selected-widget{outline:2px solid var(--kale-red)!important;outline-offset:1px}.snap-guide{position:absolute;z-index:9999;pointer-events:none;background:#0ea5e9;display:none}.snap-guide.vertical{width:1px;top:0;bottom:0}.snap-guide.horizontal{height:1px;left:0;right:0}.no-print{print-color-adjust:exact;-webkit-print-color-adjust:exact}
@media(max-width:767.98px){body{font-size:14px}.navbar{padding:.65rem .75rem!important;gap:8px}.navbar-brand span{font-size:.8rem!important}.navbar .dropdown-toggle span{max-width:100px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.bg-white.border-bottom.no-print{padding:0 .5rem!important}.nav-tabs{gap:3px!important}.nav-tabs .nav-link{padding:.65rem .7rem;font-size:.78rem!important}.tab-pane{padding:12px!important}.row{--bs-gutter-x:.7rem}.card{border-radius:12px;margin-bottom:12px}.card-body{padding:12px}.form-label{margin-bottom:5px}.a4-wrapper{padding:8px 0;overflow-x:auto}.editor-toolbar{position:static}.editor-toolbar .card-body{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));align-items:end}.editor-toolbar label{min-width:0}.editor-toolbar input,.editor-toolbar select{max-width:100%;width:100%!important}.a4-container{zoom:.46;margin:0!important;margin-bottom:0!important}.table{font-size:12px}.table th,.table td{padding:.3rem}.accordion-button{padding:.85rem}.quote-summary-card{margin-top:8px}#loginOverlay>.card{margin:16px!important}.modal-dialog{margin:.5rem}}
@media(min-width:768px) and (max-width:1199px){.a4-container{zoom:.8}.a4-wrapper{overflow:auto}.tab-pane{padding:1rem!important}}
@page{size:A4 portrait;margin:0}
@media print{html,body{width:210mm!important;height:auto!important;margin:0!important;padding:0!important;background:#fff!important;overflow:visible!important}.no-print,.navbar,.nav-tabs,.editor-toolbar,#appInitSpinner,#toastContainer{display:none!important}.tab-content,.tab-pane,.a4-wrapper{display:block!important;position:static!important;width:210mm!important;margin:0!important;padding:0!important;overflow:visible!important;height:auto!important}.a4-container{width:210mm!important;height:297mm!important;max-height:297mm!important;margin:0!important;padding:0!important;border:0!important;border-radius:0!important;box-shadow:none!important;overflow:hidden!important;zoom:1!important;transform:none!important;page-break-after:avoid!important;break-after:avoid-page!important}.drag-widget{border-color:transparent!important;box-shadow:none!important}.drag-widget .no-print{display:none!important}.snap-guide{display:none!important;visibility:hidden!important;opacity:0!important}.a4-container.show-grid{background-image:none!important;background-color:#fff!important}.drag-widget{outline:none!important}.selected-widget{outline:none!important}table{break-inside:avoid!important}tr{break-inside:avoid!important}}

/* v10: print only the actual A4 offer canvas, never the editor/application chrome. */
@media print {
  html, body { width:210mm !important; min-width:0 !important; margin:0 !important; padding:0 !important; background:#fff !important; overflow:visible !important; }
  body * { visibility:hidden !important; }
  #a4Canvas, #a4Canvas * { visibility:visible !important; }
  #a4Canvas { position:absolute !important; left:0 !important; top:0 !important; width:210mm !important; height:297mm !important; max-height:297mm !important; margin:0 !important; padding:0 !important; transform:none !important; zoom:1 !important; overflow:hidden !important; box-shadow:none !important; border:0 !important; page-break-after:avoid !important; break-after:avoid-page !important; }
  .no-print, .no-print *, .navbar, .nav-tabs, .editor-toolbar, #appInitSpinner, #toastContainer, .snap-guide { display:none !important; }
  @page { size:A4 portrait; margin:0; }
}

/* v12.2 dashboard and workflow */
.dashboard-stat{position:relative;border:1px solid #e5eaf2;background:linear-gradient(145deg,#fff,#f8fafc);overflow:hidden}.dashboard-stat .card-body{padding:1.25rem}.dashboard-stat .display-6{color:#c8102e}.dashboard-stat .fa-solid{position:absolute;right:18px;bottom:16px;font-size:2rem;color:#c8102e;opacity:.12}.table-responsive{max-width:100%}#quotesTableRows td{vertical-align:middle}#quotesTableRows .btn{min-width:34px}
@media(max-width:767.98px){#tabDashboard .display-6{font-size:1.8rem}#quotesTableRows{font-size:.8rem}#quotesTableRows .btn{min-width:32px;padding:.35rem .45rem}.dashboard-stat .card-body{padding:1rem}}

/* v12.3.0 mobile-first management ergonomics */
@media(max-width:767.98px){
 #mainTabs{display:flex;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;white-space:nowrap;scrollbar-width:thin;padding-bottom:.25rem;-webkit-overflow-scrolling:touch}
 #mainTabs .nav-item{flex:0 0 auto}
 #mainTabs .nav-link{font-size:.78rem!important;padding:.55rem .7rem!important}
 .tab-pane{padding:1rem!important}
 #tab1 .row{--bs-gutter-x:.65rem}
 #tab1 .a4-wrapper{overflow:auto!important;max-width:100%;-webkit-overflow-scrolling:touch}
 #tab1 #a4Canvas{transform-origin:top left}
 #productsTable{min-width:650px}
 #tabQuotes table{min-width:720px}
 .card-header{gap:.5rem;flex-wrap:wrap}
 #productBulkToolbar>*{max-width:100%}
 #productBulkToolbar select{flex:1 1 160px}
}

/* v12.6.0 mobile navigation, previews and responsive data tables */
.brand-preview{display:flex;align-items:center;gap:.5rem;min-height:42px}.brand-preview-trigger{display:inline-flex;align-items:center;gap:.6rem;border:1px solid #dbe2ea;background:#f8fafc;border-radius:10px;padding:6px 10px;color:#475569;font-size:12px;max-width:100%}.brand-preview-trigger img{width:54px;height:42px;object-fit:contain;background:#fff;border-radius:5px}.brand-preview-trigger span{overflow-wrap:anywhere;text-align:left}
#reportSummaryCards{max-width:100%;overflow:hidden}#reportSummaryCards .card{max-width:100%;overflow-wrap:anywhere}#reportCharts canvas{max-width:100%!important}
.custom-box{box-sizing:border-box}
@media(max-width:767.98px){
 .main-nav-wrap{padding:.5rem!important}#mainNavCollapse:not(.show){display:none!important}#mainNavCollapse.show{display:block!important}#mainTabs{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px!important;overflow:visible!important;white-space:normal!important}#mainTabs .nav-item{min-width:0}#mainTabs .nav-link{width:100%;height:100%;white-space:normal!important;text-align:left;border:1px solid #e2e8f0!important;border-radius:9px!important;padding:.65rem!important;font-size:.76rem!important;line-height:1.3}#mainTabs .nav-link.active{background:#c8102e!important;color:#fff!important;border-color:#c8102e!important}
 .table-responsive{overflow:visible!important}.table-responsive>table{min-width:0!important;width:100%!important}.table-responsive table thead{display:none}.table-responsive table tbody tr{display:block;margin:.55rem 0;border:1px solid #e2e8f0;border-radius:10px;background:#fff;overflow:hidden;box-shadow:0 1px 3px #0f172a0a}.table-responsive table tbody tr td{display:none!important;border:0!important;padding:.45rem .65rem!important;text-align:left!important;white-space:normal!important;overflow-wrap:anywhere}.table-responsive table tbody tr td:first-child,.table-responsive table tbody tr td:nth-child(2),.table-responsive table tbody tr td:nth-child(3),.table-responsive table tbody tr td:last-child{display:block!important}.table-responsive table tbody tr td:nth-child(2){font-weight:600}.table-responsive table tbody tr td:last-child{border-top:1px solid #f1f5f9!important}.table-responsive table tbody tr.mobile-row-expanded td{display:block!important}.table-responsive table tbody tr td[data-label]::before{content:attr(data-label);display:block;font-size:.68rem;color:#64748b;font-weight:600;margin-bottom:2px}.table-responsive table tbody tr td:first-child:empty{display:none!important}
 #reportTableWrap.table-responsive{overflow-x:auto!important}#reportTableWrap table{min-width:640px!important;width:max-content!important}#reportTableWrap table thead{display:table-header-group}#reportTableWrap table tbody tr{display:table-row;margin:0;border:0;box-shadow:none}#reportTableWrap table tbody tr td{display:table-cell!important;border-bottom:1px solid #e2e8f0!important}#reportTableWrap table tbody tr td::before{display:none!important}
}


/* v12.6.1: consistent mobile data tables and a deliberate mobile navigation surface */
.mobile-menu-toggle{display:flex;align-items:center;gap:12px;width:100%;min-height:50px;margin:.35rem 0 .65rem;padding:10px 14px;border:1px solid #e2e8f0;border-radius:14px;background:linear-gradient(135deg,#fff,#f8fafc);color:#172033;font-weight:750;box-shadow:0 5px 14px rgba(15,23,42,.07);text-align:left}
.mobile-menu-icon{display:grid;place-items:center;width:34px;height:34px;border-radius:10px;background:#c8102e;color:#fff;font-size:16px}.mobile-menu-chevron{margin-left:auto;color:#64748b;transition:transform .2s}.mobile-menu-toggle[aria-expanded="true"] .mobile-menu-chevron{transform:rotate(180deg)}
.main-nav-wrap{padding-top:.7rem!important}.mobile-card-table{width:100%}
@media(max-width:767.98px){
 .main-nav-wrap{padding:.65rem .6rem .5rem!important}.mobile-menu-toggle{margin:.45rem 0 .75rem;position:relative;top:0;border-radius:14px}.navbar{padding-top:calc(.65rem + env(safe-area-inset-top,0px))!important}
 .tab-pane .mobile-card-table{border-collapse:separate!important;border-spacing:0;width:100%!important;min-width:0!important}
 .tab-pane .mobile-card-table thead{display:none!important}
 .tab-pane .mobile-card-table tbody tr{display:block!important;margin:.65rem 0!important;padding:.2rem 0!important;border:1px solid #e2e8f0!important;border-radius:13px!important;background:#fff!important;overflow:hidden!important;box-shadow:0 3px 10px rgba(15,23,42,.045)!important}
 .tab-pane .mobile-card-table tbody tr td{display:none!important;width:100%!important;max-width:100%!important;border:0!important;padding:.55rem .8rem!important;text-align:left!important;white-space:normal!important;overflow-wrap:anywhere!important}
 .tab-pane .mobile-card-table tbody tr td:first-child,.tab-pane .mobile-card-table tbody tr td:nth-child(2),.tab-pane .mobile-card-table tbody tr td:nth-child(3),.tab-pane .mobile-card-table tbody tr td:last-child{display:block!important}
 .tab-pane .mobile-card-table tbody tr td:nth-child(2){font-weight:700;color:#172033}
 .tab-pane .mobile-card-table tbody tr td:last-child{border-top:1px solid #f1f5f9!important;padding-top:.65rem!important}
 .tab-pane .mobile-card-table tbody tr.mobile-row-expanded td{display:block!important}
 .tab-pane .mobile-card-table tbody tr td[data-label]::before{content:attr(data-label);display:block;font-size:.69rem;letter-spacing:.02em;text-transform:uppercase;color:#64748b;font-weight:700;margin-bottom:3px}
 .tab-pane .mobile-card-table tbody tr td:first-child:empty{display:none!important}
 #reportTableWrap.table-responsive{overflow-x:auto!important}.report-share-source{max-width:none!important}
}

/* PWA / mobil: güvenli alan (çentik, ana ekran çubuğu) ve şablon sekmesi satırları */
.navbar{padding-top:max(.5rem,env(safe-area-inset-top));padding-left:max(.75rem,env(safe-area-inset-left));padding-right:max(.75rem,env(safe-area-inset-right))}
#toastContainer{bottom:max(20px,env(safe-area-inset-bottom));right:max(20px,env(safe-area-inset-right))}
body{padding-bottom:env(safe-area-inset-bottom)}
@media(max-width:767.98px){
 #toastContainer{left:12px;right:12px;display:flex;flex-direction:column;gap:8px}
 .layout-pick-row{flex-wrap:wrap;margin-left:0!important;width:100%}
 .layout-pick-row select{flex:1 1 100%;width:100%!important}
 .layout-save-row{flex-wrap:wrap;max-width:100%!important}
 .layout-save-row #newLayoutName{flex:1 1 60%;min-width:0}
 .layout-save-row .form-check{flex:1 1 100%;margin:.4rem 0 0!important}
 #layoutVersionSelect{width:100%!important}
 .editor-toolbar{position:static}
 .editor-toolbar .card-body>label,.editor-toolbar .card-body select,.editor-toolbar .card-body input[type=text],.editor-toolbar .card-body textarea{max-width:100%}
}

/* v12.8: tablo arama/sayfalama ve mobil ergonomi */
table tbody tr.paged-out.paged-out.paged-out,table tbody tr.filtered-out.filtered-out.filtered-out{display:none!important}
.table-search{max-width:360px;flex:1 1 220px}
.table-pager-size{width:auto;max-width:120px}
.table-pager-nav .btn{min-width:40px;min-height:40px}
.customers-scroll{max-width:100%}
.mobile-menu-current{color:#c8102e;font-weight:600;font-size:.85rem}
@media(max-width:767.98px){
 header.navbar{flex-wrap:nowrap!important;gap:8px;padding-bottom:.5rem!important}
 header.navbar .navbar-brand{min-width:0;flex:1 1 auto;margin-right:0}
 header.navbar .navbar-brand span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.78rem!important}
 header.navbar>.ms-auto{flex:0 0 auto;gap:8px!important}
 .main-nav-wrap{position:sticky;top:0;z-index:1030}
 .mobile-menu-toggle{min-height:46px;margin:.2rem 0 .3rem;padding:6px 12px}
 .mobile-menu-icon{width:30px;height:30px}
 #mainNavCollapse .nav-link{min-height:46px;display:flex;align-items:center}
 .table-search{max-width:100%;flex:1 1 100%}
 [id^="pagination-"]{flex-direction:column;align-items:stretch!important}
 .table-pager-size{max-width:none;width:100%}
 .table-pager-nav{width:100%}
 .table-pager-nav .btn{flex:1;min-height:46px}
 /* Teklifler: kart içinde ad/tutar/tarih ve işlemler görünür olsun */
 .tab-pane #quotesTable.mobile-card-table tbody tr:not(.paged-out):not(.filtered-out){display:grid!important;grid-template-columns:30px minmax(0,1fr) auto;column-gap:8px;row-gap:3px;padding:.65rem .75rem!important}
 .tab-pane #quotesTable.mobile-card-table tbody tr td{display:block!important;padding:0!important;border:0!important;width:auto!important;text-align:left!important}
 .tab-pane #quotesTable.mobile-card-table tbody tr td::before{display:none!important}
 .tab-pane #quotesTable tbody tr td:nth-child(1){grid-column:1;grid-row:1;align-self:start;padding-top:2px!important}
 .tab-pane #quotesTable tbody tr td:nth-child(2){grid-column:2;grid-row:1;font-weight:700}
 .tab-pane #quotesTable tbody tr td:nth-child(7){grid-column:3;grid-row:1;text-align:right!important;font-size:.78rem}
 .tab-pane #quotesTable tbody tr td:nth-child(3){grid-column:2/4;grid-row:2;color:#334155}
 .tab-pane #quotesTable tbody tr td:nth-child(4){grid-column:2;grid-row:3;font-size:.78rem;color:#64748b}
 .tab-pane #quotesTable tbody tr td:nth-child(5){grid-column:3;grid-row:3;font-size:.78rem;color:#64748b;text-align:right!important}
 .tab-pane #quotesTable tbody tr td:nth-child(6){display:none!important}
 .tab-pane #quotesTable tbody tr td:nth-child(8),.tab-pane #quotesTable tbody tr td:nth-child(9){grid-column:1/4;grid-row:4;display:flex!important;flex-wrap:nowrap;gap:6px;margin-top:.55rem!important}
 .tab-pane #quotesTable tbody tr td:nth-child(8){justify-self:start}
 .tab-pane #quotesTable tbody tr td:nth-child(9){justify-self:end}
 .tab-pane #quotesTable tbody tr td:nth-child(8):empty{display:none!important}
 .tab-pane #quotesTable tbody tr td:nth-child(8)>div{display:flex;gap:6px}
 .tab-pane #quotesTable tbody tr td .btn{min-width:40px;min-height:40px;padding-left:.5rem;padding-right:.5rem}
 .table-hover>tbody>tr:hover>*{--bs-table-bg-state:transparent!important}
}

@media(max-width:767.98px){
 .dashboard-stat .display-6{font-size:1.45rem}
 #tabDashboard>.d-flex>.btn-lg{width:100%}
 #tabQuotes>.d-flex>.btn{width:100%}
 /* Raporlar: özet ve tablo grafiklerden önce gelsin */
 #tabReports.active{display:flex;flex-direction:column}
 #tabReports #reportCharts{order:5}
 #tabReports>*{order:1}
 #tabReports #reportSummaryCards{order:2}
 #tabReports>.card:last-of-type{order:3}
 #tabReports #reportCharts{order:4}
}

@media(max-width:767.98px){
 .dashboard-stat .display-6{font-size:1.25rem;overflow-wrap:anywhere}
 /* Ürün kataloğu: ad ve fiyat kartta hemen görünsün */
 .tab-pane #productsTable.mobile-card-table tbody tr:not(.paged-out):not(.filtered-out){display:grid!important;grid-template-columns:30px minmax(0,1fr) auto;column-gap:8px;row-gap:3px;padding:.65rem .75rem!important}
 .tab-pane #productsTable.mobile-card-table tbody tr td{display:block!important;padding:0!important;border:0!important;width:auto!important;text-align:left!important}
 .tab-pane #productsTable.mobile-card-table tbody tr td::before{display:none!important}
 .tab-pane #productsTable tbody tr td:nth-child(1){grid-column:1;grid-row:1;align-self:start;padding-top:2px!important}
 .tab-pane #productsTable tbody tr td:nth-child(4){grid-column:2/4;grid-row:1;font-size:.95rem}
 .tab-pane #productsTable tbody tr td:nth-child(3){grid-column:2;grid-row:2;font-size:.8rem;color:#64748b}
 .tab-pane #productsTable tbody tr td:nth-child(2){grid-column:3;grid-row:2;text-align:right!important}
 .tab-pane #productsTable tbody tr td:nth-child(5){grid-column:2;grid-row:3;font-size:.85rem;white-space:normal!important;margin-top:.2rem}
 .tab-pane #productsTable tbody tr td:nth-child(6){grid-column:3;grid-row:3;align-self:end;justify-self:end;display:flex!important;gap:6px}
 .tab-pane #productsTable tbody tr td .btn{min-width:40px;min-height:40px}
 /* Müşteriler */
 .tab-pane #customersTable.mobile-card-table tbody tr td .btn-link{min-height:0;padding:0!important}
}
@media(max-width:767.98px){
 .tab-pane #customersTable.mobile-card-table tbody tr:not(.paged-out):not(.filtered-out){display:grid!important;grid-template-columns:30px minmax(0,1fr);column-gap:8px;row-gap:2px;padding:.65rem .75rem!important}
 .tab-pane #customersTable.mobile-card-table tbody tr td{display:block!important;padding:0!important;border:0!important;width:auto!important;text-align:left!important}
 .tab-pane #customersTable.mobile-card-table tbody tr td::before{display:none!important}
 .tab-pane #customersTable tbody tr td:nth-child(1){grid-column:1;grid-row:1/4;align-self:start;padding-top:2px!important}
 .tab-pane #customersTable tbody tr td:nth-child(n+2){grid-column:2}
 .tab-pane #customersTable tbody tr td:nth-child(3),.tab-pane #customersTable tbody tr td:nth-child(4){font-size:.85rem;color:#475569}
}

.quote-mobile-bar{position:fixed;left:0;right:0;bottom:0;z-index:1040;display:flex;gap:10px;align-items:center;padding:8px 12px calc(8px + env(safe-area-inset-bottom));background:#fff;border-top:1px solid #e2e8f0;box-shadow:0 -6px 18px rgba(15,23,42,.12)}
.quote-mobile-bar .qmb-summary{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;align-items:flex-start;border:0;background:transparent;padding:0;text-align:left;line-height:1.2;font-size:.78rem;color:#64748b}
.quote-mobile-bar .qmb-summary strong{font-size:1.05rem;color:#172033}
.quote-mobile-bar .btn{flex:0 0 auto;min-height:46px}
@media(max-width:767.98px){#tab1{padding-bottom:92px!important}}

.footer-bar{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:8px;padding-left:1rem;padding-right:max(1rem,env(safe-area-inset-right))}
.footer-bar .app-version{justify-self:end;font-variant-numeric:tabular-nums}
