:root {
  /* CoffeeBul — Zümrüt Yeşili konsepti */
  --bg: #f5f5f0;        /* kırık beyaz / krem — gövde zemini */
  --bg2: #ecefec;       /* hafif zemin — hover / ikincil yüzey */
  --card: #ffffff;      /* saf beyaz — içerik kartları */
  --ink: #333333;       /* kömür siyahı — metin & ikon */
  --muted: #7c8a89;     /* yumuşak gri */
  --line: #e4e7e5;      /* ince çizgi / kenarlık */
  --accent: #206367;    /* koyu zümrüt yeşili — birincil / aktif */
  --accent-d: #184d50;  /* koyu yeşil — gradyan / koyu ton */
  --top: #206367;       /* üst menü çubuğu */
  --top-d: #184d50;
  --green: #2ecc71;  --green-bg: #e8f6f3;   /* olumlu: satışta / sınırsız */
  --red: #e74c3c;    --red-bg: #fdedec;     /* olumsuz: kapalı / tükendi / sil */
  --orange: #e67e22; --orange-bg: #fef5e7;  /* düzenleme / uyarı / stok */
  --blue: #3a5bbf;                          /* bilgi: hazırlanıyor */
  --shadow: 0 4px 18px rgba(20, 50, 50, .08);
  --shadow-lg: 0 10px 30px rgba(20, 50, 50, .14);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
}
h2 { font-size: 20px; margin: 0; }
h3 { margin: 0; font-size: 17px; }
small { color: var(--muted); font-weight: 400; }

/* Üst bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(100deg, var(--top), var(--top-d));
  color: #fff; padding: 14px 20px; box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; letter-spacing: .2px; }
.brand span { font-weight: 400; opacity: .9; font-size: 15px; }
.brand .logo { width: 30px; height: 30px; flex: none; }

/* Düzen: sol menü + içerik */
.layout { display: flex; align-items: flex-start; min-height: calc(100vh - 58px); }
.sidebar {
  width: 224px; flex: none; background: var(--bg);
  border-right: 1px solid var(--line); padding: 14px 12px;
  position: sticky; top: 58px; height: calc(100vh - 58px); overflow-y: auto;
}
.tab {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  border: none; border-radius: 12px; padding: 12px 14px; margin-bottom: 4px;
  background: transparent; color: var(--ink); font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .15s, color .15s;
}
.tab svg { width: 19px; height: 19px; flex: none; }
.tab:hover { background: var(--bg2); }
.tab.active { background: linear-gradient(100deg, var(--accent), var(--accent-d)); color: #fff; box-shadow: var(--shadow); }

main { flex: 1; max-width: 960px; margin: 0 auto; padding: 22px; width: 100%; }
.view { display: none; }
.view.active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 10px; }

/* Butonlar */
.btn { border: none; border-radius: 11px; padding: 10px 16px; font-size: 14px; font-weight: 700; cursor: pointer; transition: filter .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(100deg, var(--accent), var(--accent-d)); color: #fff; box-shadow: var(--shadow); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.small { padding: 7px 12px; font-size: 13px; background: var(--bg2); color: var(--accent-d); }
.btn.danger { background: var(--red-bg); color: var(--red); }

/* Kategori başlığı */
.cat-title { margin: 20px 0 10px; font-size: 13px; font-weight: 800; color: var(--accent-d); text-transform: uppercase; letter-spacing: .6px; }

/* Kart */
.card {
  background: var(--card); border-radius: 16px; padding: 16px; margin-bottom: 12px;
  box-shadow: var(--shadow); display: flex; gap: 12px; align-items: flex-start;
  transition: box-shadow .15s, transform .1s;
}
.card:hover { box-shadow: var(--shadow-lg); }
.card .info { flex: 1; min-width: 0; }
.card .name { font-weight: 700; font-size: 15px; }
.card .price { color: var(--accent-d); font-weight: 800; margin-top: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.chip { background: var(--bg2); color: var(--ink); border-radius: 999px; padding: 3px 10px; font-size: 12px; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 700; }
.badge.ok { background: var(--green-bg); color: var(--green); }
.badge.off { background: var(--red-bg); color: var(--red); }
.badge.stock { background: var(--orange-bg); color: var(--orange); }
.card .acts { display: flex; flex-direction: column; gap: 6px; }
.icon-btn { border: none; background: var(--bg2); color: var(--ink); border-radius: 9px; padding: 8px 11px; cursor: pointer; font-size: 14px; transition: filter .15s; }
.icon-btn:hover { filter: brightness(.96); }
.icon-btn.edit { background: var(--orange-bg); color: var(--orange); }
.icon-btn.del { background: var(--red-bg); color: var(--red); }

/* Özet / dashboard kartları */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 8px; }
.stat { border-radius: 18px; padding: 20px; color: #fff; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.stat .label { font-size: 13px; opacity: .92; font-weight: 600; }
.stat .value { font-size: 30px; font-weight: 800; margin-top: 8px; line-height: 1.1; }
.stat .sub { font-size: 12px; opacity: .9; margin-top: 6px; }
.stat .ic { position: absolute; right: 14px; top: 14px; font-size: 26px; opacity: .35; }
.stat.s1 { background: linear-gradient(135deg, #2a7d82, #184d50); }
.stat.s2 { background: linear-gradient(135deg, #34c177, #1f9d57); }
.stat.s3 { background: linear-gradient(135deg, #4f6fd6, #2c46a0); }
.stat.s4 { background: linear-gradient(135deg, #e8923a, #c8631a); }
.top-row { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; box-shadow: var(--shadow); }
.top-row .rank { width: 26px; height: 26px; border-radius: 50%; background: var(--green-bg); color: var(--accent-d); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex: none; }
.top-row .nm { flex: 1; font-weight: 600; }
.top-row .qty { color: var(--muted); font-weight: 700; }
.bar { height: 8px; border-radius: 999px; background: var(--bg2); margin-top: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-d)); }

/* Sipariş kartı */
.order { background: var(--card); border-radius: 16px; padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.order .top { display: flex; justify-content: space-between; align-items: center; }
.order .no { font-weight: 800; color: var(--accent-d); }
.order .when { color: var(--muted); font-size: 12px; }
.order .items { margin: 6px 0; font-size: 14px; }
.order .tot { font-weight: 700; }
.order .row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.status-tag { font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 700; }
.s-new { background: var(--orange-bg); color: var(--orange); }
.s-preparing { background: #e8eefc; color: var(--blue); }
.s-ready { background: var(--green-bg); color: var(--green); }

/* Sipariş ilerleme göstergesi: Yeni → Hazırlanıyor → Hazır */
.steps { display: flex; gap: 6px; margin: 10px 0 4px; }
.step { flex: 1; text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--bg2); border-radius: 999px; padding: 5px 6px; }
.step.on { background: var(--green-bg); color: var(--green); }
.step.cur { background: linear-gradient(100deg, var(--accent), var(--accent-d)); color: #fff; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(15, 35, 35, .5); display: none; align-items: center; justify-content: center; z-index: 80; }
.modal.open { display: flex; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; border-radius: 18px; max-height: 92vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .18s ease; }
@keyframes pop { from { transform: scale(.97); opacity: .6; } to { transform: scale(1); opacity: 1; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.sheet-body { padding: 18px; overflow-y: auto; }
.sheet-foot { padding: 14px 18px; display: flex; gap: 10px; border-top: 1px solid var(--line); }
.sheet-foot .btn { flex: 1; }
.x { border: none; background: none; font-size: 18px; color: var(--muted); cursor: pointer; }

label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: var(--muted); }
input[type=text], input[type=number], input[type=time], input[type=password], select {
  width: 100%; margin-top: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 11px;
  font-size: 16px; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { width: 100%; margin-top: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; font-size: 15px; font-family: inherit; background: #fff; color: var(--ink); resize: vertical; }
textarea:focus { outline: none; border-color: var(--accent); }
.switch-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.switch { position: relative; width: 46px; height: 27px; flex: none; }
.switch input { display: none; }
.switch i { position: absolute; inset: 0; background: #d3dbd9; border-radius: 999px; transition: .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(19px); }

.sizes-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.size-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.size-row input { margin-top: 0; }
.size-row .nm { flex: 2; } .size-row .pr { flex: 1; }
.size-row .rm { border: none; background: var(--red-bg); color: var(--red); border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.hidden { display: none; }

/* Kullanıcı izin ızgarası */
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.perm-row select { width: auto; margin-top: 0; padding: 7px 10px; font-size: 14px; }

/* Ayarlar — gruplu, açıklamalı, profesyonel görünüm */
.set-group { background: var(--card); border-radius: 16px; padding: 4px 18px 8px; margin-bottom: 14px; box-shadow: var(--shadow); }
.set-head { font-size: 12px; font-weight: 800; color: var(--accent-d); text-transform: uppercase; letter-spacing: .6px; padding: 14px 2px 4px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 2px; border-top: 1px solid var(--line); }
.set-group .set-row:first-of-type { border-top: none; }
.set-label { font-weight: 600; font-size: 15px; }
.set-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.set-ctrl { flex: none; }
.set-ctrl input:not([type=checkbox]), .set-ctrl select { margin-top: 0; width: 190px; }
@media (max-width: 540px) {
  .set-row { flex-direction: column; align-items: stretch; }
  .set-ctrl input:not([type=checkbox]), .set-ctrl select { width: 100%; }
}

#productList, #orderList { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
#productList .cat-title { grid-column: 1 / -1; }

/* Mobil: sol menü üste yatay */
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: auto; height: auto; position: sticky; top: 58px; z-index: 20;
    display: flex; gap: 6px; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--line);
    padding: 8px;
  }
  .tab { width: auto; white-space: nowrap; margin-bottom: 0; padding: 9px 13px; font-size: 14px; }
  main { padding: 14px; }
}
