:root {
  /* Tütün / kahverengi tema */
  --green: #7a4a24;        /* ana marka rengi (tütün kahvesi) */
  --green-dark: #543116;   /* koyu kahve */
  --orange: #c2882f;       /* altın/amber vurgu */
  --bg: #e9dcc6;           /* sıcak parşömen */
  --card: #fbf5ea;         /* krem kart */
  --text: #3a2616;         /* koyu kahve metin */
  --muted: #927e64;
  --border: #ddccae;
  --danger: #a83b2b;
  --shadow: 0 2px 12px rgba(60, 35, 10, .12);
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Mobilde yakınlaştırmayı (zoom) engelle */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; }

/* Sohbet / mesaj */
.chat { display: flex; flex-direction: column; gap: 8px; }
.msg { position: relative; max-width: 82%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.35; word-wrap: break-word; box-shadow: var(--shadow); }
.msg-del { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%; border: none; background: var(--danger); color: #fff; font-size: 14px; line-height: 18px; padding: 0; cursor: pointer; opacity: .9; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.msg.user { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.msg.admin { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg .t { font-size: 10px; opacity: .65; margin-top: 4px; }
.chat-input {
  position: fixed; left: 0; right: 0;
  bottom: calc(56px + env(safe-area-inset-bottom));
  display: flex; gap: 8px; padding: 8px 10px;
  background: #fff; border-top: 1px solid var(--border); z-index: 24;
}
.chat-input input { flex: 1; border-radius: 22px; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  /* sıcak tütün arka planı: parşömen + ince doku */
  background-color: #e4d4ba;
  background-image:
    radial-gradient(circle at 20% 15%, rgba(122, 74, 36, .10), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(84, 49, 22, .12), transparent 45%),
    repeating-linear-gradient(115deg, rgba(120, 80, 40, .045) 0 2px, transparent 2px 9px),
    linear-gradient(160deg, #ecdfc7 0%, #ddc8a4 100%);
  background-attachment: fixed;
}

body { padding-bottom: 90px; }

a { color: var(--green-dark); }

/* Üst bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(135deg, #5e3819 0%, #7a4a24 55%, #8a5a2c 100%);
  color: #f7ead3;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 3px 14px rgba(50, 28, 8, .35);
  border-bottom: 2px solid #c2882f;
}
.topbar h1 { font-size: 19px; margin: 0; font-weight: 800; letter-spacing: .5px; flex: 1; }
.brandmark { width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 0 2px #c2882f; background: #000; }

/* Uygulamayı yükle çubuğu */
.install-bar {
  position: fixed; left: 10px; right: 10px; bottom: 74px;
  max-width: 700px; margin: 0 auto;
  background: #2a1a0e; color: #f7ead3;
  border: 1px solid #c2882f;
  border-radius: 14px; padding: 10px 12px;
  display: none; align-items: center; gap: 10px;
  box-shadow: 0 6px 22px rgba(0,0,0,.4); z-index: 60;
}
.install-bar.show { display: flex; }
.install-bar img { width: 38px; height: 38px; border-radius: 50%; }
.install-bar b { font-size: 14px; }
.install-bar .small { opacity: .8; }
.topbar .sub { font-size: 12px; opacity: .85; }

.wrap { max-width: 720px; margin: 0 auto; padding: 16px; }

/* Kartlar */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}

.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { justify-content: space-between; }

/* Butonlar */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  transition: filter .15s, transform .05s;
}
.btn:active { transform: scale(.97); }
.btn:hover { filter: brightness(1.05); }
.btn.full { width: 100%; }
.btn.orange { background: var(--orange); }
.btn.gray { background: #e4e7eb; color: #3e4c59; }
.btn.danger { background: var(--danger); }
.btn.outline { background: #fff; color: var(--green-dark); border: 1.5px solid var(--green); }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); }
label { font-size: 13px; font-weight: 600; color: #52606d; display: block; margin-bottom: 5px; }
.field { margin-bottom: 12px; }

/* Kod kutusu (cihaz kodu) */
.codebox {
  font-family: "SF Mono", "Consolas", monospace;
  font-size: 30px;
  letter-spacing: 4px;
  font-weight: 700;
  color: var(--green-dark);
  background: #eafaf1;
  border: 2px dashed var(--green);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  margin: 14px 0;
}

/* Ürün listesi */
.prod {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.prod:last-child { border-bottom: none; }
.prod .emoji {
  font-size: 34px;
  width: 50px;
  text-align: center;
  flex-shrink: 0;
}
.prod .info { flex: 1; min-width: 0; }
.prod .pname { font-weight: 600; }
.prod .pdesc { font-size: 12.5px; color: var(--muted); margin: 2px 0 3px; line-height: 1.25; }
.prod .pprice { color: var(--green-dark); font-weight: 700; font-size: 15px; }
.prod.off { opacity: .55; }

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  margin-left: 6px;
}
.badge.in { background: #def7ec; color: #03543f; }
.badge.out { background: #fde8e8; color: #9b1c1c; }
.badge.warn { background: #fdf6b2; color: #723b13; }

/* Adet sayacı */
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: none;
  background: var(--green);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.stepper button.minus { background: #e4e7eb; color: #3e4c59; }
.stepper .qty { min-width: 28px; text-align: center; font-weight: 700; }

/* Sepet alt çubuğu */
.cartbar {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(80px + env(safe-area-inset-bottom));
  background: var(--green-dark);
  color: #fff;
  padding: 12px 18px;
  display: none;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
  z-index: 24;
  border-radius: 14px;
  margin: 0 8px;
}
.cartbar.show { display: flex; }
.cartbar .total { font-size: 18px; font-weight: 800; }

/* Alt sekmeler */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 25;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1;
  border: none;
  background: none;
  padding: 10px 4px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.tabbar button .ic { font-size: 22px; }
.tabbar button.active { color: var(--green); font-weight: 700; }

/* Modal */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}
.modal-bg.show { display: flex; }
.modal {
  background: #fff;
  width: 100%;
  max-width: 720px;
  border-radius: 18px 18px 0 0;
  padding: 18px;
  max-height: 88vh;
  overflow-y: auto;
}

/* Sipariş kartı */
.order {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}
.order .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.order .oid { font-weight: 700; }
.order .line { font-size: 14px; color: #3e4c59; }

.status-pill {
  font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 20px;
}
.st-yeni { background: #fdf6b2; color: #723b13; }
.st-hazirlaniyor { background: #e1effe; color: #1e429f; }
.st-hazir { background: #def7ec; color: #03543f; }
.st-teslim { background: #e4e7eb; color: #3e4c59; }
.st-iptal { background: #fde8e8; color: #9b1c1c; }

/* Yönetici sekme başlığı */
.adm-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.adm-tabs button {
  border: none; background: #fff; color: #52606d;
  padding: 9px 14px; border-radius: 20px; font-weight: 600; font-size: 14px;
  cursor: pointer; box-shadow: var(--shadow); position: relative;
}
.adm-tabs button.active { background: var(--green); color: #fff; }
.count-badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--danger); color: #fff;
  font-size: 11px; min-width: 18px; height: 18px;
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}

.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: #1f2933; color: #fff; padding: 12px 20px; border-radius: 24px;
  font-size: 14px; z-index: 100; opacity: 0; transition: opacity .2s; pointer-events: none;
  max-width: 90%; text-align: center;
}
.toast.show { opacity: 1; }

.hidden { display: none !important; }

/* Aşağı çek-yenile göstergesi */
#ptr {
  position: fixed; top: 0; left: 50%;
  transform: translateX(-50%) translateY(-50px);
  z-index: 45; width: 42px; height: 42px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.28);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--green-dark); opacity: 0; pointer-events: none;
}
#ptr.refreshing span { display: inline-block; animation: ptrspin .7s linear infinite; }
@keyframes ptrspin { to { transform: rotate(360deg); } }

/* ===== v2 iyileştirmeleri ===== */

/* Üst bardaki yönetici (kilit) butonu */
.admin-link {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .14); color: #f7ead3;
  font-size: 17px; text-decoration: none; flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, .25);
}
.admin-link:active { background: rgba(255, 255, 255, .28); }

/* Arama + kategori çubuğu */
.shop-toolbar {
  background: var(--bg);
  margin: -16px -16px 12px; padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
}
.search {
  border-radius: 24px; border: 1.5px solid var(--border);
  background: #fff; padding: 11px 16px; font-size: 15px;
}
.chips { display: flex; gap: 8px; overflow-x: auto; margin-top: 10px; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; white-space: nowrap;
  border: 1.5px solid var(--border); background: #fff; color: #6b5640;
  padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip.active { background: var(--green); color: #fff; border-color: var(--green); }

.cat-head { margin: 18px 4px 8px; font-size: 16px; font-weight: 800; color: var(--green-dark); }
.cat-head:first-child { margin-top: 4px; }

/* Ürün emoji tile */
.prod .emoji {
  background: #f1e6d2; border-radius: 12px; height: 50px; line-height: 50px;
}

/* Yönetici istatistik kartları */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.stat {
  background: linear-gradient(135deg, #5e3819, #7a4a24); color: #f7ead3;
  border-radius: 14px; padding: 14px; box-shadow: var(--shadow);
}
.stat .v { font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat .l { font-size: 12px; opacity: .85; margin-top: 3px; }
.stat.gold { background: linear-gradient(135deg, #b3791f, #d6a13a); color: #2a1a08; }

/* Yönetici bildirim aç butonu (banner) */
.notice {
  display: flex; align-items: center; gap: 10px;
  background: #2a1a0e; color: #f7ead3; border: 1px solid #c2882f;
  border-radius: 12px; padding: 10px 12px; margin-bottom: 12px;
}
.notice b { font-size: 14px; }

/* Buton ripple/hover ince ayarlar */
.btn.orange:hover { filter: brightness(1.06); }
.fade-in { animation: fadein .25s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Giriş / Kayıt ekranı */
.auth-card { max-width: 420px; margin: 30px auto 0; }
.auth-logo { width: 84px; height: 84px; border-radius: 50%; background: #000; box-shadow: 0 0 0 3px #c2882f; }
.auth-tabs { display: flex; gap: 6px; background: #efe3cf; border-radius: 12px; padding: 4px; margin: 14px 0 16px; }
.auth-tabs button {
  flex: 1; border: none; background: none; padding: 10px; border-radius: 9px;
  font-weight: 700; font-size: 15px; color: #6b5640; cursor: pointer;
}
.auth-tabs button.active { background: var(--green); color: #fff; box-shadow: var(--shadow); }
.auth-msg { margin-top: 12px; font-size: 13.5px; font-weight: 600; min-height: 18px; }
.auth-msg.err { color: var(--danger); }
.auth-msg.ok { color: #1f7a43; }

/* Sayfalama */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 16px 0 6px; }
.pager span { font-weight: 700; font-size: 14px; color: #6b5640; min-width: 56px; text-align: center; }

/* Ürün görseli + Yeni rozeti */
.badge.new { background: #f7d9a6; color: #7a3e00; }
.badge.sale { background: var(--danger); color: #fff; }
.oldp { text-decoration: line-through; color: var(--muted); font-size: 13px; }
.salep { color: var(--danger); font-weight: 800; font-size: 16px; }
.prod-img { width: 50px; height: 50px; object-fit: cover; border-radius: 10px; display: block; }
.prod .emoji:has(.prod-img) { background: transparent; }
/* Görsel seçici (ürün düzenleme) */
.img-pick { display: flex; gap: 12px; align-items: flex-start; }
.img-box {
  width: 84px; height: 84px; border-radius: 12px; flex-shrink: 0;
  background: #f1e6d2; border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 30px; overflow: hidden;
}
.img-box img { width: 100%; height: 100%; object-fit: cover; }

/* Profil fotoğrafı */
.avatar-wrap { display: flex; justify-content: center; }
.avatar-img { width: 104px; height: 104px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--green); }
.avatar-ph { width: 104px; height: 104px; border-radius: 50%; background: #efe3cf; display: flex; align-items: center; justify-content: center; font-size: 52px; box-shadow: 0 0 0 3px var(--border); }
.user-av { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.user-av-ph { width: 40px; height: 40px; border-radius: 50%; background: #efe3cf; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }

/* Bildirimler */
.notif { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.notif.unread { border-left: 4px solid var(--orange); background: #fff8ec; }
.notif b { font-size: 15px; }
