:root {
  --bg: #f4f5f7; --card: #fff; --ink: #18202b; --mute: #667085; --line: #e3e6eb;
  --pri: #1e3a5f; --pri2: #2c5282; --acc: #0f9d58; --bad: #d92d20; --warn: #b54708; --soft: #eef2f7;
  --r: 10px; font-size: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.mute { color: var(--mute); }
.bad { color: var(--bad); } .ok { color: var(--acc); } .warn { color: var(--warn); }
.small { font-size: 13px; }

/* Üst çubuk + menü */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--pri); color: #fff; }
.top .brand { font-weight: 700; letter-spacing: .2px; margin-right: 6px; white-space: nowrap; }
.nav { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a { color: #cfdbea; text-decoration: none; padding: 8px 12px; border-radius: 8px; white-space: nowrap; font-weight: 500; }
.nav a.on { background: rgba(255,255,255,.16); color: #fff; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; font-size: 13px; background: rgba(255,255,255,.14); color: #fff; border: 0; white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #34d399; }
.pill.off .dot { background: #f87171; }
.pill.wait { background: #f59e0b; color: #1f1300; }
main { padding: 12px; max-width: 1280px; margin: 0 auto; }

/* Ortak öğeler */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.btn { border: 1px solid var(--line); background: #fff; padding: 9px 14px; border-radius: 8px; font-weight: 600; }
.btn.pri { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn.acc { background: var(--acc); border-color: var(--acc); color: #fff; }
.btn.bad { color: var(--bad); }
.btn.big { padding: 14px 18px; font-size: 17px; }
.btn:disabled { opacity: .5; cursor: default; }
.in { width: 100%; padding: 10px 12px; border: 1px solid #cdd3dc; border-radius: 8px; background: #fff; }
.in:focus { outline: 2px solid #93b4dd; border-color: var(--pri2); }
label.f { display: block; font-size: 13px; color: var(--mute); margin-bottom: 10px; }
label.f .in { margin-top: 4px; color: var(--ink); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
h2 { font-size: 18px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; color: var(--mute); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.t td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t td.r, table.t th.r { text-align: right; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover { background: var(--soft); }
table.t tr.void td { text-decoration: line-through; color: var(--mute); }
.list .it { display: flex; gap: 10px; align-items: center; padding: 11px 12px; border-bottom: 1px solid var(--line); cursor: pointer; background: #fff; }
.list .it:hover { background: var(--soft); }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--soft); color: var(--pri2); }
.tag.bad { background: #fee4e2; color: var(--bad); } .tag.warn { background: #fef0c7; color: var(--warn); } .tag.ok { background: #d1fadf; color: #067647; }
.empty { padding: 30px; text-align: center; color: var(--mute); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.stat b { display: block; font-size: 20px; margin-top: 2px; }

/* Kasa */
.pos { display: grid; grid-template-columns: 1fr 340px; gap: 12px; align-items: start; }
.scan { display: flex; gap: 8px; }
.scan .in { font-size: 18px; padding: 12px 14px; }
.cart { margin-top: 10px; }
.line { display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fff; }
.line:first-child { border-radius: var(--r) var(--r) 0 0; }
.line.flash { animation: fl .6s; }
@keyframes fl { from { background: #d1fadf; } to { background: #fff; } }
.line .nm { font-weight: 600; }
.qty { display: flex; justify-self: start; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty button { border: 0; background: var(--soft); width: 34px; height: 36px; font-size: 18px; }
.qty input { width: 56px; border: 0; text-align: center; height: 36px; }
.line .pr { width: 92px; text-align: right; border: 1px solid transparent; border-radius: 6px; padding: 6px; background: transparent; }
.line .pr:hover, .line .pr:focus { border-color: var(--line); background: #fff; }
.line .pr.disc { color: var(--warn); font-weight: 600; }
.line .tot { width: 96px; text-align: right; font-weight: 700; }
.x { border: 0; background: none; color: var(--mute); font-size: 20px; padding: 4px 8px; }
.side { position: sticky; top: 64px; }
.cust { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px dashed #b8c2d0; border-radius: var(--r); background: #fff; cursor: pointer; margin-bottom: 10px; }
.cust.on { border-style: solid; border-color: var(--pri2); background: #f3f7fc; }
.total { font-size: 34px; font-weight: 800; text-align: right; margin: 6px 0 12px; }
.sum div { display: flex; justify-content: space-between; padding: 3px 0; }
.res { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.12); max-height: 360px; overflow: auto; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-start; justify-content: center; padding: 30px 12px; overflow: auto; }
.modal .box { background: #fff; border-radius: 14px; width: 100%; max-width: 520px; padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal .box.wide { max-width: 820px; }
.modal .hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal .hd h2 { margin: 0; }
.modal .ft { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.paygrid { display: grid; grid-template-columns: 110px 1fr; gap: 8px 10px; align-items: center; }
.paygrid .lbl { font-weight: 600; }
.paynote { background: #f3f7fc; border: 1px solid #c9d8ea; border-radius: 8px; padding: 10px; font-size: 14px; }
.big-tot { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; background: var(--soft); border-radius: 8px; margin: 10px 0; }
.big-tot b { font-size: 22px; }
.meth { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.meth button { padding: 12px 4px; border: 1px solid var(--line); background: #fff; border-radius: 8px; font-weight: 600; }
.meth button.on { background: var(--pri); color: #fff; border-color: var(--pri); }
video.cam { width: 100%; border-radius: 10px; background: #000; max-height: 50vh; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: #18202b; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.25); max-width: 90vw; }
.toast.bad { background: var(--bad); }

.login { max-width: 360px; margin: 12vh auto 0; }
.login .logo { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 18px; font-weight: 800; font-size: 20px; color: var(--pri); }
.login .logo img { width: 42px; }

#print { display: none; }
@media print {
  @page { size: 80mm auto; margin: 3mm; }
  body > *:not(#print) { display: none !important; }
  #print { display: block; width: 74mm; font: 12px/1.35 ui-monospace, Menlo, monospace; color: #000; }
  #print h1 { font-size: 15px; text-align: center; margin: 0 0 4px; }
  #print .c { text-align: center; } #print hr { border: 0; border-top: 1px dashed #000; margin: 5px 0; }
  #print .l { display: flex; justify-content: space-between; gap: 6px; } #print .b { font-weight: 700; font-size: 14px; }
}

@media (max-width: 860px) {
  .pos { grid-template-columns: 1fr; }
  .side { position: static; }
  .line { grid-template-columns: 1fr auto; gap: 6px 10px; }
  .line > div:first-child { grid-column: 1 / -1; }
  .line .pr { display: none; }
  .top .brand { display: block; flex: 1; }
  /* Telefonda menü alttaki sekme çubuğuna iner. */
  .nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; background: var(--pri); justify-content: space-around; padding: 6px 4px max(6px, env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(0,0,0,.15); }
  .nav a { padding: 10px 8px; font-size: 14px; }
  main { padding-bottom: 80px; }
  .toast { bottom: 84px; }
  .grid2 { grid-template-columns: 1fr; }
  table.t .hm { display: none; }
}
.camwrap { position: relative; }
.camline { position: absolute; left: 8%; right: 8%; top: 50%; height: 2px; background: #ef4444; box-shadow: 0 0 8px #ef4444; pointer-events: none; }
