* { box-sizing: border-box; }

:root {
  --navy: #0f2c4d;
  --navy-2: #1a4470;
  --accent: #e8a33d;
  --green: #16a34a;
  --red: #dc2626;
  --line: #e2e8f0;
  --bg: #f1f5f9;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: #0f172a;
  font-size: 14px;
}

/* ---------- Header ---------- */
header {
  background: var(--navy);
  color: #fff;
  padding: 18px 28px 0;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}

.brand { display: flex; align-items: center; gap: 14px; }

.logo {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--navy);
  border-radius: 12px; font-weight: 800; font-size: 17px;
}

header h1 { margin: 0; font-size: 20px; letter-spacing: .3px; }
header p  { margin: 2px 0 0; font-size: 12px; opacity: .7; }

.tabs { display: flex; gap: 4px; margin-top: 16px; flex-wrap: wrap; }

.tab-btn {
  background: transparent; border: 0; color: #cbd5e1;
  padding: 11px 18px; cursor: pointer; font-size: 14px; font-weight: 600;
  border-radius: 10px 10px 0 0; transition: .15s;
}
.tab-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.tab-btn.active { background: var(--bg); color: var(--navy); }

/* ---------- Layout ---------- */
main { padding: 24px 28px 60px; max-width: 1250px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

.card {
  background: #fff; border-radius: 14px; padding: 20px 22px;
  box-shadow: 0 1px 3px rgba(15,23,42,.07); margin-bottom: 20px;
}

.card h2 {
  margin: 0 0 16px; font-size: 16px; color: var(--navy);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card h2 small { font-weight: 500; font-size: 13px; color: #64748b; }

/* ---------- Form ---------- */
.grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}
.grid .wide { grid-column: 1 / -1; }

label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: #475569; }

input, select {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: #0f172a;
  transition: .15s; width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(26,68,112,.12); }

.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }

button {
  padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; transition: .15s;
}
button.primary { background: var(--navy); color: #fff; }
button.primary:hover { background: var(--navy-2); }
button.ghost { background: #fff; border-color: var(--line); color: #475569; }
button.ghost:hover { background: #f8fafc; }
button.sm { padding: 5px 10px; font-size: 12px; }
button.danger { background: #fef2f2; color: var(--red); border-color: #fecaca; }
button.danger:hover { background: var(--red); color: #fff; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap;
}
.toolbar label { min-width: 160px; }
.toolbar button { height: 38px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: #64748b; background: #f8fafc; white-space: nowrap; }
tbody tr:hover { background: #f8fafc; }
.right { text-align: right; }
tfoot th { background: #f1f5f9; color: var(--navy); font-size: 13px; }
.empty { text-align: center; color: #94a3b8; padding: 28px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: #fff; border-radius: 14px; padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(15,23,42,.07);
  border-left: 4px solid var(--navy);
}
.stat span { font-size: 12px; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.stat strong { display: block; font-size: 24px; margin-top: 4px; color: var(--navy); }
.stat.accent { border-left-color: var(--accent); }
.stat.accent strong { color: #b45309; }
.stat.green { border-left-color: var(--green); }
.stat.green strong { color: var(--green); }

/* ---------- Badges ---------- */
.badge { padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge.beklemede     { background: #fef3c7; color: #92400e; }
.badge.hazırlanıyor  { background: #dbeafe; color: #1e40af; }
.badge.teslim        { background: #dcfce7; color: #166534; }
.badge.iptal         { background: #fee2e2; color: #991b1b; }

.empty-state { text-align: center; color: #64748b; padding: 50px 20px; font-size: 15px; }

/* ---------- Print ---------- */
@media print {
  header, .toolbar, .form-actions, button { display: none !important; }
  body { background: #fff; }
  main { padding: 0; max-width: 100%; }
  .card { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; }
}
.badge.beklemede    { background: #fee2e2; color: #991b1b; }  /* ödenmedi için override yok — mevcut renkler yeterli */
h3 { font-weight: 700; letter-spacing: .3px; }
button[disabled] { cursor: not-allowed; }
/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  animation: fade .15s ease;
}
.modal-box {
  background: #fff; border-radius: 14px;
  width: 100%; max-width: 520px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  background: #f8fafc;
}
.modal-head h2 { margin: 0; font-size: 16px; color: var(--navy); }
.modal-close {
  background: transparent; border: 0; font-size: 18px; cursor: pointer;
  color: #64748b; padding: 4px 10px; border-radius: 6px; transition: .15s;
}
.modal-close:hover { color: var(--red); background: #fee2e2; }
.modal-body { padding: 20px; }
/* ================================================================
   MOBİL UYUM
   ================================================================ */

/* Dokunmatik dostu buton boyutları */
@media (hover: none) {
  button { min-height: 44px; padding: 11px 18px; }
  input, select { min-height: 44px; font-size: 16px; } /* 16px: iOS zoom engeller */
  button.sm { min-height: 38px; padding: 8px 14px; }
}

/* Tablet */
@media (max-width: 900px) {
  main { padding: 16px 14px 60px; }
  header { padding: 14px 16px 0; }
  header h1 { font-size: 17px; }
  .brand .logo { width: 38px; height: 38px; font-size: 15px; }
  .tab-btn { padding: 10px 12px; font-size: 13px; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
  .card { padding: 16px 14px; }
}

/* Telefon */
@media (max-width: 600px) {
  body { font-size: 13.5px; }

  /* Header kompakt */
  header { padding: 12px 12px 0; }
  .brand { gap: 10px; }
  .brand .logo { width: 34px; height: 34px; font-size: 13px; border-radius: 9px; }
  header h1 { font-size: 15px; }
  header p  { font-size: 10.5px; }

  /* Sekmeler: yatay kaydırma */
  .tabs {
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-top: 12px;
    padding-bottom: 2px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn {
    padding: 10px 14px;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Ana içerik */
  main { padding: 14px 10px 60px; }
  .card { padding: 14px 12px; border-radius: 12px; margin-bottom: 14px; }
  .card h2 { font-size: 15px; margin-bottom: 12px; }

  /* Form tek sütun */
  .grid { grid-template-columns: 1fr; gap: 12px; }
  label { font-size: 12px; }
  input, select { font-size: 16px; padding: 11px 12px; }

  /* Form aksiyonları tam genişlik */
  .form-actions { flex-direction: column; }
  .form-actions button { width: 100%; }

  /* Toolbar: üst üste yığılsın */
  .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .toolbar label { min-width: 100%; }
  .toolbar button { width: 100%; height: 44px; }

  /* Stats tek sütun */
  .stats { grid-template-columns: 1fr; gap: 10px; margin-bottom: 14px; }
  .stat { padding: 12px 16px; }
  .stat strong { font-size: 20px; }

  /* Tablolar: yatay kaydırma + küçük font */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;   /* kenara yapıştır */
    padding: 0 12px;
  }
  table { font-size: 12.5px; min-width: 600px; }
  th, td { padding: 9px 10px; }
  th { font-size: 10.5px; }

  /* Sipariş tablosundaki butonlar dikey */
  td .sm { display: block; width: 100%; margin: 2px 0; text-align: center; }

  /* Modal tam ekran */
  .modal { padding: 0; align-items: flex-end; }
  .modal-box {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
    overflow-y: auto;
  }
  .modal-head { padding: 14px 16px; }
  .modal-body { padding: 16px; }

  /* Makbuz: yeni sekmede zaten yazdırılıyor, sorun yok */
}

/* Çok küçük ekranlar (eski telefonlar) */
@media (max-width: 380px) {
  header h1 { font-size: 14px; }
  .tab-btn { padding: 9px 11px; font-size: 12px; }
  .stat strong { font-size: 18px; }
}
/* ---------- Kullanıcı Barı (header sağ üst) ---------- */
header {
  position: relative;
}

.user-bar {
  position: absolute;
  top: 18px;
  right: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
  letter-spacing: .2px;
}

.user-name::before {
  content: '👤 ';
  margin-right: 2px;
}

.logout-btn {
  background: rgba(255,255,255,.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,.18);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
}

.logout-btn:hover {
  background: #dc2626;
  border-color: #dc2626;
}

@media (max-width: 600px) {
  .user-bar {
    position: static;
    margin-top: 10px;
    justify-content: flex-end;
  }
  .user-name { font-size: 12px; }
  .logout-btn { padding: 6px 12px; font-size: 12px; }
}
/* ---------- Aylık Rapor — Bar Chart ---------- */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 220px;
  padding: 30px 0 0;
  overflow-x: auto;
  min-width: 100%;
  border-bottom: 1px solid var(--line);
}
.bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 42px;
  height: 100%;
  flex-shrink: 0;
}
.bar {
  width: 28px;
  background: linear-gradient(180deg, #1a4470 0%, #0f2c4d 100%);
  border-radius: 4px 4px 0 0;
  min-height: 3px;
  transition: .2s;
}
.bar-col:hover .bar { background: var(--accent); }
.bar-value {
  font-size: 9.5px;
  color: #64748b;
  font-weight: 700;
  margin-bottom: 3px;
  white-space: nowrap;
}
.bar-label {
  font-size: 10.5px;
  color: #475569;
  font-weight: 600;
  margin-top: 4px;
  padding-bottom: 4px;
}
@media (max-width: 600px) {
  .bar-chart { height: 170px; }
  .bar { width: 22px; }
  .bar-col { min-width: 34px; }
  .bar-value { font-size: 8.5px; }
}