:root {
    --bg: #f5f3ef;
    --card: #fff;
    --ink: #1f1d1a;
    --muted: #7b756c;
    --line: #e7e2da;
    --primary: #e0a800;
    --primary-ink: #1f1d1a;
    --danger: #d64545;
    --success: #2f9e5a;
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    color: var(--ink);
    background: var(--bg);
}

a { color: inherit; }
h1, h2 { margin: 0 0 12px; }
h1 { font-size: 24px; }
h2 { font-size: 17px; }
code { background: rgba(0, 0, 0, .06); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
small { display: block; }

/* Üst bar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 10px 20px;
    background: #1f1d1a;
    color: #fff;
}
.brand { font-weight: 800; font-size: 17px; }
.brand .cafe-name {
    margin-left: 8px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--primary);
    color: var(--primary-ink);
    font-size: 13px;
}
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.topbar nav a {
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #d8d3ca;
    font-weight: 600;
}
.topbar nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.topbar nav a.active { background: rgba(255, 255, 255, .14); color: #fff; }
.topbar .user { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.topbar .btn { background: rgba(255, 255, 255, .1); color: #fff; border-color: transparent; }

.container { max-width: 1280px; margin: 0 auto; padding: 24px 20px 60px; }

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.page-head h1 { margin: 0; }
.page-head p { flex-basis: 100%; margin: 0; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 18px;
}
.grid-2 {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) 1.4fr;
    gap: 18px;
    align-items: start;
}
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* Butonlar */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    font: 600 14px inherit;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { filter: brightness(.96); }
.btn:disabled { opacity: .5; cursor: wait; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.danger { background: #fff; border-color: #f1c4c4; color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.block { width: 100%; padding: 12px; }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border: 0;
    border-radius: 999px;
    background: #ece7de;
    font: 700 12px inherit;
    font-family: inherit;
    cursor: default;
}
button.badge { cursor: pointer; }
.badge.ok { background: #dff3e6; color: var(--success); }
.badge.err { background: #fbe1e1; color: var(--danger); }

/* Formlar */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    font: inherit;
    color: inherit;
}
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); }
input[type=file] { padding: 8px; background: #faf8f4; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(224, 168, 0, .35); border-color: var(--primary); }
.head-actions select { width: auto; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row > label { flex: 1; }
.grow { flex: 1; min-width: 0; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; }
.alert.success { background: #dff3e6; color: #1e6b3d; }
.alert.error { background: #fbe1e1; color: #a12d2d; }
.alert.warning { background: #fff4d1; color: #7a5a00; }

/* Listeler ve tablolar */
.list { display: flex; flex-direction: column; }
.list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}
.list-item:last-child { border-bottom: 0; }
.list-item.child { padding-left: 34px; position: relative; }
.list-item.child::before { content: "↳"; position: absolute; left: 10px; color: var(--muted); }
.list-item.child .thumb { width: 44px; height: 44px; }
.list-item .grow small { margin-top: 2px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.disabled { opacity: .55; }

.thumb { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; background: #eee; display: block; }
.thumb.lg { width: 110px; height: 80px; }
.thumb.placeholder { background: linear-gradient(135deg, #ece7de, #d9d2c5); }
.thumb-row { display: flex; align-items: center; gap: 14px; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 13px; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table form { margin: 0; }
@media (max-width: 760px) {
    .table thead { display: none; }
    .table tr { display: grid; grid-template-columns: 60px 1fr; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
    .table td { border: 0; padding: 0; }
    .table td:first-child { grid-row: span 6; }
}

/* Ürün formu: seçenek grupları */
.presets { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.group {
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #faf8f4;
}
.group-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.group-head input[data-f=name] { flex: 1; min-width: 160px; font-weight: 700; }
.group-head select { width: auto; }
.option-row { display: flex; gap: 8px; margin-bottom: 6px; }
.option-row input[data-f=price] { width: 170px; flex-shrink: 0; }

/* Siparişler */
:root {
    --c-new: #e8590c;
    --c-prep: #1c7ed6;
    --c-done: var(--success);
    --c-cancel: var(--danger);
}
[hidden] { display: none !important; }

.nav-badge {
    display: inline-block;
    min-width: 22px;
    padding: 1px 7px;
    margin-left: 4px;
    border-radius: 999px;
    background: var(--c-new);
    color: #fff;
    font-size: 12px;
    text-align: center;
    animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .55; } }
.brand .cafe-name { font-size: 15px; padding: 4px 12px; }

.banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    margin-bottom: 14px;
    border-radius: 10px;
    font-size: 15px;
}
.banner.warn { background: #fff4d1; color: #6b4e00; border: 1px solid #f2d27a; }
.banner.error { background: var(--danger); color: #fff; font-size: 16px; }

label.check.small { font-size: 14px; font-weight: 600; gap: 6px; cursor: pointer; }

.btn.big { width: 100%; padding: 14px; font-size: 17px; border-radius: 10px; }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.link {
    padding: 4px 2px;
    border: 0;
    background: none;
    color: var(--muted);
    font: 600 13px inherit;
    font-family: inherit;
    text-decoration: underline;
    cursor: pointer;
}
.link:hover { color: var(--ink); }
.link.danger { color: var(--danger); }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.stat span { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.stat strong { font-size: 26px; }
.stat.s-new { border-top-color: var(--c-new); }
.stat.s-prep { border-top-color: var(--c-prep); }
.stat.s-done { border-top-color: var(--c-done); }
.stat.s-cancel { border-top-color: var(--c-cancel); }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.board { display: grid; grid-template-columns: 1.1fr 1.1fr .9fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .board { grid-template-columns: 1fr; } }
.lane { background: #ebe7e0; border-radius: 14px; padding: 12px; min-height: 200px; }
.lane h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 4px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #fff;
    font-size: 17px;
}
.lane h2 em { margin-left: auto; font-style: normal; background: rgba(255, 255, 255, .25); padding: 2px 10px; border-radius: 999px; }
.lane .step { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #fff; font-size: 14px; }
.lane-new h2 { background: var(--c-new); }
.lane-new .step { color: var(--c-new); }
.lane-new.has-orders { box-shadow: 0 0 0 3px var(--c-new) inset; }
.lane-prep h2 { background: var(--c-prep); }
.lane-prep .step { color: var(--c-prep); }
.lane-done h2 { background: #495057; }
.lane-done .step { color: #495057; }
.lane-hint { margin: 6px 4px 12px; font-size: 13px; color: var(--muted); }
.col { display: flex; flex-direction: column; gap: 12px; }
.col.compact { gap: 6px; }
.empty-col { padding: 24px; text-align: center; border: 2px dashed #d3cdc3; border-radius: var(--radius); margin: 0; color: var(--muted); }

.order {
    background: var(--card);
    border: 1px solid var(--line);
    border-top: 6px solid var(--c-new);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
}
.order.preparing { border-top-color: var(--c-prep); }
.order.fresh { animation: flash 1s ease 6; }
.order.busy { opacity: .5; pointer-events: none; }
@keyframes flash { 50% { background: #ffe8cc; } }
.order header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.o-table { font-size: 26px; font-weight: 800; line-height: 1.1; }
.o-no { text-align: right; font-size: 26px; font-weight: 800; line-height: 1; }
.o-no small { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.o-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: 8px 0 10px; font-size: 13px; color: var(--muted); }
.age { padding: 2px 8px; border-radius: 6px; background: #eef2f6; color: #364152; font-weight: 700; }
.age.warn { background: #fff3bf; color: #8a6100; }
.age.late { background: var(--danger); color: #fff; animation: pulse 1.2s ease-in-out infinite; }
.tag { padding: 2px 8px; border-radius: 6px; background: #f3e8ff; color: #6b21a8; font-weight: 700; }

.o-items { list-style: none; margin: 0 0 10px; padding: 0; }
.o-items li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 16px; }
.o-items li:last-child { border-bottom: 0; }
.o-items .qty {
    flex-shrink: 0;
    min-width: 38px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    font-weight: 800;
}
.o-items small { color: var(--muted); margin-top: 3px; font-size: 13px; }
.o-items small.note { color: #b35b00; font-weight: 700; }
.order-note { padding: 8px 10px; background: #fff4e5; border: 1px solid #ffd8a8; color: #8a4500; border-radius: 8px; margin-bottom: 10px; font-size: 14px; }
.order footer { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.o-total { display: flex; justify-content: space-between; align-items: baseline; }
.o-total span { color: var(--muted); font-size: 13px; }
.o-total strong { font-size: 20px; }
.o-sub { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.row-order { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--c-done); border-radius: 10px; cursor: pointer; }
.row-order.cancelled { border-left-color: var(--c-cancel); }
.row-order.cancelled .ro-head b, .row-order.cancelled .ro-head strong { text-decoration: line-through; color: var(--muted); }
.row-order.busy { opacity: .5; pointer-events: none; }
.ro-head, .h-order summary { display: flex; align-items: center; gap: 10px; padding: 9px 12px; font-size: 14px; }
.ro-head strong, .h-order summary strong { margin-left: auto; white-space: nowrap; }
.ro-table { font-weight: 700; }
.ro-body { padding: 0 12px 10px; cursor: default; }
.pill { padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.new { background: #ffe8cc; color: var(--c-new); }
.pill.preparing { background: #d0ebff; color: var(--c-prep); }
.pill.delivered { background: #dff3e6; color: var(--c-done); }
.pill.cancelled { background: #fbe1e1; color: var(--c-cancel); }

.undo {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 50;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--ink);
    color: #fff;
    font-size: 15px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.undo.error { background: var(--danger); }

.lock-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(31, 29, 26, .85); padding: 20px; }
.lock-card { max-width: 440px; background: #fff; border-radius: 16px; padding: 28px; text-align: center; }

dialog.confirm { border: 0; border-radius: 16px; padding: 24px; max-width: 440px; width: 90%; }
dialog.confirm::backdrop { background: rgba(0, 0, 0, .5); }
dialog.confirm .form-actions { justify-content: flex-end; margin-top: 16px; }

.print-frame { position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0; visibility: hidden; }

.new-order-alert {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 12px;
    background: var(--c-new);
    color: #fff;
    font-size: 15px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}

/* Sipariş geçmişi */
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.filters input, .filters select { width: auto; padding: 7px 10px; }
.grid-2.history { grid-template-columns: minmax(260px, .6fr) 1.6fr; }
@media (max-width: 900px) { .grid-2.history { grid-template-columns: 1fr; } }
.top-list { margin: 0; padding-left: 20px; }
.top-list li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.top-list li span:first-child { display: inline-block; min-width: 50%; font-weight: 600; }
.top-list li b { margin-right: 8px; }
.h-order { border: 1px solid var(--line); border-left: 5px solid var(--c-done); border-radius: 10px; margin-bottom: 6px; }
.h-order.cancelled { border-left-color: var(--c-cancel); }
.h-order.new { border-left-color: var(--c-new); }
.h-order.preparing { border-left-color: var(--c-prep); }
.h-order summary { cursor: pointer; list-style: none; }
.h-order summary::-webkit-details-marker { display: none; }
.h-order[open] summary { border-bottom: 1px solid var(--line); }
.h-order > :not(summary) { margin-left: 12px; margin-right: 12px; }
.h-order .o-sub { padding-bottom: 10px; }
.h-items { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* QR kartları */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.qr-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    text-align: center;
    break-inside: avoid;
}
.qr-cafe { font-weight: 800; font-size: 18px; margin-bottom: 8px; }
.qr img { width: 100%; max-width: 200px; image-rendering: pixelated; }
.qr-name { font-size: 22px; font-weight: 800; margin-top: 6px; }
.qr-hint { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.qr-actions { display: flex; flex-direction: column; gap: 8px; text-align: left; border-top: 1px solid var(--line); padding-top: 12px; }
.qr-actions form { margin: 0; }
.qr-actions input { padding: 6px 8px; font-size: 13px; }

@media print {
    body { background: #fff; }
    .topbar, .no-print, .alert { display: none !important; }
    .container { padding: 0; max-width: none; }
    .qr-grid { grid-template-columns: repeat(3, 1fr); gap: 10mm; }
    .qr-card { border: 1px dashed #999; page-break-inside: avoid; }
    .qr-card.disabled { display: none; }
}

/* Giriş */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: #1f1d1a; }
.auth-card { width: min(420px, 100%); background: #fff; border-radius: 16px; padding: 30px; }
.auth-card h1 { text-align: center; margin-bottom: 20px; }
