/* Yerel Excel - Cep telefonu görünümü
   Yalnızca dar ekranlarda (<= 760px) devreye girer; masaüstü görünümünü değiştirmez.
   Tasarım: Claude Design tuvali "Yerel Excel Mobil Tasarım". Davranış: static/js/mobile.js */

/* JS'in eklediği öğeler masaüstünde hiç görünmez */
#mbBar, #mbDrawer, #mbDrawerShade, .mb-tools-close, #mbMapToggle, #mbGrid { display: none; }

@media (max-width: 760px) {
  :root { --mb-bar-h: 60px; --mb-sheet-h: 46dvh; }

  html, body { overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
  body { height: 100vh; height: 100dvh; font-size: 14px; -webkit-tap-highlight-color: transparent; }

  /* --- Çalışma kitabı sekmeleri üst çubuğu: menüye taşındı --- */
  .doc-tabs { display: none !important; }

  /* --- Üst uygulama çubuğu --- */
  .office-header { height: 52px; padding: 0 4px; gap: 2px; flex: none; }
  .header-left { flex: 1; min-width: 0; gap: 0; }
  .app-waffle-btn { width: 52px; height: 48px; padding: 2px 0 0; border-radius: 12px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
  .app-waffle-btn .mb-wf-t { font-size: 11px; font-weight: 700; line-height: 1; color: #fff; }
  .app-logo { flex: 1; min-width: 0; gap: 0; }
  .app-icon { display: none; }
  .file-info { flex: 1; min-width: 0; }
  .file-name-input { width: 100%; font-size: 15px; padding: 1px 4px; text-overflow: ellipsis; }
  .save-status { padding-left: 4px; font-size: 11px; white-space: nowrap; overflow: hidden; }
  .header-center, #btnExportXlsx, #btnImportXlsx, #btnOpen3DMap, .user-avatar { display: none !important; }
  .header-right { gap: 0; flex: none; }
  .hdr-btn.ai-btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; justify-content: center; font-size: 0; margin-right: 2px; }
  .hdr-btn.ai-btn::before { content: "✨"; font-size: 18px; }
  .mb-more { width: 44px; height: 44px; border: 0; background: transparent; color: #fff; border-radius: 22px; display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
  .mb-more:active { background: rgba(255,255,255,.2); }

  /* --- Formül çubuğu --- */
  .formula-bar-container { height: 44px; padding: 0 6px; gap: 4px; flex: none; }
  .cell-name-box { width: 52px; height: 32px; border-radius: 6px; font-size: 13px; flex: none; }
  .formula-act-btn { width: 36px; height: 36px; font-size: 15px; flex: none; }
  .formula-act-btn.fx-btn { font-size: 18px; }
  .formula-input { height: 34px; border-radius: 6px; font-size: 16px; padding: 2px 10px; }
  .formula-input-wrap { min-width: 0; }

  /* --- Tablo alanı --- */
  .spreadsheet-workspace { min-height: 0; }
  .spreadsheet-grid-viewport { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-x pan-y; }
  .th-corner { width: 34px !important; min-width: 34px !important; }
  .th-row { font-size: 12px; }
  body.mb-select-mode .spreadsheet-grid-viewport { touch-action: none; outline: 3px solid #107c41; outline-offset: -3px; }
  body.mb-tools-open .spreadsheet-workspace { margin-bottom: calc(var(--mb-sheet-h) - var(--mb-bar-h) - 76px - env(safe-area-inset-bottom)); }

  /* --- Alt şerit: durum özeti + sayfa sekmeleri --- */
  .sheet-tabs-bar { height: auto; flex-direction: column; align-items: stretch; justify-content: flex-start; padding: 0; background: #fff; flex: none; }
  .sheets-status-right { order: -1; height: 32px; padding: 0 12px; gap: 14px; background: #f3f2f1; border-top: 1px solid #d1d1d1; overflow-x: auto; scrollbar-width: none; white-space: nowrap; flex: none; }
  .sheets-status-right .zoom-widget, .sheets-status-right .status-calc-item:nth-of-type(n+4) { display: none; }
  .status-calc-item { background: transparent; padding: 0; font-size: 12px; gap: 4px; flex: none; }
  .sheets-nav-left { max-width: none; width: 100%; height: 44px; gap: 0; border-top: 1px solid #e1dfdd; padding-left: 4px; align-items: stretch; }
  #sheetTabsContainer { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; align-items: stretch !important; gap: 0 !important; }
  .sheet-tab-item { height: 44px; bottom: 0; padding: 0 14px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; font-size: 14px; white-space: nowrap; flex: none; }
  .sheet-tab-item.active { background: transparent; border: 0; border-bottom: 3px solid var(--excel-green-primary); color: var(--excel-green-dark); font-weight: 700; }
  .add-sheet-btn { width: 44px; height: 44px; border-radius: 0; border-left: 1px solid #e1dfdd; margin: 0; font-size: 22px; color: var(--excel-green-dark); flex: none; }

  .mb-sheets-btn { display: flex; flex: none; width: 44px; height: 44px; border: 0; border-right: 1px solid #e1dfdd; background: #fff; color: var(--excel-green-dark); align-items: center; justify-content: center; padding: 0; cursor: pointer; }
  .sheet-tab-item { padding: 0 12px; }
  .sheet-tab-item .sheet-title { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
  #mbSheetsShade { display: block; position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,.45); opacity: 0; visibility: hidden; transition: opacity .2s, visibility 0s linear .2s; }
  #mbSheets { display: block; position: fixed; left: 0; right: 0; bottom: 0; max-height: 70dvh; overflow-y: auto; z-index: 410; background: #fff; border-radius: 18px 18px 0 0; box-shadow: 0 -6px 24px rgba(0,0,0,.25); transform: translateY(105%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; padding-bottom: env(safe-area-inset-bottom); }
  body.mb-sheets-open #mbSheetsShade { opacity: 1; visibility: visible; transition: opacity .2s; }
  body.mb-sheets-open #mbSheets { transform: none; visibility: visible; transition: transform .22s ease; }
  .mb-sh-h { padding: 16px 20px 8px; font-size: 12px; font-weight: 700; color: #616161; letter-spacing: .3px; text-transform: uppercase; }
  .mb-sh-it { display: block; width: 100%; min-height: 52px; padding: 0 20px; border: 0; border-top: 1px solid #edebe9; background: #fff; font: inherit; font-size: 16px; text-align: left; color: #242424; cursor: pointer; }
  .mb-sh-it.on { background: var(--excel-green-light); color: var(--excel-green-dark); font-weight: 700; }
  .mb-sh-it.add { color: var(--excel-green-dark); font-weight: 600; }

  /* --- Alt araç çubuğu (JS) --- */
  #mbBar { display: flex; flex: none; height: calc(var(--mb-bar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #fff; border-top: 1px solid #d1d1d1; z-index: 90; }
  .mb-tb { flex: none; width: 66px; min-width: 0; border: 0; background: transparent; color: #242424; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: inherit; font-size: 11px; padding: 0; cursor: pointer; }
  .mb-tb svg { width: 24px; height: 24px; }
  .mb-tb.on { color: var(--excel-green-dark); font-weight: 700; }
  .mb-tb:active { background: var(--excel-green-light); }

  /* --- Şerit → alttan açılan araçlar sayfası --- */
  .ribbon-container { position: fixed; left: 0; right: 0; bottom: 0; height: var(--mb-sheet-h); z-index: 250; background: #fff; border: 0; border-top: 1px solid #d1d1d1; border-radius: 18px 18px 0 0; box-shadow: 0 -6px 24px rgba(0,0,0,.22); transform: translateY(110%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; padding-bottom: env(safe-area-inset-bottom); }
  body.mb-tools-open .ribbon-container { transform: none; visibility: visible; transition: transform .22s ease; }
  .ribbon-container::before { content: ""; flex: none; width: 40px; height: 5px; border-radius: 3px; background: #c8c6c4; margin: 8px auto 2px; }
  .ribbon-tabs { flex: none; height: 48px; padding: 0 0 0 4px; gap: 0; background: #fff; border-bottom: 1px solid #e1dfdd; overflow-x: auto; scrollbar-width: none; }
  .ribbon-tab { flex: none; height: 48px; display: flex; align-items: center; padding: 0 16px; font-size: 15px; white-space: nowrap; border: 0; border-bottom: 3px solid transparent; border-radius: 0; margin: 0; background: transparent; }
  .ribbon-tab.active { border: 0; border-bottom: 3px solid var(--excel-green-primary); margin: 0; background: transparent; }
  .rb-collapse { display: none !important; }
  .mb-tools-close { display: flex; position: sticky; right: 0; margin-left: auto; flex: none; width: 48px; height: 48px; border: 0; border-left: 1px solid #e1dfdd; background: #fff; color: #424242; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
  .ribbon-container .ribbon-content, .ribbon-container.collapsed .ribbon-content { display: block !important; flex: 1; min-height: 0; max-height: none; overflow-x: hidden; overflow-y: auto; padding: 4px 14px 24px; -webkit-overflow-scrolling: touch; }
  .ribbon-panel, .ribbon-panel.active { min-height: 0; height: auto; }
  .ribbon-panel.active { flex-wrap: wrap; gap: 0; }
  .ribbon-group { width: 100%; min-width: 0; flex-direction: column-reverse; justify-content: flex-start; padding: 8px 0 10px; border-right: 0; border-bottom: 1px solid #edebe9; }
  .ribbon-group-title { text-align: left; padding: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; }
  .ribbon-group-content { flex-wrap: wrap; gap: 6px; align-items: center; }
  .ribbon-col-group, .ribbon-row-group { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .ribbon-btn-large { min-width: 64px; min-height: 56px; padding: 6px 8px; border: 1px solid #e1dfdd; border-radius: 10px; font-size: 12px; }
  .ribbon-btn-large svg { width: 24px; height: 24px; }
  .ribbon-btn-small { width: 44px; height: 44px; border: 1px solid #e1dfdd; border-radius: 10px; font-size: 14px; }
  .ribbon-btn-small svg { width: 20px; height: 20px; }
  .ribbon-select { height: 44px; font-size: 14px; border-radius: 10px; padding: 0 10px; max-width: 100%; }
  .ribbon-panel input[type=number], .ribbon-panel input[type=text] { height: 44px; font-size: 16px; }
  /* ui.css'deki .rb-* denetimleri: satırlar sarılsın, dokunma hedefi >= 44px */
  .ribbon-group-content { align-items: center; gap: 6px; }
  .rb-col, .rb-stack { flex-direction: row; flex-wrap: wrap; gap: 6px; max-width: 100%; }
  .rb-row { flex-wrap: wrap; gap: 6px; max-width: 100%; }
  .rb-sw { max-width: 100%; }
  .rb-sw .ribbon-btn-small { min-width: 44px; height: 44px; font-size: 15px; padding: 0 8px; }
  .rb-sw .ribbon-btn-small.wide { min-width: 140px; }
  .rb-bigwrap .rb-btn { min-width: 64px; height: 64px; }
  .rb-bigwrap .rb-lbl { max-width: 96px; font-size: 12px; line-height: 14px; }
  .rb-caret.sm { height: 44px; width: 22px; }
  .rb-caret { min-height: 20px; }
  .ribbon-select.rb-sel { height: 44px; }
  .rb-chk { min-height: 44px; font-size: 14px; }
  .rb-sl { font-size: 13px; }

  /* --- Soldan açılan menü (JS) --- */
  #mbDrawerShade { display: block; position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,.45); opacity: 0; visibility: hidden; transition: opacity .2s, visibility 0s linear .2s; }
  #mbDrawer { display: flex; flex-direction: column; position: fixed; left: 0; top: 0; bottom: 0; width: min(320px, 86vw); z-index: 410; background: #fff; box-shadow: 6px 0 28px rgba(0,0,0,.3); transform: translateX(-105%); visibility: hidden; transition: transform .22s ease, visibility 0s linear .22s; }
  body.mb-drawer-open #mbDrawerShade { opacity: 1; visibility: visible; transition: opacity .2s; }
  body.mb-drawer-open #mbDrawer { transform: none; visibility: visible; transition: transform .22s ease; }
  .mb-dr-head { flex: none; height: 96px; background: var(--excel-green-primary); color: #fff; display: flex; align-items: flex-end; gap: 12px; padding: 0 12px 14px 20px; }
  .mb-dr-logo { width: 40px; height: 40px; border-radius: 10px; background: var(--excel-green-dark); border: 1px solid rgba(255,255,255,.3); font-weight: 800; font-size: 22px; display: flex; align-items: center; justify-content: center; flex: none; }
  .mb-dr-ttl { flex: 1; min-width: 0; } .mb-dr-ttl b { display: block; font-size: 18px; } .mb-dr-ttl small { font-size: 12px; opacity: .9; }
  .mb-dr-x { width: 40px; height: 40px; border: 0; background: transparent; color: #fff; border-radius: 20px; font-size: 22px; cursor: pointer; flex: none; }
  .mb-dr-body { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); }
  #mbDrDocs { max-height: 34dvh; overflow-y: auto; }
  .mb-dr-sec { padding: 12px 20px 4px; font-size: 12px; font-weight: 700; color: #616161; letter-spacing: .3px; text-transform: uppercase; }
  .mb-dr-hl { height: 1px; background: #e1dfdd; margin: 6px 0; }
  .mb-dr-wb { display: flex; align-items: center; gap: 12px; width: 100%; height: 52px; padding: 0 12px 0 20px; border: 0; background: transparent; font: inherit; font-size: 14px; text-align: left; color: #242424; cursor: pointer; }
  .mb-dr-wb.on { background: var(--excel-green-light); color: var(--excel-green-dark); font-weight: 700; }
  .mb-dr-wb i { flex: none; width: 28px; height: 28px; border-radius: 6px; background: var(--excel-green-primary); color: #fff; font: normal 700 14px/28px var(--excel-font-family); text-align: center; }
  .mb-dr-wb span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mb-dr-wb u { flex: none; width: 36px; height: 36px; border-radius: 18px; text-decoration: none; text-align: center; line-height: 36px; font-size: 18px; color: #616161; }
  .mb-dr-it { display: flex; align-items: center; gap: 16px; width: 100%; height: 50px; padding: 0 20px; border: 0; background: transparent; font: inherit; font-size: 15px; text-align: left; color: #242424; cursor: pointer; }
  .mb-dr-lang { display: flex; gap: 8px; padding: 6px 20px 14px; }
  .mb-dr-lang button { flex: 1; height: 44px; border-radius: 12px; border: 1px solid #cfd8d3; background: #fff; font: inherit; font-weight: 600; color: #242424; cursor: pointer; }
  .mb-dr-lang button.on { background: #107c41; border-color: #107c41; color: #fff; }
  .mb-dr-it svg { flex: none; width: 22px; height: 22px; color: var(--excel-green-dark); }
  .mb-dr-it:active, .mb-dr-wb:active { background: #edebe9; }

  /* --- Açılır menüler / bağlam menüsü: dokunmatik boyut --- */
  .ctx-menu, .xl-menu { max-width: calc(100vw - 16px); max-height: 70dvh; overflow-y: auto; }
  .ctx-item, .xl-m-item { padding: 12px 14px; font-size: 15px; min-height: 44px; }
  .xl-menu.sub { position: fixed; }
  #formulaAutocomplete { max-width: 100vw; }
  .autocomplete-item { padding: 10px 12px; font-size: 14px; }

  /* --- Pencereler: tam ekran sayfa --- */
  .modal-overlay, .xl-overlay, .cw-overlay, .uf-overlay { align-items: stretch; justify-content: stretch; padding: 0 !important; backdrop-filter: none; }
  .modal-overlay.fw-float { padding: 0 !important; align-items: stretch; justify-content: stretch; }
  .modal-window, .xl-dialog, .cw-win { width: 100vw !important; max-width: 100vw !important; height: 100vh !important; height: 100dvh !important; max-height: none !important; border-radius: 0 !important; border: 0 !important; margin: 0 !important; }
  .modal-overlay.fw-float .modal-window { max-height: none !important; }
  .modal-header, .xl-d-head, .cw-head { padding: 0 8px 0 16px; min-height: 52px; background: var(--excel-green-primary); color: #fff; }
  .modal-header h3, .xl-d-head, .cw-head { color: #fff; font-size: 16px; }
  .modal-close-btn, .xl-d-x, .cw-head button { width: 44px; height: 44px; font-size: 24px; color: #fff; }
  .modal-close-btn:hover { background: rgba(255,255,255,.2); color: #fff; }
  .xl-d-body { padding: 14px 16px; }
  .xl-d-foot { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .xl-d-foot button { flex: 1; min-height: 44px; font-size: 15px; }
  .xl-row input:not([type=checkbox]):not([type=radio]), .xl-row select, .xl-row textarea { min-height: 44px; font-size: 16px; padding: 8px 10px; }
  .modal-body input, .modal-body select { font-size: 16px; }
  .modal-header .pv-src { color: rgba(255,255,255,.85); margin-left: 0; display: block; }
  .fr-input { flex: none !important; height: 44px; }
  .fr-body, .fw-body { overflow-y: auto; }
  .modal-footer { padding-bottom: calc(10px + env(safe-area-inset-bottom)); flex-wrap: wrap; gap: 8px; }
  .modal-footer button { min-height: 44px; flex: 1; }
  .cw-pivot .cw-body { flex-direction: column; }

  /* --- Yapay zekâ asistanı: tam ekran --- */
  .ai-dock { position: fixed; inset: 0; width: 100% !important; min-width: 0; max-width: none; z-index: 300; border: 0; box-shadow: none; }
  .ai-resize { display: none; }
  .ai-head { min-height: 60px; padding: 8px 8px 10px 12px; flex-wrap: wrap; gap: 8px 6px; }
  .ai-title { order: 0; flex: 0 0 calc(100% - 56px); min-width: 0; }
  .ai-head-btns { display: contents; }
  #aiBtnClose { order: 1; }
  .ai-head-btns > :not(#aiBtnClose) { order: 2; }
  #aiQuick { flex: 1 1 90px; min-width: 0; height: 44px; font-size: 14px; }
  .ai-head-btns button { width: 44px; height: 44px; font-size: 17px; border-radius: 22px; flex: none; }
  .ai-bubble { font-size: 15px; }
  .ai-chip { padding: 9px 16px; font-size: 14px; }
  .ai-inputrow textarea { font-size: 16px; border-radius: 20px; padding: 10px 14px; }
  .ai-inputrow button { width: 44px; height: 44px; border-radius: 22px; }
  .ai-foot { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .ai-settings input, .ai-settings select { font-size: 16px !important; min-height: 44px; }
  .ai-act-btns button, .ai-btnrow button { min-height: 44px; padding: 0 18px; font-size: 14px; }

  /* --- Bildirim --- */
  #appNotification { left: 8px !important; right: 8px !important; bottom: calc(var(--mb-bar-h) + 84px) !important; max-width: none !important; }

  /* --- Özet Tablo: tüm pencere tek parça kayar (alanlara/altındaki bölgelere ulaşılır) --- */
  .pv-docked, #pivotModal.pv-docked { z-index: 1100 !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important; width: 100% !important; height: 100% !important; }
  body.pv-editing .spreadsheet-workspace { margin-right: 0 !important; margin-bottom: 0 !important; }
  .pivot-modal-window, .pv-docked .pivot-modal-window { overflow-y: auto !important; overflow-x: hidden; display: block; -webkit-overflow-scrolling: touch; height: 100% !important; }
  .pivot-modal-window .modal-header { position: sticky; top: 0; z-index: 5; }
  .pivot-modal-window .pv-toolbar { flex: none; }
  .pivot-modal-window .pv-modal-body, .pv-docked .pv-modal-body { display: flex; flex-direction: column; overflow: visible !important; flex: none; padding: 10px; }
  .pivot-modal-window .pv-main, .pv-docked .pv-main { flex: none; max-height: none; min-height: 0; }
  .pivot-modal-window .pv-out, .pv-docked .pv-out { display: block !important; min-height: 160px; max-height: 50dvh; overflow: auto; }
  .pivot-modal-window .pivot-builder-pane { flex: none; width: 100%; min-height: 0; overflow: visible; }
  .pivot-modal-window .pivot-field-list { flex: none; max-height: 200px; }
  .pivot-modal-window .modal-footer { position: sticky; bottom: 0; background: #fff; z-index: 5; }

  /* --- 3D Harita: harita üstte tam genişlik, ayarlar alttan açılan panel (varsayılan kapalı) --- */
  .map3d-layout { flex-direction: column; }
  .map3d-viewport { flex: 1 1 auto; min-height: 0; width: 100%; }
  .map3d-sidebar { width: 100%; flex: none; max-height: 0; padding: 0 16px; border-left: 0; border-top: 1px solid #2a3b4c; overflow-y: auto; transition: max-height .25s ease, padding .25s ease; box-sizing: border-box; }
  #map3dModal.mb-map-settings .map3d-sidebar { max-height: 46dvh; padding: 16px; }
  .map3d-controls-overlay { top: 8px; left: 8px; right: 8px; padding: 6px 10px; font-size: 11px; gap: 8px; flex-wrap: wrap; }
  #mbMapToggle { position: absolute; right: 12px; bottom: 12px; z-index: 60; height: 44px; padding: 0 16px; border-radius: 22px; border: 0; background: #107c41; color: #fff; font: inherit; font-weight: 700; font-size: 14px; box-shadow: 0 6px 16px rgba(0,0,0,.4); cursor: pointer; display: flex; align-items: center; gap: 8px; }

  /* --- Alt çubuk: menü adı + kaydırılan simgeler --- */
  #mbBar { align-items: stretch; }
  .mb-chip { flex: none; width: 78px; border: 0; border-right: 1px solid #d1d1d1; background: var(--excel-green-primary); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font: inherit; font-size: 12px; font-weight: 700; padding: 0 4px; cursor: pointer; }
  .mb-chip span { max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mb-scroll { flex: 1; min-width: 0; display: flex; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .mb-scroll::-webkit-scrollbar { display: none; }
  .mb-tb .mb-ic { font-style: normal; display: flex; align-items: center; justify-content: center; height: 24px; font-size: 18px; line-height: 1; }
  .mb-tb .mb-ic svg { width: 22px; height: 22px; }
  .mb-tb span { max-width: 62px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; }
  .mb-tb.mb-sel { border-left: 1px solid #e1dfdd; width: 64px; }
  .mb-dr-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px 10px; }
  .mb-dr-tabs button { height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid #cfd8d3; background: #fff; font: inherit; font-size: 14px; font-weight: 600; color: #242424; cursor: pointer; }
  .mb-dr-tabs button.on { background: var(--excel-green-primary); border-color: var(--excel-green-primary); color: #fff; }

  /* --- Menü simgeleri: 4 sütunlu ızgara (menü adına dokununca) --- */
  #mbGrid { display: none; position: fixed; left: 0; right: 0; bottom: calc(var(--mb-bar-h) + env(safe-area-inset-bottom)); z-index: 95; max-height: 58dvh; overflow-y: auto; background: #fff; border-radius: 18px 18px 0 0; box-shadow: 0 -8px 28px rgba(0,0,0,.28); border-top: 1px solid #d1d1d1; -webkit-overflow-scrolling: touch; }
  body.mb-grid-open #mbGrid { display: block; }
  .mb-g-head { position: sticky; top: 0; z-index: 2; background: #fff; display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px 16px; border-bottom: 1px solid #edebe9; }
  .mb-g-head b { flex: 1; font-size: 16px; color: var(--excel-green-dark); }
  .mb-g-head button { height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid #cfd8d3; background: #f7faf8; font: inherit; font-size: 13px; font-weight: 600; color: #242424; cursor: pointer; }
  .mb-g-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 10px 12px 14px; }
  .mb-g-it { min-height: 78px; border: 1px solid #e1e9e4; background: #fff; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 4px; font: inherit; font-size: 11.5px; color: #242424; cursor: pointer; text-align: center; line-height: 1.2; }
  .mb-g-it:active { background: var(--excel-green-light); }
  .mb-g-it .mb-ic { font-style: normal; display: flex; align-items: center; justify-content: center; height: 26px; font-size: 20px; line-height: 1; }
  .mb-g-it .mb-ic svg { width: 24px; height: 24px; }
  .mb-g-it span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }

  /* --- Grafik sihirbazı: tek sütun; önizleme üstte sabit, altında türler (3'lü ızgara) ve ayarlar --- */
  .cw-overlay .cw-body { flex-direction: column !important; overflow-y: auto !important; overflow-x: hidden; display: flex; -webkit-overflow-scrolling: touch; }
  .cw-overlay .cw-prev { order: 1; flex: none !important; height: 236px; min-height: 0 !important; position: sticky; top: 0; z-index: 3; background: #fff; border-bottom: 1px solid #e1dfdd; padding: 8px !important; }
  .cw-overlay .cw-box { flex: 1; min-height: 0; }
  .cw-overlay .cw-note { font-size: 11px; min-height: 14px; }
  .cw-overlay .cw-types { order: 2; width: 100% !important; height: auto !important; flex: none !important; max-height: 250px !important; overflow-y: auto !important; display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 6px; padding: 8px !important; border-right: 0 !important; border-bottom: 1px solid #e1dfdd !important; }
  .cw-overlay .cw-g { grid-column: 1 / -1; margin: 8px 2px 0; font-size: 12px; }
  .cw-overlay .cw-t { flex-direction: column; justify-content: flex-start; text-align: center; gap: 4px; min-height: 70px; padding: 6px 3px !important; font-size: 11.5px; line-height: 1.2; border: 1px solid #e1e9e4; background: #fff; min-width: 0; overflow-wrap: anywhere; }
  .cw-overlay .cw-t span { width: 100% !important; flex: none !important; display: flex; justify-content: center; }
  .cw-overlay .cw-t.on { border-color: #107c41; background: #107c41; color: #fff; }
  .cw-overlay .cw-opts { order: 3; width: 100% !important; flex: none !important; max-height: none !important; overflow: visible !important; display: flex !important; flex-direction: column; gap: 12px; padding: 14px 14px 24px !important; border-left: 0 !important; border-top: 0 !important; font-size: 14px; }
  .cw-overlay .cw-opts input:not([type=checkbox]), .cw-overlay .cw-opts select { height: 44px !important; font-size: 16px !important; border-radius: 8px; }
  .cw-overlay .cw-opts input[type=checkbox] { width: 22px; height: 22px; }
  .cw-overlay .cw-opts label.cw-chk { min-height: 40px; font-size: 15px; }
  .cw-overlay .cw-row button { height: 44px; padding: 0 12px; font-size: 14px; }
  .cw-overlay .cw-sample button { min-height: 46px; font-size: 15px; }
  .cw-overlay .cw-foot { padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); gap: 8px; }
  .cw-overlay .cw-foot .cw-hint { display: none; }
  .cw-overlay .cw-foot button { flex: 1; height: 46px; font-size: 16px; border-radius: 10px; }
}
