:root {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-input: #ffffff;
  --bg-hover: #f1f5f9;
  
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --border-focus: #3b82f6;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-text: #1d4ed8;

  --success: #10b981;
  --success-light: #ecfdf5;
  --success-text: #047857;

  --danger: #ef4444;
  --danger-light: #fef2f2;
  --danger-text: #b91c1c;

  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --warning-text: #b45309;

  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  --purple-text: #6d28d9;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.03);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* Layout */
.app-container {
  display: flex;
  width: 100vw;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}
.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}
.brand-text h1 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}
.brand-text span {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-menu {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-item i {
  font-size: 18px;
  width: 22px;
  text-align: center;
}

.nav-item:hover {
  background-color: var(--bg-hover);
  color: var(--primary);
}

.nav-item.active {
  background-color: var(--primary-light);
  color: var(--primary-text);
}

/* User Box */
.user-box {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}
.user-details {
  line-height: 1.2;
  overflow: hidden;
}
.user-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 11px;
  color: var(--text-muted);
}
.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: 0.2s;
}
.btn-logout:hover {
  color: var(--danger);
  background: var(--danger-light);
}

/* Main Content Area */
.main-content {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100vw - 260px);
  padding-bottom: 20px;
}

/* Header */
.top-header {
  height: 72px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* Segment Pill Switcher */
.segment-switcher {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-full);
  gap: 4px;
  border: 1px solid var(--border-color);
}
.segment-btn {
  border: none;
  background: none;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.segment-btn:hover {
  color: var(--text-primary);
}
.segment-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.segment-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 800;
}
.segment-btn.active .segment-badge {
  background: var(--primary-light);
  color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Page Body */
.page-body {
  padding: 28px 32px;
  flex: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}
.btn-primary { background-color: var(--primary); color: #fff; }
.btn-primary:hover { background-color: var(--primary-hover); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25); }
.btn-success { background-color: var(--success); color: #fff; }
.btn-success:hover { background-color: #059669; }
.btn-danger { background-color: var(--danger); color: #fff; }
.btn-danger:hover { background-color: #dc2626; }
.btn-outline { background-color: #fff; border-color: var(--border-color); color: var(--text-secondary); }
.btn-outline:hover { background-color: var(--bg-hover); color: var(--text-primary); }

/* Bento Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stat-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-icon.purple { background: var(--purple-light); color: var(--purple); }

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}
.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* Card Container */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.card-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body {
  padding: 20px 24px;
}

/* Table Responsive (Desktop Default) */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
th {
  background-color: #f8fafc;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
td {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background-color: #fcfdfe; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-kurumsal { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-ozel { background: #fdf2f8; color: #be185d; border: 1px solid #fbcfe8; }
.badge-satis { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.badge-alis { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.badge-alacak { background: #ecfdf5; color: #047857; }
.badge-borc { background: #fef2f2; color: #b91c1c; }
.badge-notr { background: #f1f5f9; color: #64748b; }

/* ================= MOBILE NATIVE APP VIEW ================= */
.mobile-app-list {
  display: none; /* Desktop hidden */
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.app-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease;
}
.app-card:active {
  transform: scale(0.99);
}
.app-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-card-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.3;
}
.app-card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}
.app-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px dashed var(--border-color);
  border-bottom: 1px dashed var(--border-color);
}
.app-card-stat label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}
.app-card-stat span {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.app-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* MOBILE BOTTOM BAR (Telefonlar İçin Sabit Bar) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
  z-index: 999;
  justify-content: space-around;
  align-items: center;
  padding: 0 4px;
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 700;
  flex: 1;
  height: 100%;
  cursor: pointer;
  transition: all 0.2s;
}
.bottom-nav-item i {
  font-size: 20px;
}
.bottom-nav-item.active {
  color: var(--primary);
}
.bottom-nav-item.action-btn {
  position: relative;
  top: -12px;
  background: var(--primary);
  color: #ffffff;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}
.bottom-nav-item.action-btn i {
  font-size: 24px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.active { display: flex; }
.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-dialog.modal-lg { max-width: 950px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 800; color: var(--text-primary); }
.btn-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}
.modal-content { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: #f8fafc;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-input);
  outline: none;
}
.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

/* Radio Cards (Kurumsal vs Özel) */
.radio-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.radio-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}
.radio-card input { accent-color: var(--primary); transform: scale(1.2); }
.radio-card.selected { border-color: var(--primary); background: var(--primary-light); }
.radio-card-title { font-weight: 700; font-size: 14px; color: var(--text-primary); }
.radio-card-desc { font-size: 11px; color: var(--text-muted); }

/* Permissions Grid */
.permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}
.permission-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}
.permission-item input { margin-top: 3px; accent-color: var(--primary); transform: scale(1.15); }
.permission-label { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.permission-desc { font-size: 11px; color: var(--text-muted); line-height: 1.3; }

/* Filter Bar in Reports */
.filter-bar {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}
.toast {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

/* ================= RESPONSIVE TELEFON TASARIMI (MOBILE FIRST) ================= */
@media (max-width: 768px) {
  body {
    padding-bottom: 64px; /* Space for Bottom Nav Bar */
  }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: 2px 0 16px rgba(0,0,0,0.15);
  }
  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    width: 100vw;
  }

  .mobile-toggle {
    display: block;
  }

  /* Top Header on Mobile */
  .top-header {
    height: 60px;
    padding: 0 14px;
  }
  .header-actions {
    display: none; /* Mobilde alt bardaki hızlı ekle butonu kullanılacak */
  }

  /* Segment Switcher Mobilde Yatay Kaydırılabilir ve Kompakt */
  .segment-switcher {
    padding: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .segment-btn {
    padding: 4px 10px;
    font-size: 11px;
    gap: 4px;
  }
  .segment-badge {
    display: none; /* Mobilde tasarruflu alan */
  }

  .page-body {
    padding: 16px 12px;
  }

  /* Bento Stats Mobilde 2x2 veya 1x1 akış */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }
  .stat-card {
    padding: 14px;
    gap: 6px;
  }
  .stat-title {
    font-size: 11px;
  }
  .stat-icon {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  .stat-value {
    font-size: 18px;
  }
  .stat-sub {
    font-size: 10px;
  }

  /* Mobilde Masastü Tabloları Gizle, Uygulama Kartlarını Göster */
  .table-responsive {
    display: none;
  }
  .mobile-app-list {
    display: flex;
  }

  .card-header {
    padding: 14px 16px;
  }
  .card-body {
    padding: 14px 16px;
  }

  /* Mobile Bottom Nav Bar Aktif */
  .mobile-bottom-nav {
    display: flex;
  }

  /* Modallar Mobilde Bottom Sheet Görünümü */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .modal-dialog {
    max-height: 92vh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  @keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .modal-content {
    padding: 16px;
  }
  .modal-footer {
    padding: 12px 16px;
  }

  .radio-cards {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* Toast notification on mobile bottom above nav */
  .toast-container {
    bottom: 74px;
    right: 12px;
    left: 12px;
  }
  .toast {
    min-width: unset;
    width: 100%;
  }
}
