/* QRMasa yonetim paneli */
:root {
    --bg: #f4f1ec; --card: #ffffff; --ink: #2b241c; --muted: #87786a;
    --acc: #b5713f; --acc-ink: #fff; --line: #e5ddd0; --side: #262019; --side-ink: #e9e2d6;
    --ok: #1b7d3e; --err: #b3261e; --warn: #b07711;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* acik display kurallari hidden'i ezmesin */
body { margin: 0; display: flex; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: system-ui, sans-serif; }
.side {
    width: 220px; flex: 0 0 220px; background: var(--side); color: var(--side-ink);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { font-weight: 800; font-size: 18px; padding: 18px 16px; display: flex; gap: 8px; align-items: center; }
.side-brand .logo { background: var(--acc); border-radius: 8px; padding: 2px 8px; font-size: 15px; color: #fff; }
.side nav { flex: 1; overflow-y: auto; }
.side nav a {
    display: block; color: var(--side-ink); text-decoration: none;
    padding: 11px 16px; font-size: 14px; opacity: .85;
}
.side nav a:hover { background: rgba(255,255,255,.06); opacity: 1; }
.side nav a.on { background: var(--acc); color: #fff; opacity: 1; font-weight: 700; }
.side-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.1); font-size: 13px; }
.side-user { margin-bottom: 6px; opacity: .8; }
.linklike { background: none; border: 0; color: var(--side-ink); text-decoration: underline; cursor: pointer; font-size: 13px; padding: 0; }
.main { flex: 1; padding: 24px 28px; max-width: 1200px; }
.main.full { max-width: none; display: flex; align-items: center; justify-content: center; }
h1 { margin-top: 0; font-size: 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat .num { font-size: 26px; font-weight: 800; margin-top: 4px; }
.stat .lbl { color: var(--muted); font-size: 13px; }
table.list { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--line); }
table.list td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
label { display: block; font-weight: 600; font-size: 13px; margin: 10px 0 4px; }
input, select, textarea {
    width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
    font-size: 14px; background: #fff; color: var(--ink); font-family: inherit;
}
input[type='checkbox'] { width: auto; }
.btn {
    display: inline-block; background: var(--acc); color: #fff; border: 0; border-radius: 9px;
    padding: 9px 16px; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none;
}
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--err); }
.btn.ok { background: var(--ok); }
.flash { border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.flash.ok { background: #e3f2e7; color: #14532d; }
.flash.err { background: #fde8e6; color: #8c1d17; }
.muted { color: var(--muted); font-size: 13px; }
.badge { display: inline-block; border-radius: 12px; padding: 2px 10px; font-size: 12px; font-weight: 700; }
.badge.on { background: #e3f2e7; color: #14532d; }
.badge.off { background: #eee; color: #777; }
.badge.warn { background: #fdf3dc; color: #7a5000; }
.inline-form { display: inline; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .sp { flex: 1; }
img.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: #eee; }

/* --- Giris sayfasi --- */
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.login-card h1 { text-align: center; }

/* --- Garson ekrani: masa izgarasi + adisyon cekmecesi --- */
.wgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.wtable {
    background: var(--card); border: 2px solid var(--line); border-radius: 14px;
    padding: 16px 12px; text-align: center; cursor: pointer; position: relative; user-select: none;
}
.wtable:hover { border-color: var(--acc); }
.wtable .tname { font-weight: 800; font-size: 16px; }
.wtable .tzone { color: var(--muted); font-size: 12px; }
.wtable .ttotal { margin-top: 8px; font-weight: 700; font-size: 14px; }
.wtable.occupied { border-color: var(--acc); background: #fbf3ea; }
.wtable.haspending { animation: blinkY 1.2s ease-in-out infinite; }
@keyframes blinkY { 0%, 100% { background: var(--card); } 50% { background: #ffe9a8; } }
.wbadge {
    position: absolute; top: -8px; right: -8px; background: var(--warn); color: #fff;
    border-radius: 50%; min-width: 24px; height: 24px; line-height: 24px; font-size: 13px; font-weight: 800;
}
.wbell { position: absolute; top: -10px; left: -6px; font-size: 20px; animation: ring .8s ease infinite; }
@keyframes ring { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg); } }
/* --- FAZ 12.7/12.8/12.12: masa oturumu, bolge sahipligi, masa notu --- */
.wtable .tsession { font-size: 13px; }
.wtable .tflag {
    margin-top: 6px; display: inline-block; background: var(--warn); color: #fff;
    border-radius: 6px; font-size: 11px; font-weight: 700; padding: 1px 8px;
}
.wtable .tnote {
    margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.3;
    max-height: 30px; overflow: hidden;
}
.wtable.flagged { border-style: dashed; }
.wtable.mine { box-shadow: inset 4px 0 0 var(--acc); }
.worder-item .gift { background: none; border: 0; cursor: pointer; font-size: 15px; opacity: .6; }
.worder-item .gift:hover { opacity: 1; }
.worder-item .splitchk { width: auto; }
.drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 60; }
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: 440px; max-width: 95vw;
    background: var(--card); z-index: 61; box-shadow: -8px 0 24px rgba(0,0,0,.2);
    display: flex; flex-direction: column;
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 18px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 14px 16px; }
.drawer-close { background: none; border: 0; font-size: 24px; cursor: pointer; color: var(--muted); }
.worder { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; overflow: hidden; }
.worder-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; background: var(--bg); font-size: 13px; }
.worder-head .st-pending { color: var(--warn); font-weight: 800; }
.worder-head .st-open { color: var(--ok); font-weight: 800; }
.worder-items { padding: 6px 12px; }
.worder-item { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; font-size: 14px; align-items: center; border-bottom: 1px dashed var(--line); }
.worder-item:last-child { border-bottom: 0; }
.worder-item .del { background: none; border: 0; color: var(--err); cursor: pointer; font-size: 15px; }
.worder-item .ks { font-size: 11px; color: var(--muted); }
.worder-foot { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); align-items: center; }
.worder-foot .total { font-weight: 800; margin-right: auto; }
.addline { display: flex; gap: 6px; margin-top: 4px; padding: 10px 12px; border-top: 1px dashed var(--line); }
.addline select { flex: 1; }
.addline input { width: 64px; }

/* ===================== FAZ 9: dokunmatik modal sistemi ===================== */
.qm-modal {
    position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200;
    display: flex; align-items: flex-end; justify-content: center; padding: 16px;
}
body.qm-modal-open { overflow: hidden; }
.qm-modal-card {
    background: var(--card); border-radius: 16px; width: 100%; max-width: 460px;
    max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
.qm-modal-card.wide { max-width: 620px; }
.qm-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.qm-modal-head h3 { margin: 0; font-size: 17px; }
.qm-modal-x { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 6px; }
.qm-modal-body { padding: 14px 16px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.qm-modal-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); }
.qm-modal-foot .btn { min-height: 44px; }
.qm-modal-msg { padding: 0 16px 10px; font-size: 13px; color: var(--muted); }
.qm-modal-msg.err { color: var(--err); font-weight: 700; }
.qm-info { margin: 0; font-size: 15px; line-height: 1.5; }
.qm-lbl { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 4px; }
.qm-wide { width: 100%; }

.qm-picklist { display: grid; gap: 8px; }
.qm-pick {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
    padding: 12px 14px; min-height: 52px; cursor: pointer; text-align: left; font: inherit; color: var(--ink);
}
.qm-pick:active { background: #f0e7da; }
.qm-pick[disabled] { opacity: .5; cursor: default; }
.qm-pick-main { font-weight: 700; font-size: 15px; }
.qm-pick-sub { font-size: 12px; color: var(--muted); }

.qm-stepper { display: flex; align-items: center; gap: 10px; }
.qm-step {
    width: 52px; height: 52px; border-radius: 12px; border: 1px solid var(--line);
    background: var(--bg); font-size: 24px; cursor: pointer; color: var(--ink);
}
.qm-num { width: 90px; text-align: center; font-size: 20px; font-weight: 800; padding: 12px 6px; }
.qm-num.qm-wide { width: 100%; }
/* Faz 10: sebep ve tutar girisi (QMUI.textSheet / amountSheet) */
.qm-text, .qm-amt {
    width: 100%; padding: 12px 10px; font-size: 16px;
    border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
.qm-amt { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.qm-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.qm-chip {
    border: 1px solid var(--line); background: var(--bg); border-radius: 20px;
    padding: 9px 16px; min-height: 40px; font-size: 14px; cursor: pointer; color: var(--ink);
}
.qm-chip.on { background: var(--acc); color: #fff; border-color: var(--acc); font-weight: 700; }
.qm-seg { display: flex; gap: 8px; }
.qm-segbtn {
    flex: 1; border: 1px solid var(--line); background: var(--bg); border-radius: 10px;
    padding: 12px; min-height: 46px; font-size: 14px; cursor: pointer; color: var(--ink);
}
.qm-segbtn.on { background: var(--acc); color: #fff; border-color: var(--acc); font-weight: 800; }

/* Urun ekleme paneli (arama + kategori + sik satilanlar) */
.qm-search { width: 100%; padding: 12px; font-size: 16px; }
.qm-favs-lbl { font-size: 12px; color: var(--muted); margin: 12px 0 6px; font-weight: 700; }
.qm-favs-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.qm-fav {
    flex: 0 0 auto; display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
    background: #fbf3ea; border: 1px solid var(--acc); border-radius: 12px;
    padding: 10px 14px; min-height: 48px; cursor: pointer; font: inherit; color: var(--ink);
}
.qm-cats { display: flex; gap: 8px; overflow-x: auto; margin: 10px 0; padding-bottom: 4px; }
.qm-cats .qm-chip { white-space: nowrap; }
.qm-plist { display: grid; gap: 6px; max-height: 46vh; overflow-y: auto; }
.qm-pitem {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
    padding: 12px 14px; min-height: 48px; cursor: pointer; font: inherit; color: var(--ink); text-align: left;
}
.qm-pitem[disabled], .qm-fav[disabled] { opacity: .45; cursor: default; }
.qm-pname { font-weight: 600; }
.qm-pname em { color: var(--err); font-style: normal; font-size: 12px; }
.qm-pprice { font-weight: 800; white-space: nowrap; }
.qm-back { background: none; border: 0; color: var(--acc); font-weight: 700; cursor: pointer; padding: 4px 0; font-size: 14px; }
.qm-detail-head { display: flex; justify-content: space-between; align-items: center; font-weight: 800; font-size: 16px; margin: 6px 0 10px; }
.qm-detail-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; }
.qm-detail-foot span { font-weight: 800; font-size: 17px; }
.qm-detail-foot .btn { min-height: 48px; }
.qm-optgroup { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 10px; }
.qm-optname { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.qm-optname .req { color: var(--err); }
.qm-optline {
    display: flex; align-items: center; gap: 10px; padding: 11px 8px; margin: 0;
    border-radius: 10px; min-height: 46px; cursor: pointer; font-weight: 400;
}
.qm-optline:active { background: var(--bg); }
.qm-optline input { width: 22px; height: 22px; flex: 0 0 auto; }
.qm-optlbl { flex: 1; font-size: 15px; }
.qm-optdelta { color: var(--muted); font-size: 13px; }
.qm-optline.hold { border: 1px dashed var(--line); margin-top: 12px; }

/* Garson kalem satiri: adet / ikram / bekletme kontrolleri */
.worder-item .itemctl { display: flex; gap: 2px; flex: 0 0 auto; }
.worder-item .itemctl button {
    background: none; border: 1px solid transparent; border-radius: 8px;
    min-width: 34px; min-height: 34px; cursor: pointer; font-size: 15px; color: var(--ink);
}
.worder-item .itemctl button:hover { border-color: var(--line); }
.worder-item .itemctl button[disabled] { opacity: .3; cursor: default; }
.worder-item .itemctl .del { color: var(--err); }
.worder-item .amt { white-space: nowrap; }
.worder-item.held { background: #fdf6e6; }
.worder-item .holdtag { color: var(--warn); font-size: 11px; }
.btn.fire { background: #c2410c; }
.addline { align-items: center; }
.addline .additem { min-height: 44px; }
.inline-lbl { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; margin: 0; }
.inline-lbl input { width: auto; }

/* Paket kartlari */
.pksec { font-size: 15px; margin: 18px 0 8px; }
.pksec.ok { color: var(--ok); }
.pkcard.ready { border-color: var(--ok); border-width: 2px; box-shadow: 0 0 0 3px rgba(27,125,62,.12); }
.pkmeta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.pkchip { background: var(--bg); border: 1px solid var(--line); border-radius: 20px; padding: 4px 10px; font-size: 12px; }
.pkchip.ok { background: #e3f2e7; color: #14532d; border-color: #b8ddc3; font-weight: 700; }
.pkchip.soon { background: #fdf3dc; color: #7a5000; border-color: #ecd9a8; font-weight: 700; }
.pkchip.late { background: #fde8e6; color: #8c1d17; border-color: #f0bdb8; font-weight: 700; }

/* ===================== FAZ 9: mobil kirilim (B16, B50) ===================== */
.mtopbar { display: none; }
.mnav-mask { display: none; }
@media (max-width: 860px) {
    body { display: block; }
    .mtopbar {
        display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 70;
        background: var(--side); color: var(--side-ink); padding: 8px 12px;
    }
    .mtoggle, .mkitchen {
        background: rgba(255,255,255,.1); border: 0; color: var(--side-ink); border-radius: 10px;
        min-width: 44px; min-height: 44px; font-size: 20px; cursor: pointer; text-decoration: none;
        display: inline-flex; align-items: center; justify-content: center;
    }
    .mtitle { flex: 1; font-weight: 800; font-size: 16px; }
    .side {
        position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; width: 260px; flex: none;
        transform: translateX(-102%); transition: transform .18s ease; z-index: 80;
    }
    .side.open { transform: translateX(0); }
    .mnav-mask { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 75; }
    .side nav a { padding: 14px 16px; font-size: 15px; }
    .main { padding: 14px 12px; max-width: none; }
    .grid2 { grid-template-columns: 1fr; }
    table.list { display: block; overflow-x: auto; white-space: nowrap; }
    /* Masa izgarasi telefonda 3 sutun sigsin */
    .wgrid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
    .wtable { padding: 12px 6px; }
    /* Adisyon cekmecesi tam ekran */
    .drawer { width: 100%; max-width: 100%; left: 0; }
    body.drawer-open { overflow: hidden; }
    .drawer-head { padding: 12px 14px; }
    .drawer-close { min-width: 44px; min-height: 44px; }
    /* Butonlar dokunma hedefi standardina cikar */
    .worder-foot { gap: 8px; }
    .worder-foot .btn.sm { min-height: 44px; flex: 1 1 44%; padding: 10px 8px; font-size: 14px; }
    .worder-foot .total { flex: 1 1 100%; margin-right: 0; font-size: 17px; }
    .worder-item { flex-wrap: wrap; padding: 8px 0; }
    .worder-item .itemctl button { min-width: 40px; min-height: 40px; }
    .qm-modal { padding: 0; align-items: stretch; }
    .qm-modal-card { max-width: none; border-radius: 16px 16px 0 0; margin-top: auto; max-height: 96vh; }
    .qm-plist { max-height: 40vh; }
    .toolbar input, .toolbar select { min-height: 44px; }
}
@media (max-width: 420px) {
    .worder-foot .btn.sm { flex: 1 1 100%; }
}

/* --- QR yazdirma (A4) --- */
@media print {
    .side, .toolbar, .flash, .no-print, .mtopbar, .mnav-mask, .qm-modal { display: none !important; }
    .main { padding: 0; max-width: none; }
    body { background: #fff; }
}
.qr-sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10mm; }
.qr-cell {
    border: 1px dashed #999; border-radius: 8px; padding: 8mm 4mm; text-align: center;
    page-break-inside: avoid;
}
.qr-cell .qrbox { display: flex; justify-content: center; margin: 4mm 0; }
.qr-cell .tn { font-weight: 800; font-size: 18px; }
.qr-cell .hint { font-size: 11px; color: #555; }

/* ---- Faz 8: toast (geri al / hata), siparis notu, kurulum uyarisi ---- */
.wtoast {
    position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 120;
    display: flex; gap: 12px; align-items: center; max-width: 92vw;
    background: #2b2119; color: #fff; border-radius: 12px; padding: 10px 14px;
    font-size: 14px; box-shadow: 0 8px 26px rgba(0,0,0,.3);
}
.wtoast.err { background: #8c1d17; }
.wtoast .btn { background: rgba(255,255,255,.18); color: #fff; border: 0; }
.worder-note {
    margin: 0 12px 6px; padding: 6px 8px; border-radius: 8px;
    background: #fdf3dc; color: #7a5000; font-size: 13px; font-weight: 700;
}
.addline .add-note { flex: 1; min-width: 110px; }
.install-warn { background: #fdf3dc; color: #7a5000; border-left: 4px solid #b07711; }

/* DEMO kurulumu bandi */
.flash.demo-banner {
    background: #eef4ff; color: #1c3d7a; border: 1px dashed #6f95d8;
    display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline;
}
.flash.demo-banner .muted { color: #4a6ba8; }
