/* Zaika Junction kitchen display — landscape tablet.
   Same look as the customer app (mobile/src/lib/theme.js): the device's own font, cream background,
   white cards with a 14px radius, wine for brand accents, green for "move it forward". */
:root {
  --bg: #FFFAF5;            /* cream page, as in the customer app */
  --board: #F6EFE8;         /* column background (customer app "chip") */
  --card: #FFFFFF;
  --ink: #2B1A10;           /* 16:1 on white */
  --ink-2: #5C4A3D;         /* 8.6:1 on white */
  --muted: #75665B;         /* 5.5:1 on white */
  --line: #EFE4DA;
  --line-2: #DCCBBD;
  --wine: #A3182F;
  --wine-dark: #7E1024;
  --wine-tint: #F7ECEC;
  --wine-line: #E5C5CB;
  --go: #0B8641;
  --go-dark: #06703A;
  --go-tint: #E7F5EA;
  --go-line: #A8DDBE;
  --amber: #8A4700;         /* 6.3:1 on its tint */
  --amber-tint: #FFF4E0;
  --amber-line: #F59F00;
  --late: #C92A2A;
  --late-tint: #FDECEC;
  --info: #2B5CB8;
  --info-tint: #EEF4FF;
  --veg: #2B8A3E;
  --nonveg: #B0361B;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 12px rgb(80 40 10 / .08);
  --shadow-lg: 0 16px 40px -8px rgb(80 40 10 / .28);
  --font: system-ui, -apple-system, Roboto, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.4; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow: hidden; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lucide { width: 18px; height: 18px; flex: none; }
:focus-visible { outline: 3px solid var(--wine); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  background: var(--wine); color: #fff; font-size: 16px; font-weight: 700;
  cursor: pointer; text-decoration: none; user-select: none;
  transition: background-color .15s, border-color .15s, transform .08s;
}
.btn:hover { background: var(--wine-dark); }
.btn:active { transform: scale(.98); }
.btn .lucide { width: 20px; height: 20px; }
.btn.go { background: var(--go); box-shadow: 0 4px 10px rgb(11 134 65 / .25); }
.btn.go:hover { background: var(--go-dark); }
.btn.outline { background: var(--card); color: var(--ink); border-color: var(--line-2); }
.btn.outline:hover { background: var(--board); }
.btn.icon { width: 44px; min-height: 44px; padding: 0; }
.btn.full { width: 100%; }
.btn:disabled { cursor: progress; background: var(--muted); color: #fff; transform: none; box-shadow: none; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  border: 3px solid rgb(255 255 255 / .35); border-top-color: #fff; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- app shell ---------- */
.kds { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 8px 16px; min-height: 60px;
  background: var(--card); border-bottom: 1px solid var(--line); flex: none;
}
.topbar .logo { height: 32px; width: auto; display: block; }
.topbar .title { font-weight: 600; font-size: 16px; color: var(--ink-2); padding-left: 14px; border-left: 1px solid var(--line-2); white-space: nowrap; }
.counts { display: flex; gap: 8px; margin-left: 6px; }
.count {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px;
  font-weight: 600; font-size: 13px; background: var(--board); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap;
}
.count b { font-size: 15px; font-weight: 800; }
.count.new { background: var(--wine-tint); border-color: var(--wine-line); color: var(--wine-dark); }
.count.cook { background: var(--amber-tint); border-color: #F5D39A; color: var(--amber); }
.count.ready { background: var(--go-tint); border-color: var(--go-line); color: var(--go-dark); }
.grow { flex: 1; min-width: 0; }
.clock { text-align: right; line-height: 1.15; white-space: nowrap; }
.clock b { display: block; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.clock small { font-size: 12px; font-weight: 500; color: var(--muted); }
.conn { display: inline-flex; align-items: center; gap: 5px; }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--go); }
.conn.poll .dot { background: var(--amber-line); }
.conn.off .dot { background: var(--late); }
.tools { display: flex; gap: 8px; }
.tools .btn[aria-pressed="false"] { color: var(--muted); }

/* all-day strip: how much of each dish is waiting or on the stove */
.allday {
  display: flex; align-items: center; gap: 8px; padding: 8px 16px; min-height: 48px; flex: none;
  background: var(--card); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none;
}
.allday::-webkit-scrollbar { display: none; }
.allday .lbl { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); flex: none; padding-right: 4px; }
.allday .chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px;
  background: var(--board); border: 1px solid var(--line); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.allday .chip b { font-weight: 800; color: var(--wine); }
.allday .empty { color: var(--muted); font-size: 14px; }

/* ---------- board ---------- */
.board { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 12px; }
.col {
  display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--board);
  border-radius: var(--radius); border: 1px solid var(--line); transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; }
.col-head h2 { font-size: 16px; font-weight: 700; }
.col-head .lucide { width: 20px; height: 20px; color: var(--wine); }
.col-head .n {
  margin-left: auto; min-width: 28px; height: 24px; padding: 0 8px; border-radius: 999px; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; background: var(--wine); color: #fff;
}
.col.cook .col-head .lucide { color: var(--amber); }
.col.cook .col-head .n { background: var(--amber); }
.col.ready .col-head .lucide { color: var(--go-dark); }
.col.ready .col-head .n { background: var(--go-dark); }
.col-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 10px; }
.col-empty { margin: auto; text-align: center; color: var(--muted); font-size: 14px; font-weight: 500; padding: 24px 8px; display: grid; justify-items: center; gap: 8px; }
.col-empty .lucide { width: 28px; height: 28px; color: var(--line-2); }

/* drag and drop: where a ticket can go */
.col.drop-ok { border-color: var(--go); border-style: dashed; background: var(--go-tint); }
.col.drop-ok.over { box-shadow: 0 0 0 3px rgb(11 134 65 / .35); }
.col.drop-no { opacity: .55; }
.col.drop-ok .col-empty, .col.drop-ok .col-body::after { pointer-events: none; }
.col.drop-ok.over .col-body::after {
  content: attr(data-drop); display: block; text-align: center; padding: 12px; border-radius: var(--radius-sm);
  border: 2px dashed var(--go); color: var(--go-dark); font-weight: 700; font-size: 14px; background: #fff;
}

/* ---------- ticket ---------- */
.ticket {
  background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column; flex: none; overflow: hidden; cursor: grab; touch-action: pan-y;
  -webkit-user-select: none; user-select: none;
}
.ticket.fresh { border-color: var(--wine); box-shadow: 0 0 0 2px rgb(163 24 47 / .35), var(--shadow); animation: fresh 1.2s ease-in-out 3; }
@keyframes fresh { 50% { box-shadow: 0 0 0 6px rgb(163 24 47 / .16), var(--shadow); } }
.ticket.warn { border-color: var(--amber-line); }
.ticket.late { border-color: var(--late); box-shadow: 0 0 0 2px rgb(201 42 42 / .3), var(--shadow); }
.col.ready .ticket { background: #FFFDFB; box-shadow: none; }
.col.ready .ticket .items { opacity: .7; }
.ticket.lifting { animation: lift .25s ease-out; }
@keyframes lift { 50% { transform: scale(.98); } }
.ticket.placeholder { opacity: .35; border-style: dashed; box-shadow: none; }
.drag-ghost {
  position: fixed; z-index: 50; pointer-events: none; margin: 0; cursor: grabbing;
  box-shadow: var(--shadow-lg); transform: rotate(1.5deg) scale(1.02); opacity: .96;
}

.t-head { display: flex; align-items: flex-start; gap: 8px; padding: 12px 14px 6px; }
.t-id { font-size: 18px; font-weight: 800; line-height: 1.2; }
.t-who { font-size: 13px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer {
  margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: 999px;
  font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--board); color: var(--ink); border: 1px solid var(--line);
}
.timer .lucide { width: 16px; height: 16px; }
.timer.warn { background: var(--amber-tint); color: var(--amber); border-color: var(--amber-line); }
.timer.late { background: var(--late); color: #fff; border-color: var(--late); }
.timer.wait { font-size: 13px; font-weight: 600; color: var(--ink-2); }

.t-tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 14px 10px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--board); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; max-width: 100%;
}
.tag .lucide { width: 14px; height: 14px; }
.tag span { overflow: hidden; text-overflow: ellipsis; }
.tag.src-app { background: var(--wine-tint); color: var(--wine-dark); border-color: var(--wine-line); }
.tag.src-zomato { background: #FDECEE; color: #A1121F; border-color: #F5B8BF; }
.tag.src-swiggy { background: #FFF1E6; color: #8A4300; border-color: #FBC898; }
.tag.type-delivery { background: var(--info-tint); color: #1F4A99; border-color: #C9D8F5; }
.tag.sched { background: var(--ink); color: #fff; border-color: var(--ink); }
.tag.room { background: #F3E8FF; color: #5B21B6; border-color: #DCC4FB; }

.items { list-style: none; margin: 0; padding: 2px 14px 8px; border-top: 1px dashed var(--line-2); }
.item { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.qty { font-size: 16px; font-weight: 800; line-height: 1.35; min-width: 30px; white-space: nowrap; color: var(--wine); }
.i-main { min-width: 0; }
.i-name { display: flex; align-items: flex-start; gap: 8px; font-size: 16px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.vd { flex: none; width: 14px; height: 14px; margin-top: 3px; border: 1.5px solid var(--veg); border-radius: 3px; display: grid; place-items: center; }
.vd::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--veg); }
.vd.nv { border-color: var(--nonveg); }
.vd.nv::after { background: var(--nonveg); }
.opts { list-style: none; margin: 3px 0 0; padding: 0 0 0 22px; font-size: 14px; color: var(--ink-2); }
.opts li { overflow-wrap: anywhere; }
.opts li::before { content: '–  '; color: var(--muted); }
.opts .g { color: var(--muted); }
.i-note {
  margin: 6px 0 0 22px; padding: 5px 9px; border-radius: 8px; background: var(--amber-tint); color: var(--amber);
  font-size: 14px; font-weight: 600; display: flex; gap: 6px; align-items: flex-start; overflow-wrap: anywhere;
}
.i-note .lucide, .instr .lucide { width: 16px; height: 16px; margin-top: 2px; }
.instr {
  margin: 0 14px 12px; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid #F5D39A; background: var(--amber-tint);
  color: var(--amber); font-size: 14px; font-weight: 600; display: flex; gap: 8px; align-items: flex-start; overflow-wrap: anywhere;
}
.instr small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.t-foot { padding: 0 14px 14px; margin-top: auto; }
.t-foot .btn { min-height: 48px; }

/* ---------- full-page cards: start overlay, sign-in, errors ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px;
  background: rgb(43 26 16 / .55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.start {
  display: grid; justify-items: center; gap: 12px; text-align: center; padding: 32px 36px; border-radius: 18px; border: 0;
  background: var(--card); box-shadow: var(--shadow-lg); cursor: pointer; max-width: 440px; width: 100%;
}
.start .big { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--go); color: #fff; }
.start .big .lucide { width: 30px; height: 30px; }
.start b { font-size: 20px; font-weight: 700; line-height: 1.3; }
.start span { font-size: 14px; color: var(--ink-2); }
.start:hover .big { background: var(--go-dark); }

.page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); overflow: auto; }
.card {
  width: 100%; max-width: 420px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  padding: 28px; display: grid; gap: 14px; justify-items: center; text-align: center;
}
.card .logo { height: 44px; width: auto; }
.card h1 { font-size: 20px; font-weight: 700; line-height: 1.3; }
.card p { font-size: 15px; color: var(--ink-2); }
.card .btn { width: 100%; }
.card .ic-wrap { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--wine-tint); color: var(--wine); }
.card .ic-wrap .lucide { width: 24px; height: 24px; }

/* ---------- toast ---------- */
.toaster { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(480px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff;
  font-size: 15px; font-weight: 600; box-shadow: var(--shadow-lg); pointer-events: auto; animation: tin .2s ease-out;
}
.toast .lucide { width: 20px; height: 20px; }
.toast.error { background: var(--late); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* ---------- smaller landscape tablets (1024 wide and below) ---------- */
@media (max-width: 1180px) {
  .topbar { gap: 10px; padding: 8px 12px; }
  .topbar .title { display: none; }
  .board { gap: 10px; padding: 10px; }
}
@media (max-width: 900px) {
  .count span { display: none; }
}
/* portrait / phones: one column of columns, page scrolls */
@media (max-width: 720px) {
  body { overflow: auto; }
  .kds { height: auto; min-height: 100vh; }
  .topbar { flex-wrap: wrap; }
  .counts { order: 3; width: 100%; margin: 0; }
  .board { grid-template-columns: 1fr; }
  .col-body { overflow: visible; }
}
@media (prefers-reduced-motion: reduce) {
  .ticket.fresh, .ticket.lifting, .toast { animation: none; }
  .drag-ghost { transform: none; }
  .spinner { animation-duration: 2s; }
}
