* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
:root {
  --bg:#1a1d23; --panel:#242831; --accent:#e07b39; --accent2:#4a9d7f;
  --text:#e8e6e1; --muted:#8b8f99; --empty:#2f3440; --border:#353a45;
}
html,body { height:100%; }
body {
  font-family:'Segoe UI',system-ui,sans-serif; background:var(--bg); color:var(--text);
  line-height:1.5; display:flex; flex-direction:column; min-height:100vh; overflow:hidden;
}
header {
  background:var(--panel); padding:12px 18px; display:flex; justify-content:space-between;
  align-items:center; border-bottom:1px solid var(--border); flex-wrap:wrap; gap:10px; flex-shrink:0;
}
header h1 { font-size:1.25rem; font-weight:600; white-space:nowrap; }
header h1 span { color:var(--accent); }
.header-stats { display:flex; gap:16px; font-size:.82rem; }
.header-stats div { text-align:center; }
.header-stats b { display:block; font-size:1.1rem; color:var(--accent2); }
.header-btns { display:flex; gap:8px; }
button {
  cursor:pointer; border:none; border-radius:8px; padding:9px 15px; font-size:.88rem;
  font-weight:500; background:var(--accent); color:#fff; transition:filter .15s, transform .05s; white-space:nowrap;
}
button:hover { filter:brightness(1.12); }
button:active { transform:scale(.97); }
button.ghost { background:var(--empty); color:var(--text); border:1px solid var(--border); }
button.danger { background:#b23b3b; }
button.green { background:var(--accent2); }
button.editon { background:#d4a017; color:#1a1d23; }

/* senkron durum göstergesi (#24) */
.sync-dot { display:inline-block; width:9px; height:9px; border-radius:50%; background:var(--muted); margin-right:5px; vertical-align:middle; transition:background .3s; }
.sync-dot.online { background:#5fcf8a; }
.sync-dot.syncing { background:#d4a017; animation:pulse 1s infinite; }
.sync-dot.offline { background:#b23b3b; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:.3;} }
.sync-label { font-size:.78rem; color:var(--muted); }

.editbar {
  display:none; background:#3a3320; padding:8px 18px; gap:8px; align-items:center;
  border-bottom:1px solid var(--border); flex-wrap:wrap; flex-shrink:0; font-size:.85rem;
}
.editbar.show { display:flex; }
.editbar span { color:#f0d68a; }

.layout-wrap {
  flex:1; overflow:auto; width:100%; padding:0;
  -webkit-overflow-scrolling:touch;
}
/* floor'u margin:auto ile ortala. Bu, flex justify-content:center'ın aksine
   içerik ekrandan büyük olduğunda sol/üst taşan kısmı da scroll'la erişilebilir
   bırakır (büyük modda Masa 1-2'nin kesilme sorununu çözer). */
.floor {
  position:relative; background:#f2e2c4; margin:auto;
  box-shadow:0 8px 30px rgba(0,0,0,.4);
}
.wall { position:absolute; background:#15171c; z-index:5; }
.door { position:absolute; background:#f2e2c4; z-index:6; border:1px dashed #b9a87f; }
.door-label { position:absolute; color:#8a7350; z-index:7; pointer-events:none; }
.column {
  position:absolute; background:#15171c; border:3px solid #2a2d34; z-index:6;
  display:flex; align-items:center; justify-content:center; color:#9a9a9a; font-weight:700; border-radius:2px;
}
.room-label { position:absolute; font-weight:700; color:#6e5436; letter-spacing:1px; text-align:center; line-height:1.3; pointer-events:none; z-index:2; }
.fixture {
  position:absolute; border-radius:3px; font-weight:700; color:#fff; display:flex; align-items:center;
  justify-content:center; text-align:center; pointer-events:none; z-index:6; box-shadow:0 1px 3px rgba(0,0,0,.3);
  padding:2px; border:2px solid rgba(0,0,0,.4); overflow:hidden;
}
.wc-room {
  position:absolute; background:#eef2f7; border:3px solid #15171c; z-index:4;
  display:flex; align-items:flex-start; justify-content:center; color:#3a5bad; font-weight:700;
}
.table-btn {
  position:absolute; border:2px solid #8a6d4a; background:#c69a6d; color:#2b1d10; border-radius:5px;
  display:flex; flex-direction:column; align-items:center; justify-content:center; font-weight:700;
  transition:filter .12s; box-shadow:0 2px 4px rgba(0,0,0,.25); padding:2px; overflow:hidden; z-index:7;
}
.table-btn:active { filter:brightness(1.15); }
.table-btn.occupied { background:#3a7d52; border-color:#2a5e3d; color:#fff; box-shadow:0 0 0 2px #5fcf8a, 0 2px 8px rgba(0,0,0,.4); }
.table-btn.occupied .ttotal { color:#ffe49c; }
/* masa açılış süresi göstergesi (#10) */
.table-btn .ttime { color:#cfe8d6; opacity:.85; }
.table-btn.long-open { box-shadow:0 0 0 2px #d4a017, 0 2px 8px rgba(0,0,0,.4); }
.table-btn.long-open .ttime { color:#ffe49c; }
.table-btn.editing { cursor:grab; border-style:dashed; border-color:#d4a017; box-shadow:0 0 0 2px #d4a017; }
.table-btn.editing:active { cursor:grabbing; }
.table-del {
  position:absolute; top:-9px; right:-9px; width:20px; height:20px; border-radius:50%;
  background:#b23b3b; color:#fff; border:2px solid #fff; font-size:.7rem; display:flex;
  align-items:center; justify-content:center; z-index:9; line-height:1;
}

.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.65); z-index:100; align-items:center; justify-content:center; padding:16px; }
.modal-overlay.open { display:flex; }
.modal { background:var(--panel); border-radius:14px; width:100%; max-width:480px; max-height:90vh; overflow-y:auto; border:1px solid var(--border); }
.modal-head { padding:18px 20px; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; position:sticky; top:0; background:var(--panel); z-index:2; }
.modal-head h2 { font-size:1.15rem; }
.close-x { background:none; color:var(--muted); font-size:1.4rem; padding:0 6px; }
.modal-body { padding:20px; }
.product-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(95px,1fr)); gap:8px; margin-bottom:18px; }
.prod-btn { background:var(--empty); border:1px solid var(--border); color:var(--text); padding:12px 6px; border-radius:8px; font-size:.85rem; display:flex; flex-direction:column; gap:2px; }
.prod-btn:active { background:var(--accent); color:#fff; }
.prod-btn .pprice { font-size:.72rem; color:var(--muted); }
.order-list { list-style:none; margin-bottom:14px; }
.order-item { display:flex; align-items:center; justify-content:space-between; padding:10px 0; border-bottom:1px solid var(--border); font-size:.92rem; gap:8px; }
.order-item .qty-ctrl { display:flex; align-items:center; gap:6px; flex-shrink:0; }
.qty-ctrl button { width:30px; height:30px; padding:0; border-radius:6px; background:var(--empty); border:1px solid var(--border); color:var(--text); font-size:1.1rem; line-height:1; }
.order-item .line-total { min-width:72px; text-align:right; color:var(--accent2); font-weight:600; }
.empty-note { color:var(--muted); text-align:center; padding:14px 0; font-style:italic; }
.grand-total { display:flex; justify-content:space-between; align-items:center; padding:14px 0 4px; font-size:1.3rem; font-weight:700; }
.grand-total b { color:var(--accent); }
/* masa açılış bilgisi (#9) */
.table-meta { font-size:.8rem; color:var(--muted); padding:2px 0 10px; }
.modal-actions { display:flex; gap:8px; margin-top:16px; }
.modal-actions button { flex:1; padding:12px; }
.settings-row { display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.settings-row input[type=text] { flex:2; }
.settings-row input[type=number] { flex:1; }
input[type=text], input[type=number] { background:var(--empty); border:1px solid var(--border); color:var(--text); border-radius:7px; padding:11px; font-size:.95rem; width:100%; }
.add-prod-form { display:flex; gap:8px; margin:14px 0; }

/* satış geçmişi (#6) */
.history-section { margin-top:18px; border-top:1px solid var(--border); padding-top:14px; }
.history-section h3 { font-size:1rem; margin-bottom:10px; display:flex; justify-content:space-between; align-items:center; }
.history-list { list-style:none; max-height:240px; overflow-y:auto; }
.history-item { display:flex; justify-content:space-between; padding:8px 0; border-bottom:1px solid var(--border); font-size:.85rem; gap:8px; }
.history-item .h-when { color:var(--muted); }
.history-item .h-total { color:var(--accent2); font-weight:600; }
.history-empty { color:var(--muted); font-style:italic; text-align:center; padding:12px 0; }
.history-sum { display:flex; justify-content:space-between; padding:10px 0 0; font-weight:700; }
.history-sum b { color:var(--accent); }

.toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%); background:var(--accent2); color:#fff; padding:12px 22px; border-radius:10px; font-weight:500; z-index:200; opacity:0; transition:opacity .25s, transform .25s; pointer-events:none; max-width:90vw; text-align:center; }
.toast.show { opacity:1; transform:translateX(-50%) translateY(-6px); }

/* ===== "✓ Kaydedildi" rozeti ===== */
.saved-badge {
  position:fixed; top:14px; left:50%; transform:translateX(-50%) translateY(-30px);
  background:var(--accent2); color:#fff; padding:7px 18px; border-radius:20px;
  font-size:.85rem; font-weight:600; z-index:150; opacity:0; pointer-events:none;
  box-shadow:0 4px 14px rgba(0,0,0,.35); transition:opacity .25s, transform .25s;
}
.saved-badge.show { opacity:1; transform:translateX(-50%) translateY(0); }

/* ===== Kocaman onay modali (confirmBig) ===== */
.confirm-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.7); z-index:300;
  display:flex; align-items:center; justify-content:center; padding:20px;
  opacity:0; transition:opacity .18s;
}
.confirm-overlay.show { opacity:1; }
.confirm-box {
  background:var(--panel); border:1px solid var(--border); border-radius:18px;
  width:100%; max-width:440px; padding:28px 22px; text-align:center;
  transform:scale(.92); transition:transform .18s; box-shadow:0 12px 40px rgba(0,0,0,.5);
}
.confirm-overlay.show .confirm-box { transform:scale(1); }
.confirm-title { font-size:1.45rem; font-weight:700; margin-bottom:8px; }
.confirm-msg { font-size:1rem; color:var(--muted); margin-bottom:8px; line-height:1.5; }
.confirm-actions { display:flex; gap:12px; margin-top:22px; }
.confirm-actions button {
  flex:1; padding:18px 10px; font-size:1.15rem; font-weight:700; border-radius:12px;
}
.confirm-no { background:var(--empty); color:var(--text); border:1px solid var(--border); }
.confirm-yes { background:var(--accent2); }
.confirm-yes.danger { background:#b23b3b; }

/* ===== BÜYÜK DOKUNMA MODU ===== */
/* Masalar zoom ile (JS) büyür. Burada SADECE modal içi dokunma hedefleri
   büyür (sipariş ekranı, +/- kontrolleri). Header/üst butonlar büyümez —
   onlar telefonda yer kaplıyordu, asıl dokunulan masalar ve modal. */
body.big-mode .prod-btn { padding:22px 8px; font-size:1.2rem; min-height:84px; }
body.big-mode .prod-btn .pprice { font-size:1rem; }
body.big-mode .order-item { font-size:1.15rem; padding:16px 0; }
body.big-mode .qty-ctrl button { width:48px; height:48px; font-size:1.6rem; }
body.big-mode .order-item .line-total { font-size:1.2rem; min-width:95px; }
body.big-mode .grand-total { font-size:1.7rem; }
body.big-mode .modal-actions button { padding:20px; font-size:1.25rem; }
body.big-mode .modal-head h2 { font-size:1.4rem; }
/* geri al butonu pasifken soluk */
#undoBtn:disabled { opacity:.4; cursor:not-allowed; }

@media (max-width: 760px){
  header { padding:10px 12px; }
  header h1 { font-size:1.1rem; width:100%; text-align:center; }
  .header-stats { width:100%; justify-content:space-around; }
  .header-btns { width:100%; flex-wrap:wrap; }
  .header-btns button { flex:1; }
  .modal { max-width:100%; max-height:94vh; border-radius:14px 14px 0 0; }
  .modal-overlay { align-items:flex-end; padding:0; }
  .product-grid { grid-template-columns:repeat(3,1fr); }
  /* mobilde onay butonları daha da iri */
  .confirm-actions button { padding:20px 10px; font-size:1.2rem; }
  .confirm-title { font-size:1.3rem; }
}
@media (max-width: 420px){ .product-grid { grid-template-columns:repeat(2,1fr); } }
