/* ==========================================================================
   Deka's Kitchen — Phase 1 styles
   Mobile-first. One-hand usable at 360px. No framework.
   ========================================================================== */

:root {
  --ink:       #1e1b18;
  --ink-soft:  #57504a;
  --ink-faint: #8b8177;
  --line:      #e8dfd4;
  --cream:     #faf6f1;
  --card:      #ffffff;
  --saffron:   #d4622a;
  --saffron-d: #ad4a1b;
  --veg:       #2e7d4f;
  --nonveg:    #b03a2e;
  --ok:        #2e7d4f;
  --warn:      #b7791f;
  --radius:    14px;
  --shadow:    0 1px 2px rgba(30, 27, 24, .06), 0 8px 24px rgba(30, 27, 24, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p  { margin: 0; }

a { color: inherit; text-decoration: none; }

/* ---------------------------------------------------------------- topbar */

.topbar { position: sticky; top: 0; z-index: 20; }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.bar--admin { background: #14110f; }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand__mark {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--saffron);
  color: #fff;
  font-weight: 800;
  font-size: .8rem;
  letter-spacing: .04em;
  flex: 0 0 auto;
}

.brand__text { display: flex; flex-direction: column; min-width: 0; font-weight: 650; }
.brand__text small { font-weight: 400; font-size: .7rem; opacity: .65; }

.customernav, .adminnav { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

.adminnav a, .adminnav button {
  font-size: .82rem;
  padding: 8px 10px;
  border-radius: 9px;
  opacity: .72;
  white-space: nowrap;
}
.adminnav a.is-active { opacity: 1; background: rgba(255, 255, 255, .1); }

.linkbtn {
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  font-size: .82rem;
  cursor: pointer;
  opacity: .8;
  padding: 8px 6px;
}
.linkbtn:hover { opacity: 1; }

.cartbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--saffron);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
}

.pill {
  background: #fff;
  color: var(--saffron-d);
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  font-size: .72rem;
  font-weight: 800;
  padding: 0 5px;
}

/* ------------------------------------------------------------------ shell */

.app {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 14px 96px;
}

.pagehead { margin: 4px 0 12px; }

/* ------------------------------------------------------------------- hero */

.hero {
  padding: 22px 18px;
  margin-bottom: 18px;
  border-radius: var(--radius);
  background: linear-gradient(150deg, #fff5ec, #fde8d8 60%, #f9dcc5);
  border: 1px solid #f2d9c3;
}
.hero h1 { font-size: 1.45rem; margin-bottom: 6px; }
.hero p { color: var(--ink-soft); font-size: .92rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  font-size: .74rem;
  background: rgba(255, 255, 255, .8);
  border: 1px solid #f0d6bf;
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ menu */

.group { margin-bottom: 22px; }
.group h2 {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-faint);
  padding: 0 2px 10px;
}

.dish {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  margin-bottom: 9px;
}
.dish.is-in-cart { border-color: var(--saffron); box-shadow: 0 0 0 1px var(--saffron) inset; }

.dish__main { min-width: 0; }
.dish__title { display: flex; align-items: center; gap: 7px; }
.dish__title h3 { font-size: .98rem; font-weight: 620; }
.dish__desc {
  color: var(--ink-faint);
  font-size: .79rem;
  margin-top: 2px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.dish__price { font-size: .88rem; font-weight: 650; margin-top: 6px; color: var(--ink); }

.dot { width: 11px; height: 11px; border: 2px solid; border-radius: 2px; flex: 0 0 auto; }
.dot--veg { border-color: var(--veg); }
.dot--veg::after { content: ""; display: block; width: 5px; height: 5px; margin: 1px; border-radius: 50%; background: var(--veg); }
.dot--nonveg { border-color: var(--nonveg); }
.dot--nonveg::after { content: ""; display: block; width: 0; height: 0; margin: 2px 1px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 6px solid var(--nonveg); }

.addbtn {
  flex: 0 0 auto;
  border: 1px solid var(--saffron);
  color: var(--saffron-d);
  background: #fff;
  border-radius: 10px;
  padding: 8px 18px;
  font: inherit;
  font-size: .86rem;
  font-weight: 650;
  cursor: pointer;
  min-height: 40px;
}
.addbtn:active { background: #fdf1e8; }

.stepper {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--saffron);
  border-radius: 10px;
  overflow: hidden;
}
.stepper button {
  width: 38px;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
}
.stepper span { color: #fff; font-weight: 700; font-size: .92rem; min-width: 20px; text-align: center; }

/* --------------------------------------------------------------- cart bar */

.cartbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--ink);
  color: #fff;
  font-size: .9rem;
}
.cartbar .primary { flex: 0 0 auto; }

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { margin-bottom: 12px; font-size: .95rem; }

.totalrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .95rem;
}
.card.totalrow { padding: 14px 16px; }
.totalrow strong { font-size: 1.1rem; }

.cartline {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.cartline:last-child { border-bottom: 0; }
.cartline__info { flex: 1; min-width: 0; }
.cartline__info h3 { font-size: .93rem; font-weight: 600; }
.cartline__info p { font-size: .78rem; color: var(--ink-faint); }
.cartline__total { font-weight: 650; font-size: .9rem; min-width: 54px; text-align: right; }

/* ------------------------------------------------------------------ forms */

label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

input:not([type]), input[type="text"], input[type="tel"], input[type="password"],
input[type="number"], textarea, select {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 11px 12px;
  font: inherit;
  font-size: .92rem;
  font-weight: 400;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 44px;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--saffron);
  box-shadow: 0 0 0 3px rgba(212, 98, 42, .13);
}
textarea { resize: vertical; }

.muted { color: var(--ink-faint); font-weight: 400; }

.paybadge {
  background: #f2f8f3;
  border: 1px solid #d5e8d9;
  color: #235f3c;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: .84rem;
  margin-bottom: 14px;
}

.primary, .ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  padding: 13px 20px;
  font: inherit;
  font-size: .92rem;
  font-weight: 650;
  cursor: pointer;
  min-height: 46px;
}
.primary { background: var(--saffron); color: #fff; }
.primary:active { background: var(--saffron-d); }
.primary[disabled] { opacity: .55; cursor: default; }
.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.wide { width: 100%; }

.err { color: var(--nonveg); font-size: .82rem; margin-bottom: 10px; }
.note { color: var(--ink-faint); font-size: .78rem; margin-top: 10px; }
.empty { color: var(--ink-faint); font-size: .9rem; padding: 12px 2px; }

.empty-state {
  text-align: center;
  padding: 44px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.empty-state h2 { font-size: 1.15rem; margin-bottom: 6px; }
.empty-state p { color: var(--ink-soft); font-size: .88rem; margin-bottom: 20px; }

.inlineform { display: flex; gap: 8px; max-width: 340px; margin: 0 auto 12px; }
.inlineform input { margin-top: 0; text-align: center; letter-spacing: .08em; }
.inlineform .primary { flex: 0 0 auto; }

/* --------------------------------------------------------------- tracking */

.orderhead {
  text-align: center;
  padding: 18px 0 20px;
}
.orderhead h1 { font-size: 1.4rem; margin: 10px 0 4px; }
.orderhead p { color: var(--ink-faint); font-size: .82rem; }

.ticket {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .09em;
  background: var(--ink);
  color: #fff;
  border-radius: 7px;
  padding: 4px 9px;
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 9px 0;
  opacity: .4;
}
.timeline li.is-done { opacity: 1; }
.timeline .tick {
  width: 22px; height: 22px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  font-size: .7rem;
  color: #fff;
}
.timeline li.is-done .tick { background: var(--ok); border-color: var(--ok); }
.timeline strong { display: block; font-size: .9rem; }
.timeline small { color: var(--ink-faint); font-size: .74rem; }

.lines { list-style: none; margin: 0 0 12px; padding: 0; }
.lines li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: .89rem;
  border-bottom: 1px dashed var(--line);
}
.lines li:last-child { border-bottom: 0; }

.addr { font-size: .88rem; color: var(--ink-soft); line-height: 1.6; }

/* ------------------------------------------------------------------ admin */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}
.stat b { display: block; font-size: 1.05rem; }
.stat span { font-size: .66rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; }

.ticket-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  margin-bottom: 12px;
}
.ticket-card.status-new { border-left-color: var(--saffron); }
.ticket-card.status-preparing { border-left-color: var(--warn); }
.ticket-card.status-out_for_delivery { border-left-color: #2f6fb5; }
.ticket-card.status-delivered { border-left-color: var(--ok); opacity: .78; }

.ticket-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.age { font-size: .72rem; color: var(--ink-faint); margin-left: 8px; }
.age--late { color: var(--nonveg); font-weight: 700; }

.tag { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.tag--new { background: #fdeee3; color: var(--saffron-d); }
.tag--preparing { background: #fbf1dc; color: #8f5f11; }
.tag--out_for_delivery { background: #e6f0fa; color: #255f9c; }
.tag--delivered { background: #e8f4ec; color: #235f3c; }

.ticket-items { list-style: none; margin: 0 0 10px; padding: 0; }
.ticket-items li {
  display: flex;
  justify-content: space-between;
  font-size: .9rem;
  padding: 3px 0;
}
.ticket-items b { font-variant-numeric: tabular-nums; }

.ticket-cust {
  font-size: .82rem;
  color: var(--ink-soft);
  border-top: 1px dashed var(--line);
  padding-top: 9px;
  line-height: 1.55;
}
.notes { font-style: italic; color: var(--ink); }

.ticket-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}
.cod { font-size: .82rem; font-weight: 700; color: var(--ink-soft); }
.done { font-size: .8rem; color: var(--ok); font-weight: 650; }
.ticket-card footer .primary { padding: 9px 14px; min-height: 40px; font-size: .84rem; }

.editrow {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.editrow:last-child { border-bottom: 0; }
.editrow.is-off { opacity: .5; }

.editrow__name { display: flex; align-items: center; gap: 7px; min-width: 0; flex-wrap: wrap; }
.editrow__name strong { font-size: .88rem; font-weight: 600; }
.editrow__name small { color: var(--ink-faint); font-size: .7rem; }

.pricefield { margin: 0; display: flex; align-items: center; gap: 3px; font-size: .82rem; font-weight: 600; color: var(--ink-faint); }
.pricefield input { width: 68px; min-height: 38px; padding: 6px 8px; margin-top: 0; text-align: right; font-size: .85rem; }

.switch { margin: 0; display: flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 600; cursor: pointer; }
.switch input { width: 17px; height: 17px; accent-color: var(--saffron); }
.switch span { white-space: nowrap; }

.danger { color: var(--nonveg); }
.card.danger-zone { border-color: #f0d9d5; background: #fffbfa; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid2 .span2 { grid-column: 1 / -1; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: .84rem; }
.checkline input { width: 17px; height: 17px; margin: 0; accent-color: var(--saffron); }
.additem .primary { margin-top: 4px; }

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translate(-50%, 12px);
  z-index: 60;
  background: var(--ink);
  color: #fff;
  font-size: .84rem;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------- wide view */

@media (min-width: 720px) {
  .app { max-width: 880px; padding: 24px 24px 96px; }
  .group { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
  .group h2 { grid-column: 1 / -1; padding-bottom: 2px; }
  .dish { margin-bottom: 0; }
  .hero { padding: 30px 26px; }
  .hero h1 { font-size: 1.9rem; }
  .editrow { grid-template-columns: 1fr 100px 130px 70px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
