@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import 'variables.css';

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Global SVG güvenlik kuralı — CSS class eksikliğinde bile şişmeyi engelle */
svg {
  overflow: hidden;
  flex-shrink: 0;
}
/* Boyutsuz (class dışında kalan) SVG'leri gizle */
svg:not([width]):not([height]):not([class]):not([style]) {
  max-width: 24px;
  max-height: 24px;
}

html {
  font-size: 14px;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ─── LAYOUT ──────────────────────────────── */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--color-white);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: var(--transition);
}

.sidebar-brand {
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand-logo {
  width: 36px; height: 36px;
  background: var(--color-primary);
  border-radius: var(--border-radius);
  display: flex; align-items: center; justify-content: center;
}

.sidebar-brand-logo svg { width: 20px; height: 20px; fill: var(--color-white); }

.sidebar-brand-text h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.3px;
}

.sidebar-brand-text span {
  font-size: 11px;
  color: var(--color-muted);
  font-weight: 400;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}

.sidebar-section-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 8px 12px 4px;
  margin-top: 8px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--border-radius);
  color: var(--color-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
  transition: var(--transition);
  margin-bottom: 2px;
}

.sidebar-nav a:hover {
  background: var(--color-soft);
  color: var(--color-primary);
}

.sidebar-nav a.active {
  background: var(--color-soft);
  color: var(--color-primary);
  font-weight: 600;
}

.sidebar-nav a svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.sidebar-nav a .nav-badge {
  margin-left: auto;
  background: var(--color-primary);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--color-border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--border-radius);
}

.sidebar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--color-muted); }

/* ─── MAIN CONTENT ──────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-height);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-size: 16px; font-weight: 600; color: var(--color-text); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.page-content { padding: 24px; flex: 1; }

/* ─── CARDS ──────────────────────────────── */
.card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title { font-size: 14px; font-weight: 600; color: var(--color-text); }
.card-body { padding: 20px; }

/* ─── STAT CARDS ──────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.stat-card-icon {
  width: 40px; height: 40px;
  background: var(--color-soft);
  border-radius: var(--border-radius);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}

.stat-card-icon svg { width: 20px; height: 20px; stroke: var(--color-primary); fill: none; stroke-width: 1.8; }

.stat-card-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card-label {
  font-size: 12px;
  color: var(--color-muted);
  font-weight: 400;
}

/* ─── BUTTONS ──────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--border-radius);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-white);
}
.btn-primary:hover { background: var(--color-secondary); color: white; }

.btn-secondary {
  background: var(--color-soft);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: var(--color-border); }

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }

.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }

.btn-success { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 10px 22px; font-size: 15px; }

.btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ─── FORMS ──────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--color-text); margin-bottom: 6px; }
.form-label .required { color: var(--color-primary); }

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  font-size: 13.5px;
  color: var(--color-text);
  background: var(--color-white);
  transition: var(--transition);
  font-family: var(--font-family);
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(217, 39, 58, 0.08);
}

.form-control::placeholder { color: var(--color-muted); }

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }

textarea.form-control { min-height: 90px; resize: vertical; }

.form-hint { font-size: 11px; color: var(--color-muted); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--color-primary); margin-top: 4px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ─── TABLE ──────────────────────────────── */
.table-responsive { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: var(--color-bg); border-bottom: 2px solid var(--color-border); }
thead th { padding: 10px 14px; font-weight: 600; color: var(--color-muted); text-align: left; white-space: nowrap; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }
tbody tr { border-bottom: 1px solid var(--color-border); transition: var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--color-soft); }
tbody td { padding: 12px 14px; color: var(--color-text); }

/* ─── BADGES ──────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-primary { background: var(--color-soft); color: var(--color-primary); }
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-warning { background: #fef3c7; color: #d97706; }
.badge-danger { background: #fee2e2; color: #dc2626; }
.badge-muted { background: var(--color-bg); color: var(--color-muted); border: 1px solid var(--color-border); }
.badge-info { background: #dbeafe; color: #2563eb; }

/* ─── ALERTS ──────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--border-radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}

.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ─── PAGINATION ──────────────────────────────── */
.pagination {
  display: flex; align-items: center; gap: 4px;
  margin-top: 20px;
  justify-content: center;
}

.pagination a, .pagination span {
  padding: 6px 12px;
  border-radius: var(--border-radius);
  font-size: 13px;
  text-decoration: none;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  transition: var(--transition);
}

.pagination a:hover { border-color: var(--color-primary); color: var(--color-primary); }
.pagination .active { background: var(--color-primary); color: white; border-color: var(--color-primary); }

/* ─── BREADCRUMB ──────────────────────────────── */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--color-muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--color-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb span { color: var(--color-muted); }

/* ─── SECTION HEADER ──────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}

.section-header h2 { font-size: 18px; font-weight: 700; color: var(--color-text); }
.section-header .actions { display: flex; gap: 8px; align-items: center; }

/* ─── SEARCH BAR ──────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: 0 12px;
  transition: var(--transition);
}
.search-bar:focus-within { border-color: var(--color-primary); }
.search-bar svg { width: 16px; height: 16px; stroke: var(--color-muted); fill: none; }
.search-bar input { border: none; outline: none; padding: 8px 0; font-size: 13px; color: var(--color-text); background: transparent; width: 220px; font-family: var(--font-family); }

/* ─── NOTIFICATION BELL ──────────────────────────────── */
.notif-btn {
  position: relative;
  width: 36px; height: 36px;
  border-radius: var(--border-radius);
  border: 1px solid var(--color-border);
  background: var(--color-white);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.notif-btn:hover { border-color: var(--color-primary); }
.notif-btn svg { width: 18px; height: 18px; stroke: var(--color-text); fill: none; stroke-width: 1.8; }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  width: 16px; height: 16px;
  background: var(--color-primary); color: white;
  border-radius: 50%; font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ─── EMPTY STATE ──────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-muted);
}
.empty-state svg { width: 48px; height: 48px; stroke: var(--color-muted); margin: 0 auto 16px; display: block; fill: none; opacity: 0.5; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--color-text); margin-bottom: 8px; }
.empty-state p { font-size: 13px; }

/* ─── RESPONSIVE / MOBİL ──────────────────────────────── */

/* Hamburger butonu — sadece mobilde göster */
.hamburger-btn {
  display: none;
  width: 36px; height: 36px;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  cursor: pointer;
  align-items: center; justify-content: center;
  flex-shrink: 0;
}
.hamburger-btn svg { width: 20px; height: 20px; stroke: var(--color-text); fill: none; stroke-width: 2; }

/* Sidebar overlay (mobilde) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* Sidebar kapat butonu (mobilde) */
.sidebar-close {
  display: none;
  position: absolute;
  top: 14px; right: 14px;
  width: 28px; height: 28px;
  background: var(--color-soft);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  align-items: center; justify-content: center;
  z-index: 10;
}
.sidebar-close svg { width: 14px; height: 14px; stroke: var(--color-text); fill: none; stroke-width: 2.5; }

/* PWA Install banner */
#pwa-install-banner {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  padding: 14px 20px;
  z-index: 1000;
  align-items: center;
  gap: 12px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
#pwa-install-banner.show { display: flex; }
#pwa-install-banner .pwa-icon {
  width: 44px; height: 44px;
  background: var(--color-primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 20px; font-weight: 900; color: white; font-family: Arial, sans-serif;
}
#pwa-install-banner .pwa-text { flex: 1; }
#pwa-install-banner .pwa-text strong { display: block; font-size: 14px; font-weight: 600; color: var(--color-text); }
#pwa-install-banner .pwa-text span { font-size: 12px; color: var(--color-muted); }
#pwa-install-banner .pwa-actions { display: flex; gap: 8px; align-items: center; }
#pwa-install-btn { background: var(--color-primary); color: white; border: none; padding: 8px 16px; border-radius: var(--border-radius); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
#pwa-dismiss-btn { background: none; border: none; color: var(--color-muted); cursor: pointer; font-size: 20px; line-height: 1; padding: 4px; }

/* Mobile bottom nav */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  z-index: 90;
  padding: 6px 0 env(safe-area-inset-bottom, 6px);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}
.mobile-bottom-nav ul {
  list-style: none;
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin: 0; padding: 0;
}
.mobile-bottom-nav li a {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 12px;
  text-decoration: none;
  color: var(--color-muted);
  font-size: 10px; font-weight: 500;
  border-radius: var(--border-radius);
  transition: var(--transition);
  min-width: 56px;
}
.mobile-bottom-nav li a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.mobile-bottom-nav li a.active,
.mobile-bottom-nav li a:hover { color: var(--color-primary); }
.mobile-bottom-nav li a .nav-dot {
  width: 6px; height: 6px;
  background: var(--color-primary);
  border-radius: 50%;
  position: absolute;
  top: 2px; right: 2px;
}

/* Tablo scroll göstergesi */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  max-width: 100%;
}
.table-responsive::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 24px;
  background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.table-responsive.has-scroll::after { opacity: 1; }

/* ─── TABLET (≤1200px) ──────────────────────────────── */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .page-content { padding: 20px; }
}
@media (max-width: 860px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  [style*="grid-template-columns:1fr 2fr"],
  [style*="grid-template-columns: 1fr 2fr"],
  [style*="grid-template-columns:2fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* ─── MOBİL (≤768px) ──────────────────────────────── */
@media (max-width: 768px) {

  /* ── Layout ── */
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
    width: min(280px, 85vw);
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
    transition: transform 0.25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .hamburger-btn { display: flex; }
  .main-content {
    margin-left: 0 !important;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
  .mobile-bottom-nav { display: block; }
  .page-content {
    padding: 14px;
    padding-bottom: calc(75px + env(safe-area-inset-bottom, 0px));
    max-width: 100%;
    overflow-x: hidden;
  }

  /* ── Topbar ── */
  .topbar {
    padding: 0 12px;
    max-width: 100%;
    overflow: hidden;
  }
  .topbar-title { font-size: 14px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-right { gap: 8px; flex-shrink: 0; }
  .topbar-right .topbar-user-name { display: none; }
  .search-bar { display: none; }

  /* ── Stats ── */
  .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .stat-card { padding: 12px; }
  .stat-card-value { font-size: 18px; }
  .stat-card-label { font-size: 11px; }
  .stat-card-icon { width: 32px; height: 32px; margin-bottom: 8px; }

  /* ── Section header ── */
  .section-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .section-header .actions { width: 100%; flex-wrap: wrap; }
  .section-header .actions .btn { flex: 1; justify-content: center; min-width: 100px; }

  /* ── Cards ── */
  .card-body { padding: 12px; }
  .card-header { padding: 10px 12px; }
  .card-header .card-title { font-size: 13px; }

  /* ── Forms ── */
  .form-grid,
  .form-grid-3 { grid-template-columns: 1fr !important; }
  .form-control { font-size: 16px; } /* iOS zoom engelleme */
  select.form-control { font-size: 16px; }

  /* ── Buttons ── */
  .btn { white-space: normal; }
  .btn-lg { padding: 10px 16px; font-size: 14px; }

  /* ── Tables ── */
  /* Tablolar en fazla screen genişliği kadar olsun, fazlası kaydır */
  .table-responsive { max-width: 100%; }
  .table-responsive table {
    min-width: 500px; /* scroll trigger: 500px'den büyük tablolar kaydırılır */
  }
  /* Kart içi çıplak tablolar */
  .card-body > table,
  .card > table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  thead th { padding: 8px 10px; font-size: 11px; }
  tbody td { padding: 10px 10px; font-size: 12px; }

  /* ── Inline grid override'ları (tüm varyantlar) ── */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 2fr"],
  [style*="grid-template-columns: 1fr 2fr"],
  [style*="grid-template-columns:2fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns:300px"],
  [style*="grid-template-columns: 300px"],
  [style*="grid-template-columns:1fr 300px"],
  [style*="grid-template-columns: 1fr 300px"],
  [style*="grid-template-columns:300px 1fr"],
  [style*="grid-template-columns: 300px 1fr"],
  [style*="grid-template-columns:1fr 3fr"],
  [style*="grid-template-columns: 1fr 3fr"],
  [style*="grid-template-columns:3fr 1fr"],
  [style*="grid-template-columns: 3fr 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  [style*="grid-template-columns:repeat(3"],
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns:repeat(4"],
  [style*="grid-template-columns: repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .responsive-grid-2 { grid-template-columns: 1fr !important; }
  .responsive-grid-3 { grid-template-columns: repeat(2, 1fr) !important; }

  /* Flash mesaj padding */
  [style*="padding: 0 24px"],
  [style*="padding:0 24px"] { padding: 0 12px !important; }

  /* Sayfa submit butonu */
  .card-body form > .btn[type="submit"],
  form .btn-submit-full { width: 100%; }

  /* Key-value detay tabloları */
  .card-body table td { white-space: normal; word-break: break-word; }
}

/* ─── MOBİL KART GÖRÜNÜMÜ (≤576px) ──────────────────── */
@media (max-width: 576px) {
  /* Tablolar kart formatına dönüşür — yatay scroll biter */
  .table-responsive {
    overflow-x: visible !important;
  }
  .table-responsive::after { display: none; }
  .table-responsive table,
  .table-responsive table thead,
  .table-responsive table tbody,
  .table-responsive table tr,
  .table-responsive table td {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  .table-responsive table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  .table-responsive table tbody tr {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 10px 14px;
    box-shadow: var(--shadow-sm);
  }
  .table-responsive table tbody tr:hover { background: var(--color-white); }
  .table-responsive table tbody td {
    border: none !important;
    padding: 5px 0 !important;
    font-size: 13px;
    display: flex !important;
    align-items: flex-start;
    gap: 8px;
    white-space: normal !important;
    word-break: break-word;
  }
  .table-responsive table tbody td:first-child { padding-top: 2px !important; }
  .table-responsive table tbody td:last-child { padding-bottom: 2px !important; }
  .table-responsive table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--color-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    min-width: 80px;
    flex-shrink: 0;
    padding-top: 2px;
  }
  /* İşlem butonları satırı düzgün görünsün */
  .table-responsive table tbody td:last-child {
    flex-wrap: wrap;
    gap: 6px;
  }
  .table-responsive table tbody td form { display: inline-flex; }
  .table-responsive table tbody td .btn-sm { padding: 5px 10px; font-size: 12px; }

  /* Stats 2 kolon kalır ama küçülür */
  .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 8px; }
  .stat-card { padding: 10px; }
  .stat-card-value { font-size: 16px; }
  .stat-card-icon { display: none; }

  /* Topbar daha kompakt */
  .topbar { height: 52px; }
  .topbar-title { font-size: 13px; }

  /* Pagination scroll edilebilir */
  .pagination { flex-wrap: wrap; gap: 4px; }

  /* Tab başlıkları kaydırılabilir */
  .tab-nav,
  .nav-tabs { overflow-x: auto; white-space: nowrap; display: flex; scrollbar-width: none; }

  /* Breadcrumb aşırı uzunsa gizle */
  .breadcrumb { flex-wrap: wrap; }
}

/* ─── ÇOK KÜÇÜK TELEFON (≤400px) ──────────────────── */
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr 1fr !important; gap: 6px; }
  .stat-card { padding: 8px 10px; }
  .stat-card-value { font-size: 15px; }
  .section-header h2 { font-size: 15px; }
  .page-content { padding: 10px; padding-bottom: calc(75px + env(safe-area-inset-bottom, 0px)); }
  .topbar { height: 50px; padding: 0 10px; }
  .btn { font-size: 12px; padding: 7px 10px; }
  .btn-sm { font-size: 11px; padding: 4px 8px; }
  .card-body { padding: 10px; }
  .card-header { padding: 8px 10px; }
}

/* PWA standalone modu iyileştirmeleri */
@media (display-mode: standalone) {
  .topbar {
    padding-top: env(safe-area-inset-top, 0);
  }
  body {
    padding-top: 0;
  }
}

/* Dokunmatik hedef boyutları */
@media (hover: none) and (pointer: coarse) {
  .btn, .sidebar-nav a, .mobile-bottom-nav li a {
    min-height: 44px;
  }
  .form-control, select.form-control {
    font-size: 16px; /* iOS zoom engellemek için */
    min-height: 44px;
  }
  .notif-btn { width: 44px; height: 44px; }
}

/* ─── RESPONSIVE GRID HELPERS ──────────────────────────────── */
.responsive-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.responsive-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 768px) {
  .responsive-grid-2 { grid-template-columns: 1fr !important; }
  .responsive-grid-3 { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 480px) {
  .responsive-grid-3 { grid-template-columns: 1fr !important; }
}

/* ─── UTILS ──────────────────────────────── */
.text-primary { color: var(--color-primary) !important; }
.text-muted { color: var(--color-muted) !important; }
.text-success { color: #16a34a !important; }
.text-danger { color: #dc2626 !important; }
.text-warning { color: #d97706 !important; }
.fw-bold { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }
.text-sm { font-size: 12px !important; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.d-flex { display: flex; } .align-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.w-100 { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.p-4 { padding: 16px; }
.divider { border: none; border-top: 1px solid var(--color-border); margin: 16px 0; }

/* ─── STATUS COLORS ──────────────────────────────── */
.status-pending { color: #d97706; }
.status-approved { color: #2563eb; }
.status-preparing { color: #7c3aed; }
.status-loaded { color: #0891b2; }
.status-delivered { color: #16a34a; }
.status-cancelled, .status-rejected { color: #dc2626; }
