/* ═══════════════════════════════════════════════════════
   PİK ERP v4 — MAIN CSS
   Premium Industrial Dark Theme
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── DESIGN TOKENS ── */
:root {
  --bg:        #0a0b0d;
  --bg2:       #0f1114;
  --bg3:       #151820;
  --surface:   #1a1d24;
  --surface2:  #20242e;
  --modal-bg:  #2a2e38;
  --border:    rgba(255,255,255,0.07);
  --border2:   rgba(255,255,255,0.12);

  --text:      #f0f2f5;
  --text2:     #9aa3b4;
  --text3:     #5a6375;

  --blue:      #3b82f6;
  --blue-d:    #2563eb;
  --blue-soft: rgba(59,130,246,0.12);
  --green:     #22c55e;
  --green-soft:rgba(34,197,94,0.12);
  --amber:     #f59e0b;
  --amber-soft:rgba(245,158,11,0.12);
  --red:       #ef4444;
  --red-soft:  rgba(239,68,68,0.12);
  --purple:    #a855f7;
  --cyan:      #06b6d4;

  --accent:    #3b82f6;
  --accent2:   #1e40af;

  --r:         8px;
  --r-lg:      12px;
  --r-xl:      16px;

  --shadow:    0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);

  --sidebar-w: 220px;
  --header-h:  56px;

  --font:      'Plus Jakarta Sans', sans-serif;
  --mono:      'JetBrains Mono', monospace;

  --transition: 150ms cubic-bezier(.4,0,.2,1);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }

/* ── LAYOUT ── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition);
  position: relative;
  z-index: 10;
}

#sidebar.collapsed {
  width: 56px;
  min-width: 56px;
}

#logo {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  cursor: pointer;
  flex-shrink: 0;
}

.logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.logo-text {
  overflow: hidden;
  white-space: nowrap;
}
.logo-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}
.logo-sub {
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

#collapsed { overflow-y: auto; flex: 1; padding: 8px 0; }

.nav-section {
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 16px 14px 6px;
  white-space: nowrap;
  overflow: hidden;
}
#sidebar.collapsed .nav-section { opacity: 0; height: 0; padding: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 0;
  cursor: pointer;
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
  user-select: none;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active {
  background: var(--blue-soft);
  color: var(--blue);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--blue);
  border-radius: 0 2px 2px 0;
}
.nav-icon { font-size: 16px; flex-shrink: 0; width: 20px; text-align: center; }
.nav-label { overflow: hidden; }
#sidebar.collapsed .nav-label, #sidebar.collapsed .nav-badge { display: none; }

.nav-badge {
  margin-left: auto;
  background: var(--blue);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  flex-shrink: 0;
}
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border-radius: var(--r);
  padding: 6px 8px;
  transition: background var(--transition);
}
.user-card:hover { background: var(--surface); }
.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue-soft);
  border: 1px solid var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--blue);
  flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 600; }
.user-role { font-size: 10px; color: var(--text3); }
#sidebar.collapsed .user-card > *:not(.user-avatar) { display: none; }

/* ── MAIN ── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* ── HEADER ── */
#topbar {
  height: var(--header-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 5;
}

#sidebar-toggle {
  width: 32px; height: 32px;
  border-radius: var(--r);
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  font-size: 16px;
  transition: all var(--transition);
}
#sidebar-toggle:hover { background: var(--surface); color: var(--text); }

#page-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.topbar-spacer { flex: 1; }

#search-bar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 10px;
  gap: 8px;
  height: 34px;
  width: 220px;
  transition: all var(--transition);
}
#search-bar:focus-within {
  border-color: var(--blue);
  width: 280px;
}
#search-bar input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  width: 100%;
  font-family: var(--font);
}
#search-bar input::placeholder { color: var(--text3); }
.search-icon { color: var(--text3); font-size: 14px; }

.topbar-btn {
  width: 34px; height: 34px;
  border-radius: var(--r);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  font-size: 15px;
  transition: all var(--transition);
  position: relative;
}
.topbar-btn:hover { background: var(--surface); color: var(--text); border-color: var(--border2); }
.topbar-btn .dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 7px; height: 7px;
  background: var(--red);
  border-radius: 50%;
  border: 1.5px solid var(--bg2);
}

/* ── CONTENT ── */
#content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.page { display: none; }
.page.active { display: block; }

.page-body {
  padding: 24px;
  max-width: 1600px;
}

/* ── PAGE HEADER ── */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-head-left {}
.page-head h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.page-sub {
  font-size: 13px;
  color: var(--text2);
  margin-top: 3px;
}
.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: var(--font);
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-d); }
.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface); color: var(--text); border-color: var(--border2); }
.btn-danger { background: var(--red-soft); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success { background: var(--green-soft); color: var(--green); border: 1px solid rgba(34,197,94,0.2); }
.btn-success:hover { background: var(--green); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }
.btn-icon { padding: 7px; }

/* ── STATS GRID ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}
.stat-card:hover { border-color: var(--border2); transform: translateY(-1px); }

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--c, var(--blue));
  opacity: 0.6;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}
.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 6px;
}
.stat-change {
  font-size: 12px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-change.up { color: var(--green); }
.stat-change.dn { color: var(--red); }
.stat-icon {
  position: absolute;
  right: 16px; top: 16px;
  font-size: 24px;
  opacity: 0.2;
}

/* ── CARD ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.card-body { padding: 18px; }
.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}

/* ── GRID ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* ── TABLE ── */
.tbl-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.03); }
tbody td {
  padding: 12px 14px;
  color: var(--text2);
  vertical-align: middle;
}
tbody td:first-child { color: var(--text); font-weight: 500; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-blue   { background: var(--blue-soft);  color: var(--blue); }
.badge-green  { background: var(--green-soft); color: var(--green); }
.badge-amber  { background: var(--amber-soft); color: var(--amber); }
.badge-red    { background: var(--red-soft);   color: var(--red); }
.badge-gray   { background: var(--surface2);   color: var(--text2); }
.badge-purple { background: rgba(168,85,247,0.12); color: var(--purple); }
.badge-cyan   { background: rgba(6,182,212,0.12);  color: var(--cyan); }

/* ── FORM ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition);
}
.form-control:focus { border-color: var(--blue); }
.form-control::placeholder { color: var(--text3); }
select.form-control { cursor: pointer; }
select.form-control option { background: var(--bg3); }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── MODAL ── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(6px);
}
#modal-overlay.open { display: flex; }

/* index.html'deki statik modallar varsayılan olarak gizli.
   openModal() çağrılınca display:flex ile açılır, closeModal() kapatır.
   Cari modali gibi sayfa aralarında duran modallar "page" içinde değil, bu kural onları gizler. */
.page ~ .modal,
body > .modal,
#app > .modal,
#content > .modal,
.container > .modal,
.content > .modal {
  display: none;
}

.modal {
  background: var(--modal-bg);
  border: 2px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 580px;
  max-height: 90vh;
  flex-direction: column;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.8), var(--shadow-lg), 0 20px 80px rgba(0,0,0,0.8);
  animation: modal-in 0.2s ease;
}
/* PIK_COMOLOGGO MODAL FIX v5 - dinamik modallar overlay olarak davransin */
body > .modal.active {
  background: rgba(0, 0, 0, 0.6) !important;
  border: none !important;
  border-radius: 0 !important;
  max-width: none !important;
  max-height: none !important;
  width: 100vw !important;
  height: 100vh !important;
  box-shadow: none !important;
  animation: none !important;
}

/* Dinamik oluşturulan modallerin kutusu (projeler, cariler, harcama vb.) */
.modal.active,
div.modal[style*="display:flex"],
div.modal[style*="display: flex"] {
  position: fixed !important;
  inset: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(0,0,0,0.6) !important;
  z-index: 2000 !important;
  overflow-y: auto !important;
  padding: 20px !important;
}

.modal-box {
  background: var(--modal-bg) !important;
  border: 2px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--r-xl);
  max-width: 580px;
  width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.8), var(--shadow-lg), 0 20px 80px rgba(0,0,0,0.8);
  animation: modal-in 0.2s ease;
  overflow: hidden;
  color: var(--text);
  margin: auto;
}

.modal-box .modal-head {
  background: rgba(0,0,0,0.25);
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 15px;
}

.modal-box .modal-body {
  background: var(--modal-bg);
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-box .modal-foot {
  background: rgba(0,0,0,0.25);
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-box .btn-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text2);
  font-size: 18px;
  padding: 4px 10px;
  border-radius: var(--r);
  transition: all .15s;
}
.modal-box .btn-close:hover {
  background: var(--red-soft);
  color: var(--red);
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-lg { max-width: 900px; }
.modal-xl { max-width: 1400px; }

/* Overlay içindeki statik modaller (openModal ile açılan) otomatik ortalanır */
#modal-overlay > .modal {
  margin: auto;
}

.modal-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 15px;
  font-weight: 700;
}
.modal-close {
  width: 34px; height: 34px;
  border-radius: var(--r);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
  font-size: 18px;
  font-weight: 600;
  transition: all var(--transition);
  flex-shrink: 0;
}
.modal-close:hover { 
  background: var(--red); 
  color: #fff; 
  border-color: var(--red);
  transform: scale(1.05);
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  padding: 0;
}
.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition);
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ── SEARCH/FILTER BAR ── */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-search {
  flex: 1;
  min-width: 200px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  font-family: var(--font);
  transition: border-color var(--transition);
}
.filter-search:focus { border-color: var(--blue); }
.filter-search::placeholder { color: var(--text3); }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text3);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--text2); margin-bottom: 6px; }
.empty-text { font-size: 13px; }

/* ── TOAST ── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--r-lg);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.2s ease;
  pointer-events: none;
  box-shadow: var(--shadow-lg);
  max-width: 300px;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.success { border-left: 3px solid var(--green); }
#toast.error   { border-left: 3px solid var(--red); }
#toast.info    { border-left: 3px solid var(--blue); }

/* ── LOADING ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── UTILITY ── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.color-text2 { color: var(--text2); }
.color-text3 { color: var(--text3); }
.color-green { color: var(--green); }
.color-red { color: var(--red); }
.color-amber { color: var(--amber); }
.color-blue { color: var(--blue); }
.mono { font-family: var(--mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ═══════════════════════════════════════════════════════
   MOBİL VE TABLET — KAPSAMLI RESPONSIVE
   Breakpoint'ler: 1024 (tablet), 768 (mobil), 480 (küçük mobil)
   ═══════════════════════════════════════════════════════ */

/* ── TABLET (≤ 1024px) ── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 200px; }
  .page-body { padding: 20px; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

/* ── MOBİL (≤ 768px) ── */
@media (max-width: 768px) {

  /* MOBİL SCROLL FIX */
  html, body {
    height: auto !important;
    overflow: auto !important;
    overflow-x: hidden !important;
  }
  :root { --sidebar-w: 0px; --header-h: 52px; }
  
  /* App container — flex'i kaldır mobilde */
  #app {
    display: block !important;
    overflow: visible !important;
    height: auto !important;
    min-height: 100vh;
  }
  
  /* Sidebar — BASİT VE GÜÇLÜ, her detay !important */
  #sidebar {
    position: fixed !important;
    top: 0 !important;
    left: -280px !important;
    z-index: 9999 !important;
    width: 260px !important;
    min-width: 260px !important;
    max-width: 260px !important;
    height: 100vh !important;
    transition: left 0.28s ease !important;
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--bg2) !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
  
  /* AÇIK DURUM — kritik */
  #sidebar.mobile-open {
    left: 0 !important;
    transform: translateX(0) !important;
  }
  
  /* Collapsed mobile'da geçerli DEĞİL */
  #sidebar.collapsed {
    width: 260px !important;
    min-width: 260px !important;
  }
  
  /* Sidebar iç öğeler — mobile'da hep görünür */
  #sidebar .nav-section,
  #sidebar .nav-label,
  #sidebar .nav-badge,
  #sidebar .nav-icon {
    display: initial !important;
    opacity: 1 !important;
    height: auto !important;
    visibility: visible !important;
  }
  #sidebar .nav-item { 
    display: flex !important; 
    align-items: center !important;
    padding: 10px 16px !important;
  }
  #sidebar .nav-section { 
    display: block !important; 
    padding: 8px 16px !important;
  }
  #sidebar .user-card { display: flex !important; }
  #sidebar .user-card > *:not(.user-avatar) { display: block !important; }
  #sidebar .sidebar-footer { display: block !important; }
  
  /* Sidebar overlay (arkaplan karartma) */
  #sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    backdrop-filter: blur(2px);
  }
  #sidebar.mobile-open ~ #sidebar-overlay,
  body.sidebar-mobile-open #sidebar-overlay { display: block; }
  
  /* Topbar */
  #topbar {
    padding: 0 12px;
    height: var(--header-h);
  }
  #topbar #page-title { font-size: 15px; }
  .topbar-btn { display: none; }
  .topbar-search { display: none !important; }
  
  /* Hamburger butonu göster */
  #sidebar-toggle {
    display: flex !important;
    margin-right: 8px;
  }
  
  /* Ana içerik */
  #main { 
    margin-left: 0 !important; 
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 100vh !important;
    overflow: visible !important;
    height: auto !important;
  }
  .page-body { padding: 14px; }
  
  /* Page header */
  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .page-head-left h1 { font-size: 20px; }
  .page-head-left .page-sub { font-size: 12px; }
  .page-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .page-actions .btn { flex: 1; min-width: auto; font-size: 13px; padding: 10px 12px; }
  
  /* Grid sistemleri */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }
  .stats-grid { grid-template-columns: 1fr 1fr !important; }
  .form-row { grid-template-columns: 1fr !important; }
  
  /* Card */
  .card { border-radius: 10px; }
  .card-head { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .card-body { padding: 14px; }
  
  /* Stat card */
  .stat-card { padding: 12px; }
  .stat-value { font-size: 18px !important; }
  .stat-label { font-size: 11px; }
  
  /* PARMAK DOSTU BUTONLAR — min 44px */
  .btn {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 14px;
  }
  .btn-sm { min-height: 36px; padding: 6px 12px; font-size: 12px; }
  .btn-xs { min-height: 28px; padding: 4px 8px; font-size: 11px; }
  
  /* Form inputs */
  .form-control {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 16px; /* iOS zoom engellemek için 16px */
  }
  .form-control[type="date"],
  .form-control[type="time"],
  .form-control[type="datetime-local"] {
    min-height: 44px;
  }
  textarea.form-control { min-height: 60px; }
  select.form-control { min-height: 44px; font-size: 16px; }
  
  /* MODAL — TAM EKRAN mobilde */
  .modal {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }
  .modal-lg, .modal-xl { max-width: 100vw !important; width: 100vw !important; }
  #modal-overlay { padding: 0; }
  .modal-head {
    padding: 14px 16px;
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 10;
    border-bottom: 1px solid var(--border);
  }
  .modal-body { padding: 14px !important; }
  .modal-foot {
    padding: 12px 14px;
    position: sticky;
    bottom: 0;
    background: var(--surface);
    z-index: 10;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 6px;
  }
  .modal-foot .btn { flex: 1; min-width: auto; }
  
  /* Özel modal'lar (servis formu, teklif vs.) */
  .modal-box {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    overflow-y: auto !important;
  }
  
  /* TABLO — MOBİL KART GÖRÜNÜMÜ */
  .mobile-card-view table,
  .mobile-card-view thead,
  .mobile-card-view tbody,
  .mobile-card-view tr,
  .mobile-card-view td {
    display: block;
    width: 100%;
  }
  .mobile-card-view thead { display: none; }
  .mobile-card-view tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 12px 14px;
  }
  .mobile-card-view td {
    border: none !important;
    padding: 4px 0 !important;
    font-size: 13px;
  }
  .mobile-card-view td[data-label]::before {
    content: attr(data-label) ': ';
    color: var(--text3);
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    min-width: 100px;
  }
  
  /* Genel tablolar — yatay scroll */
  .tbl-wrap, table {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  table { min-width: 100%; }
  
  /* Filter bar */
  .filter-bar {
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }
  .filter-bar > * { width: 100% !important; max-width: 100% !important; }
  
  /* Topbar search gizle, yerine sidebar'dan arama */
  .topbar-search { display: none !important; }
  
  /* Uyarı panel */
  #uyari-panel {
    position: fixed !important;
    top: var(--header-h) !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    max-height: calc(100vh - var(--header-h)) !important;
    border-radius: 0 !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important;
  }
  
  /* Empty state küçük */
  .empty-state { padding: 30px 16px !important; }
  .empty-icon { font-size: 40px !important; }
  .empty-title { font-size: 14px !important; }
  .empty-sub { font-size: 12px !important; }
  
  /* Sidebar footer */
  .sidebar-footer { padding: 12px; }
  .user-card { padding: 8px; }
  
  /* Dashboard spesifik */
  #dashboard .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 8px; }
  
  /* Form groupları arası boşluk */
  .form-group { margin-bottom: 14px; }
  .form-label { font-size: 12px; margin-bottom: 4px; }
}

/* ── KÜÇÜK MOBİL (≤ 480px) ── */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr !important; }
  #dashboard .stats-grid { grid-template-columns: 1fr !important; }
  .page-head-left h1 { font-size: 18px; }
  .btn { font-size: 13px; padding: 10px 12px; }
  .page-actions .btn { width: 100%; }
  
  /* Tablo kart görünümüne zorla */
  .card table { font-size: 12px; }
  .card table td, .card table th { padding: 6px 8px; }
  
  /* Modal body daha dar padding */
  .modal-body { padding: 10px !important; }
  .modal-head { padding: 10px 12px; font-size: 14px; }
  
  /* Form row daha sıkışık */
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

/* ── HAMBURGER BUTONU ── */
#sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 22px;
  border-radius: var(--r);
  transition: background 0.2s;
}
#sidebar-toggle:hover { background: var(--surface); }

/* Body scroll lock mobile sidebar açıkken */
body.sidebar-mobile-open { overflow: hidden; }




/* PIK_COMOLOGGO MODAL FIX v2 */
.modal:has(> .modal-content) {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  align-items: flex-start !important;
  justify-content: center !important;
  padding: 24px !important;
  background: rgba(0,0,0,0.65) !important;
  backdrop-filter: blur(2px);
  z-index: 9999 !important;
  overflow-y: auto !important;
  margin: 0 !important;
  max-width: none !important;
  border: none !important;
  box-shadow: none !important;
  left: 0 !important;
  top: 0 !important;
  transform: none !important;
}

.modal > .modal-content {
  background: #2a2e38 !important;
  border: 2px solid rgba(59, 130, 246, 0.4) !important;
  border-radius: 12px !important;
  width: 100% !important;
  max-width: 1100px !important;
  max-height: calc(100vh - 48px) !important;
  margin: 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: 0 20px 80px rgba(0,0,0,0.8) !important;
  overflow: hidden !important;
  animation: modal-fade-in 0.18s ease-out !important;
}

@keyframes modal-fade-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  .modal:has(> .modal-content) { padding: 8px !important; }
  .modal > .modal-content {
    max-width: 100% !important;
    width: 100% !important;
    max-height: calc(100vh - 16px) !important;
    border-radius: 8px !important;
  }
}

/* ═══════════════ PIK_COMOLOGGO MODAL FIX v3 ═══════════════
   Cariler.js gibi document.body.appendChild ile eklenen
   dinamik modal'lar için ortalama. (Detay modal, hareket modal vb.)
   ════════════════════════════════════════════════════════════ */
body > .modal.active {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 9999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(0, 0, 0, 0.5) !important;
  padding: 20px !important;
  overflow-y: auto !important;
}
body > .modal > .modal-box {
  margin: auto !important;
  background: var(--bg2, #1f2937) !important;
  border: 1px solid var(--border, rgba(255,255,255,0.1)) !important;
  border-radius: 12px !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
}

/* ═══ MODAL FIX v4: align-items override ═══ */
.modal.active,
div.modal[style*="display:flex"],
div.modal[style*="display: flex"],
body > .modal,
#modal-overlay > .modal {
  align-items: center !important;
}
