* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

body {
  background-color: #f1f5f9;
  color: #1e293b;
  min-height: 100vh;
}

.hidden,
.main-layout.hidden,
.login-container.hidden {
  display: none !important;
}

/* Auth Initial Loader (FOUC / Anlık Login Ekranı Önleyici) */
.auth-loading-overlay {
  position: fixed;
  inset: 0;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.auth-loading-overlay.hidden {
  display: none !important;
}

.auth-loading-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: #f8fafc;
  text-align: center;
}

.auth-loading-logo {
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: #ffffff;
  box-shadow: 0 10px 25px rgba(2, 132, 199, 0.4);
  animation: authPulse 1.6s ease-in-out infinite alternate;
}

@keyframes authPulse {
  from { transform: scale(0.96); }
  to { transform: scale(1.05); }
}

.auth-loading-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: authSpin 0.75s linear infinite;
}

@keyframes authSpin {
  to { transform: rotate(360deg); }
}

.auth-loading-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #94a3b8;
  margin: 0;
}

/* Login Screen */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  position: relative;
  overflow-y: auto;
}

.login-box {
  background: #ffffff;
  padding: 36px;
  border-radius: 16px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
  width: 380px;
  text-align: center;
}

.login-box h2 {
  color: #0f172a;
  margin-bottom: 8px;
  font-size: 24px;
}

.login-box p {
  color: #64748b;
  font-size: 14px;
  margin-bottom: 24px;
}

.login-box input {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.login-box input:focus {
  border-color: #0284c7;
}

.remember-me-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: -4px;
  margin-bottom: 18px;
  user-select: none;
}

.remember-me-container label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13.5px;
  color: #475569;
  font-weight: 500;
}

.remember-me-container input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  padding: 0 !important;
  cursor: pointer;
  accent-color: #0284c7;
}

.forgot-password-link {
  color: #0284c7;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
}

.forgot-password-link:hover {
  color: #0369a1;
  text-decoration: underline;
}

.login-box button {
  width: 100%;
  padding: 12px;
  background: #0284c7;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
}

.login-box button:hover {
  background: #0369a1;
}

/* Main Layout */
.main-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: #0f172a;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  flex-shrink: 0;
}

.sidebar .brand {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #38bdf8;
  padding-left: 8px;
}

.sidebar .company-badge {
  background: #1e293b;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid #334155;
}

.sidebar .company-name {
  font-weight: 700;
  font-size: 14px;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar .invite-code {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar .menu {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar .menu .menu-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 16px 14px 4px 14px;
  user-select: none;
}

.sidebar .menu .menu-header:first-of-type {
  padding-top: 4px;
}

.sidebar .menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #94a3b8;
  text-decoration: none;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.sidebar .menu a:hover {
  background: #1e293b;
  color: #f8fafc;
}

.sidebar .menu a.active {
  background: #0284c7;
  color: #ffffff;
  font-weight: 600;
}

.sidebar .user-info {
  border-top: 1px solid #1e293b;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar .user-info span {
  font-size: 12px;
  color: #94a3b8;
  word-break: break-all;
}

.sidebar #btn-logout {
  background: #ef4444;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s;
}

.sidebar #btn-logout:hover {
  background: #dc2626;
}

/* Content Area */
.content {
  flex: 1;
  padding: 24px 30px;
  overflow-y: auto;
  height: 100vh;
}

@media (max-width: 1440px) {
  .content {
    padding: 20px 22px;
  }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
}

/* Cards & Grid */
.card {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.07), 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  margin-bottom: 24px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-left: 4px solid #0284c7;
  border-radius: 12px;
  min-width: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  background: #ffffff;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat-card[style*="cursor: pointer"]:hover,
.stat-card[style*="cursor:pointer"]:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.09);
}

.stat-card > div {
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.stat-card.warning {
  border-left-color: #f59e0b;
}

.stat-card.danger {
  border-left-color: #ef4444;
}

.stat-card.success {
  border-left-color: #10b981;
}

.stat-card .icon {
  font-size: 20px;
  color: #0284c7;
  background: #e0f2fe;
  padding: 10px;
  border-radius: 10px;
  flex-shrink: 0;
}

.stat-card.warning .icon {
  color: #d97706;
  background: #fef3c7;
}

.stat-card.danger .icon {
  color: #dc2626;
  background: #fee2e2;
}

.stat-card.success .icon {
  color: #059669;
  background: #d1fae5;
}

.stat-card h3 {
  font-size: clamp(14px, 1.2vw, 18px);
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
  letter-spacing: -0.4px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card p {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card small {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  margin-top: 2px;
}

/* Buttons */
.btn-primary {
  background: #0284c7;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: #0369a1;
}

.btn-secondary {
  background: #64748b;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-danger {
  background: #ef4444;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: 8px;
  background: #ffffff;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f8fafc;
}

.table-container::-webkit-scrollbar {
  height: 7px;
}

.table-container::-webkit-scrollbar-track {
  background: #f8fafc;
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  text-align: left;
}

#products table {
  min-width: 980px;
}

#invoices table {
  min-width: 950px;
}

table th {
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

table td {
  padding: 10px 12px;
  font-size: 13px;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

table tr:hover {
  background-color: #f8fafc;
}

/* Sticky Action Column (İşlemler) - Asla Ekranda Kesilmez / Taşmaz */
table th:last-child,
table td:last-child {
  position: sticky;
  right: 0;
  background: #ffffff;
  z-index: 2;
  box-shadow: -4px 0 8px -2px rgba(0, 0, 0, 0.06);
}

table th:last-child {
  background: #f8fafc;
  z-index: 3;
}

table tr:hover td:last-child {
  background: #f8fafc;
}

/* Badges */
.badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  display: inline-block;
  white-space: nowrap;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #e0f2fe; color: #075985; }
.badge-purple { background: #f3e8ff; color: #7e22ce; }
.badge-amber { background: #ffedd5; color: #c2410c; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.modal-content {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 12px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #94a3b8;
  cursor: pointer;
}

.modal-close:hover {
  color: #0f172a;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #f8fafc;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #0284c7;
  background: #ffffff;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

/* Period Tabs for Finance Section */
.period-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 8px;
  gap: 4px;
}

.period-tab {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}

.period-tab:hover {
  color: #0f172a;
}

.period-tab.active {
  background: #ffffff;
  color: #0284c7;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Geniş Modallar (Fatura ve Sevkiyat İçin) */
.modal-lg {
  max-width: 900px !important;
}

/* Kalem Ekleme Bölümü */
.items-builder-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  margin-top: 8px;
}

.items-table {
  width: 100%;
  margin-top: 12px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.items-table th {
  background: #e2e8f0;
  font-size: 12px;
  padding: 8px 10px;
}

.items-table td {
  padding: 8px 10px;
  font-size: 13px;
  background: #ffffff;
}

.invoice-summary-card {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.invoice-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

.invoice-summary-row.total {
  font-size: 18px;
  font-weight: 800;
  color: #0369a1;
  border-top: 2px dashed #93c5fd;
  padding-top: 8px;
  margin-top: 4px;
}

/* Durum Rozetleri Ek */
.badge-purple { background: #f3e8ff; color: #6b21a8; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-slate { background: #f1f5f9; color: #475569; }

/* Yazdırma Modalı ve Print Görünümü */
#modal-print .modal-content,
.modal-content.modal-print-dialog {
  max-width: 1350px !important;
  width: 96vw !important;
  max-height: 94vh !important;
  padding: 18px 24px !important;
  display: flex !important;
  flex-direction: column !important;
}

.print-scroll-wrap {
  overflow-x: auto;
  overflow-y: auto;
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  width: 100%;
}

.print-container {
  background: white;
  padding: 24px 28px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #0f172a;
  line-height: 1.45;
  min-width: 1180px;
  box-sizing: border-box;
}

.print-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 14px;
  margin-bottom: 16px;
}

.print-title {
  font-size: 20px;
  font-weight: 800;
  color: #0284c7;
  letter-spacing: -0.2px;
}

.print-meta {
  text-align: right;
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
}

.print-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.print-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
}

.print-box h4 {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  margin-bottom: 18px;
  font-size: 11px;
  background: #ffffff;
  table-layout: auto;
}

.print-table thead {
  display: table-header-group;
}

.print-table tr {
  break-inside: avoid;
  page-break-inside: avoid;
}

.print-table th {
  background-color: #0f172a !important;
  color: #ffffff !important;
  border: 1px solid #334155 !important;
  padding: 7px 9px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-align: left;
  white-space: normal !important;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.25;
  letter-spacing: 0.15px;
  vertical-align: middle;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

.print-table td {
  border: 1px solid #cbd5e1 !important;
  padding: 7px 9px !important;
  font-size: 11px !important;
  color: #1e293b !important;
  vertical-align: middle;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.3;
}

.print-table tbody tr:nth-child(even) td {
  background-color: #f8fafc !important;
}

.print-table tfoot td {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  font-weight: 700 !important;
  border-top: 2px solid #0f172a !important;
  border-bottom: 2px solid #0f172a !important;
  padding: 8px 9px !important;
  font-size: 11.5px !important;
}

.print-table td.nowrap, .print-table th.nowrap {
  white-space: nowrap !important;
}

.print-table td.num, .print-table th.num {
  text-align: right !important;
  white-space: nowrap !important;
  font-variant-numeric: tabular-nums;
}

.print-table td.center, .print-table th.center {
  text-align: center !important;
}

.print-badge-pkg {
  display: inline-block;
  padding: 2px 7px;
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
  border-radius: 5px;
  font-weight: 700;
  font-size: 11px;
  white-space: nowrap;
}

.print-totals {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 24px;
}

.print-totals-box {
  width: 290px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #f8fafc;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.print-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #334155;
}

.print-total-row.grand {
  font-size: 16px;
  font-weight: bold;
  color: #0284c7;
  border-top: 2px solid #0f172a;
  padding-top: 6px;
  margin-top: 4px;
}

.print-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px dashed #cbd5e1;
}

.print-sig-col {
  text-align: center;
  width: 220px;
  font-size: 12px;
  color: #475569;
}

/* PRO Rozeti */
.badge-pro {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  margin-left: auto;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
  letter-spacing: 0.5px;
  display: inline-block;
  line-height: 1.2;
}

@media print {
  @page {
    size: landscape;
    margin: 8mm;
  }

  html, body {
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  body * {
    visibility: hidden;
  }

  .no-print, .no-print * {
    display: none !important;
    visibility: hidden !important;
  }

  /* Modal sarmalayıcılarını sıfırla */
  .modal-overlay, #modal-print, .modal-content, .modal-lg, .modal-print-dialog, .print-scroll-wrap {
    position: static !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    backdrop-filter: none !important;
  }

  /* Sadece print-area ve içeriği yazdırılsın */
  #print-area, #print-area * {
    visibility: visible !important;
  }

  #print-area {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 6mm !important;
    background: #ffffff !important;
    display: block !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  #print-area table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 10.5px !important;
    page-break-inside: auto;
    margin-top: 8px;
    margin-bottom: 12px;
  }

  #print-area tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  #print-area th {
    background-color: #0f172a !important;
    color: #ffffff !important;
    padding: 6px 7px !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    border: 1px solid #334155 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  #print-area td {
    padding: 5px 7px !important;
    border: 1px solid #cbd5e1 !important;
    font-size: 10.5px !important;
    color: #1e293b !important;
  }

  #print-area tbody tr:nth-child(even) td {
    background-color: #f8fafc !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  #print-area tfoot td {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
    font-weight: 700 !important;
    border-top: 2px solid #0f172a !important;
    border-bottom: 2px solid #0f172a !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  #print-area .badge,
  #print-area .print-badge-pkg {
    border: 1px solid rgba(0,0,0,0.15) !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

/* Language Selector Styles */
.sidebar .lang-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 6px 10px;
  margin-top: 10px;
}

.sidebar .lang-selector i {
  color: #38bdf8;
  font-size: 13px;
}

.lang-select-input {
  background: transparent;
  color: #f8fafc;
  border: none;
  font-size: 13px;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  outline: none;
}

.lang-select-input option {
  background: #0f172a;
  color: #f8fafc;
}

.login-lang-picker {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 50;
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-lang-picker i {
  color: #38bdf8;
  font-size: 14px;
}

.login-lang-picker select {
  background: transparent;
  color: #ffffff;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.login-lang-picker select option {
  background: #0f172a;
  color: #ffffff;
}

/* =========================================================
   MOBILE TOPBAR & DRAWER CONTROLS (DESKTOP DEFAULT: HIDDEN)
   ========================================================= */
.mobile-topbar {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.sidebar-close-btn {
  display: none;
}

/* =========================================================
   RESPONSIVE DESIGN (TABLETS & SMARTPHONES <= 900px)
   ========================================================= */
@media (max-width: 900px) {
  /* Layout Changes - Flex column layout guarantees topbar and scrollable content never overlap */
  .main-layout:not(.hidden) {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
    position: relative !important;
  }

  .main-layout.hidden,
  .login-container.hidden {
    display: none !important;
  }

  /* Prevent iOS Safari automatic input zoom (<16px triggers viewport zoom) */
  input, select, textarea {
    font-size: 16px !important;
  }

  button, a {
    touch-action: manipulation;
  }

  /* Mobile Topbar - Rigid Header at top of main-layout flex */
  .mobile-topbar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 56px !important;
    flex-shrink: 0 !important;
    background: #0f172a !important;
    color: #ffffff !important;
    padding: 0 16px !important;
    position: relative !important;
    z-index: 800 !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
  }

  .mobile-menu-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f8fafc;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
  }

  .mobile-menu-btn:active {
    background: rgba(255, 255, 255, 0.2);
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 800;
    color: #f8fafc;
    letter-spacing: -0.3px;
  }

  .mobile-topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-company-badge {
    font-size: 11px;
    font-weight: 600;
    color: #38bdf8;
    background: #1e293b;
    border: 1px solid #334155;
    padding: 4px 10px;
    border-radius: 20px;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Sidebar Drawer */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 290px;
    max-width: 85vw;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    padding: 20px 16px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  /* RTL Support for Arabic Drawer */
  [dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    transform: translateX(100%);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  }

  [dir="rtl"] .sidebar.open {
    transform: translateX(0);
  }

  .sidebar .brand {
    justify-content: space-between;
    margin-bottom: 16px;
    padding-left: 0;
  }

  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
  }

  .sidebar-close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
  }

  /* Backdrop */
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 950;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* Content Padding & Overflow */
  /* Content Viewport: Starts directly below topbar, scrolls independently without clipping */
  .content {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 16px 12px !important;
    padding-bottom: max(32px, env(safe-area-inset-bottom, 32px)) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }

  .page-header h1 {
    font-size: 20px;
  }

  .page-header > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .page-header > div:last-child button,
  .page-header > div:last-child a {
    flex: 1 1 auto;
    justify-content: center;
  }

  /* Cards & Stats */
  .card {
    padding: 14px 12px !important;
    margin-bottom: 14px !important;
    border-radius: 10px !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 12px;
    gap: 10px;
    border-radius: 8px;
  }

  .stat-card .icon {
    font-size: 18px;
    padding: 8px;
    border-radius: 8px;
  }

  .stat-card h3 {
    font-size: 17px;
  }

  .stat-card p {
    font-size: 11px;
  }

  /* Modals */
  .modal-content {
    width: 95% !important;
    max-width: 95vw !important;
    padding: 20px 14px !important;
    max-height: 92vh !important;
    border-radius: 12px !important;
  }

  .modal-lg {
    max-width: 95vw !important;
  }

  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .modal-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .modal-actions button {
    width: 100%;
    justify-content: center;
    padding: 12px;
  }

  /* Tabs */
  .period-tabs {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding: 4px;
    scrollbar-width: none;
  }

  .period-tabs::-webkit-scrollbar {
    display: none;
  }

  /* 📱 MOBİL TABLOLAR: Sticky kolon kalkar, tüm sütunlar doğal genişlikte yatay kaydırılır */
  table th:last-child,
  table td:last-child {
    position: static !important;
    right: auto !important;
    box-shadow: none !important;
  }

  .table-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    margin-bottom: 6px !important;
    position: relative !important;
  }

  table {
    width: 100% !important;
    min-width: 620px !important;
    border-collapse: collapse !important;
  }

  #products table {
    min-width: 780px !important;
  }

  #invoices table {
    min-width: 780px !important;
  }

  #customers table {
    min-width: 650px !important;
  }

  #shipments table {
    min-width: 680px !important;
  }

  #recipes table {
    min-width: 580px !important;
  }

  #stock-move table {
    min-width: 620px !important;
  }

  #pricelist table {
    min-width: 680px !important;
  }

  table th,
  table td {
    padding: 9px 10px !important;
    font-size: 12.5px !important;
    white-space: nowrap !important;
  }

  table th {
    font-size: 12px !important;
  }

  /* Tablo İçi İşlem Butonları (Mobilde Kompakt & Taşmayan Tasarım) */
  table td .btn-sm,
  table td button {
    padding: 6px 9px !important;
    font-size: 11.5px !important;
    border-radius: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
    touch-action: manipulation !important;
  }

  /* Search & Filter Bars: Mobilde Tam Genişlik */
  .search-box input,
  #shipments-search-input,
  #products-search-input,
  #stock-search-input,
  #invoices-search-input,
  #employees-search-input,
  #trash-search-input {
    width: 100% !important;
    max-width: 100% !important;
  }

  #shipments-status-filter {
    width: 100% !important;
    min-width: 100% !important;
  }

  /* Login Screen */
  .login-box {
    width: 92%;
    max-width: 380px;
    padding: 28px 20px;
    margin: 16px;
  }

  .login-lang-picker {
    top: 14px;
    right: 14px;
    padding: 4px 10px;
    font-size: 12px;
  }
}


@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    padding: 12px 14px;
  }

  .mobile-brand span {
    font-size: 15px;
  }

  .page-header h1 {
    font-size: 18px;
  }
}


/* 🗑️ Geri Dönüşüm Kutusu (Trash) Stilleri */
.btn-filter-trash {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-filter-trash:hover {
  background: #e2e8f0;
}
.btn-filter-trash.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  font-weight: 700;
}


/* 🖼️ Ürün Görseli Önizleme & Küçük Resim Efektleri */
.prod-thumbnail-box {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.prod-thumbnail-box[data-img]:not([data-img=""]):hover {
  transform: scale(1.08);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12) !important;
  border-color: #0284c7 !important;
}
/* ==========================================
   ŞİRKET LOGOSU & DÜZENLEME STİLLERİ
   ========================================== */
.company-logo-avatar {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(56, 189, 248, 0.4);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.company-logo-avatar:hover {
  transform: scale(1.05);
  border-color: #38bdf8;
}

.company-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.company-logo-placeholder {
  color: #94a3b8;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-edit-company-icon {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  font-size: 13px;
  border-radius: 4px;
  transition: all 0.2s ease;
  line-height: 1;
}

.btn-edit-company-icon:hover {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
}
