* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif; background: #14161a; color: #eee; }
[hidden] { display: none !important; }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.card { background: #1f2329; padding: 28px; border-radius: 14px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.card h1 { margin: 0; }
.sub { color: #9aa3ad; font-size: 14px; margin: 0 0 0 8px; }
.card .sub { margin: 0; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: #bbb; }
label.inline { flex-direction: row; align-items: center; gap: 8px; flex: 1; }
input, select { padding: 10px; border-radius: 8px; border: 1px solid #3a414a; background: #14161a; color: #fff; font-size: 15px; }
label.inline input { flex: 1; min-width: 200px; }
button { padding: 12px 16px; border: 0; border-radius: 8px; background: #1c7ed6; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; }
button:disabled { opacity: .5; cursor: wait; }
button.ghost { background: #2a3038; font-size: 13px; padding: 8px 12px; font-weight: 500; }
.error { color: #ff6b6b; font-size: 14px; margin: 8px 16px; }
.hint { color: #9aa3ad; font-size: 13px; margin: 8px 0; }
code { background: #2a3038; padding: 1px 6px; border-radius: 4px; }

header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: #1f2329; flex-wrap: wrap; gap: 8px; }
.header-right { display: flex; gap: 8px; align-items: center; }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: #2a3038; color: #f0b429; }
.pill.ok { color: #51cf66; }
.pill.bad { color: #ff6b6b; }

nav#tabs { display: flex; gap: 6px; padding: 10px 12px; background: #181b20; overflow-x: auto; position: sticky; top: 0; z-index: 3; }
nav#tabs button { background: #2a3038; white-space: nowrap; font-weight: 500; }
nav#tabs button.active { background: #1c7ed6; }

.panel { padding: 12px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
h3 { margin: 18px 0 8px; }

.columns { display: grid; gap: 12px; align-items: start; }
.columns.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .columns.four { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .columns.four { grid-template-columns: 1fr; } }
.col { background: #1a1d22; border-radius: 12px; padding: 10px; min-height: 160px; }
.col h2 { margin: 4px 6px 10px; font-size: 17px; display: flex; justify-content: space-between; }
.count { background: #2a3038; border-radius: 99px; padding: 0 10px; font-size: 14px; line-height: 24px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: #252a31; border-left: 6px solid #666; border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.col[data-status="new"] .item { border-color: #ff6b6b; }
.col[data-status="accepted"] .item { border-color: #f0b429; }
.col[data-status="preparing"] .item { border-color: #4dabf7; }
.col[data-status="ready"] .item { border-color: #51cf66; }
.item .top { display: flex; justify-content: space-between; font-size: 13px; color: #9aa3ad; }
.item .name { font-size: 18px; font-weight: 700; }
.item .qty { color: #ffd43b; }
.item .note { background: #3a2f12; color: #ffd43b; padding: 6px 8px; border-radius: 6px; font-size: 14px; }
.age.late { color: #ff6b6b; font-weight: 700; }
.empty { color: #6b747e; text-align: center; padding: 20px 0; font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tcard { background: #1f2329; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tcard h4 { margin: 0; font-size: 20px; }
.tcard .qr { background: #fff; padding: 8px; border-radius: 8px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #2a3038; }
.tag.on { color: #51cf66; } .tag.off { color: #ff6b6b; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #2a3038; white-space: nowrap; }
th { color: #9aa3ad; font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.cat { margin: 16px 0 6px; font-size: 17px; }
.menu-row { display: flex; gap: 10px; align-items: center; background: #1f2329; border-radius: 10px; padding: 8px; margin-bottom: 6px; }
.menu-row img, .menu-row .noimg { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: #2a3038; flex-shrink: 0; }
.menu-row .info { flex: 1; min-width: 0; }
.menu-row .info small { color: #9aa3ad; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 8px 0 12px; }
.stat { background: #1f2329; border-radius: 10px; padding: 12px; }
.stat b { display: block; font-size: 22px; margin-top: 4px; }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: flex-start; justify-content: center; padding: 16px; overflow-y: auto; z-index: 10; }
.modal { background: #1f2329; border-radius: 14px; padding: 18px; width: 100%; max-width: 520px; margin: 24px 0; }
.modal h3 { margin-top: 0; }
.form { display: flex; flex-direction: column; gap: 10px; }
.form textarea { padding: 10px; border-radius: 8px; border: 1px solid #3a414a; background: #14161a; color: #fff; font-size: 15px; font-family: inherit; }
label.check { flex-direction: row; align-items: center; gap: 6px; color: #eee; }
label.check input { width: 18px; height: 18px; }
.imgbox { display: flex; flex-direction: column; gap: 8px; background: #181b20; padding: 10px; border-radius: 10px; }
.imgbox img, .imgbox .noimg { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; background: #2a3038; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.modal .error { margin: 10px 0 0; }

.tblbadge { font-size: 16px; font-weight: 700; color: #74c0fc; }
button.danger { background: #3a2226; color: #ff8787; }
.rowbtns { display: flex; gap: 6px; }

@media print {
  body { background: #fff; color: #000; }
  header, nav#tabs, .toolbar, .hint, #app-error, .panel:not(#panel-tables) { display: none !important; }
  #panel-tables { display: block !important; }
  .tcard { background: #fff; border: 1px solid #000; break-inside: avoid; color: #000; }
  .tag { display: none; }
}
