/* ==========================================================================
   PA TODOS CAFE — BACK OFFICE (demo)
   Same two brand colours as the storefront, flipped: cream stock, green ink,
   because an operator stares at this for eight hours and the shop's green
   ground is for visitors, not staff.

   Every colour here is a token. Re-theming for another cafe is six lines.
   ========================================================================== */

@font-face {
  font-family: "UT Bangro";
  src: url("../assets/fonts/UTBangro.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Montserrat";
  src: url("../assets/fonts/Montserrat.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
}

:root {
  --cream: #e8e0d5;
  --green: #4d6347;
  --brown: #6f4e37;

  --bg:        #f3eee6;                                     /* page */
  --bg-panel:  #ffffff;                                     /* cards, inputs */
  --fg:        var(--green);
  --fg-muted:  color-mix(in srgb, var(--green) 62%, #f3eee6);
  --accent:    var(--green);
  --accent-bright: var(--brown);
  --rule:      color-mix(in srgb, var(--green) 18%, #f3eee6);
  --shadow:    0 1px 2px color-mix(in srgb, var(--green) 12%, transparent);

  --display: "UT Bangro", ui-sans-serif, system-ui, sans-serif;
  --body: "Montserrat", ui-sans-serif, system-ui, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --sidebar: 232px;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--body); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 400; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

/* ---------- demo banner ------------------------------------------------- */
.demobar {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  padding: .6rem 1.1rem; background: var(--brown); color: var(--cream);
  font-size: .82rem;
}
.demobar b { font-weight: 700; }
.demobar a { color: var(--cream); }

/* ---------- shell ------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }

.side {
  background: var(--green); color: var(--cream);
  padding: 1.35rem 1rem 2rem; display: flex; flex-direction: column; gap: 1.6rem;
}
.side__brand { display: flex; align-items: center; gap: .6rem; padding-inline: .35rem; }
.side__brand img { width: 132px; height: auto; }   /* height:auto or the 121px HTML attribute squashes it */
.side__gh {
  font-size: .66rem; letter-spacing: .16em; text-transform: uppercase;
  color: color-mix(in srgb, var(--cream) 62%, var(--green));
  padding-inline: .7rem; margin-bottom: .45rem;
}
.side__link {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  width: 100%; text-align: left; cursor: pointer;
  background: none; border: 0; border-radius: 8px;
  padding: .62rem .7rem; color: color-mix(in srgb, var(--cream) 85%, var(--green));
  font-size: .93rem; transition: background-color .15s var(--ease), color .15s var(--ease);
}
.side__link:hover { background: color-mix(in srgb, var(--cream) 12%, var(--green)); color: var(--cream); }
.side__link[aria-current="true"] { background: var(--cream); color: var(--green); font-weight: 600; }
.side__tally {
  min-width: 22px; padding: 0 .4rem; border-radius: 999px; text-align: center;
  background: var(--brown); color: var(--cream); font-size: .72rem; font-weight: 700;
}
.side__link[aria-current="true"] .side__tally { background: var(--green); color: var(--cream); }
.side__foot { margin-top: auto; font-size: .74rem; color: color-mix(in srgb, var(--cream) 55%, var(--green)); padding-inline: .7rem; }

/* ---------- main -------------------------------------------------------- */
.main { padding: 1.6rem clamp(1rem, 3vw, 2.25rem) 4rem; min-width: 0; }
.phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.phead h1 { font-family: var(--display); font-size: clamp(1.6rem, 3vw, 2.1rem); line-height: 1.05; }
.phead p { color: var(--fg-muted); font-size: .88rem; margin-top: .3rem; }

.panel { display: none; }
.panel[data-on="true"] { display: block; }

/* ---------- cards / tiles ---------------------------------------------- */
.tiles { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1.75rem; }
.tile {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--bg-panel); border: 1px solid var(--rule); border-radius: 12px;
  padding: 1rem 1.1rem; box-shadow: var(--shadow);
  transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.tile:hover { border-color: var(--accent-bright); transform: translateY(-1px); }
.tile__k { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--fg-muted); }
.tile__v { font-family: var(--display); font-size: 1.9rem; line-height: 1.1; margin-top: .3rem; }
.tile__n { font-size: .78rem; color: var(--fg-muted); margin-top: .2rem; }

.card {
  background: var(--bg-panel); border: 1px solid var(--rule); border-radius: 12px;
  padding: 1.15rem 1.2rem; box-shadow: var(--shadow);
}
.card + .card { margin-top: 1rem; }
.card__h { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .9rem; }
.card__h h2 { font-family: var(--display); font-size: 1.15rem; }

/* ---------- buttons ----------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1.05rem; border-radius: 999px; border: 1.5px solid transparent;
  font-size: .86rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.btn--fill { background: var(--accent); color: var(--cream); border-color: var(--accent); }
.btn--fill:hover { background: color-mix(in srgb, var(--accent) 82%, #000); }
.btn--line { background: transparent; color: var(--accent); border-color: color-mix(in srgb, var(--green) 35%, var(--bg)); }
.btn--line:hover { border-color: var(--accent); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--fg-muted); padding-inline: .5rem; }
.btn--ghost:hover { color: var(--accent-bright); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--sm { padding: .35rem .7rem; font-size: .78rem; }

/* ---------- order pad (the counter POS) --------------------------------- */
.pos { display: grid; gap: 1.1rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1000px) { .pos { grid-template-columns: 1fr 340px; } }

.pos__cats { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chip {
  padding: .38rem .85rem; border-radius: 999px; cursor: pointer;
  border: 1.5px solid color-mix(in srgb, var(--green) 22%, var(--bg));
  background: transparent; font-size: .8rem; font-weight: 600; color: var(--fg-muted);
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--cream); }

.grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.item {
  display: flex; flex-direction: column; gap: .2rem; text-align: left; cursor: pointer;
  background: var(--bg-panel); border: 1px solid var(--rule); border-radius: 10px;
  padding: .7rem .8rem; box-shadow: var(--shadow);
  transition: border-color .15s var(--ease), transform .12s var(--ease);
}
.item:hover { border-color: var(--accent-bright); }
.item:active { transform: scale(.985); }
.item__n { font-weight: 600; font-size: .88rem; line-height: 1.25; }
.item__p { color: var(--fg-muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.item--off { opacity: .45; }
.item--off .item__n::after { content: " · 86'd"; color: var(--accent-bright); font-weight: 700; font-size: .74rem; }

/* ---------- ticket ------------------------------------------------------ */
.ticket { position: sticky; top: 1rem; }
.ticket__lines { display: grid; gap: .5rem; margin-bottom: .9rem; max-height: 46vh; overflow-y: auto; }
.tline { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: center; }
.tline__n { font-size: .87rem; font-weight: 600; }
.tline__m { font-size: .76rem; color: var(--fg-muted); }
.tline__r { display: flex; align-items: center; gap: .45rem; }
.qty { display: inline-flex; align-items: center; gap: .3rem; }
.qty button {
  width: 24px; height: 24px; border-radius: 999px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--green) 25%, var(--bg));
  background: transparent; line-height: 1; font-size: .95rem;
}
.qty button:hover { border-color: var(--accent); }
.qty span { min-width: 16px; text-align: center; font-variant-numeric: tabular-nums; font-size: .85rem; }
.tline__t { min-width: 52px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .87rem; }

.totals { border-top: 1px solid var(--rule); padding-top: .8rem; display: grid; gap: .35rem; }
.totals div { display: flex; justify-content: space-between; font-size: .85rem; color: var(--fg-muted); }
.totals .grand { font-size: 1.05rem; font-weight: 700; color: var(--fg); }
.empty { color: var(--fg-muted); font-size: .87rem; padding: 1.5rem 0; text-align: center; }

/* ---------- table ------------------------------------------------------- */
.tbl { width: 100%; border-collapse: collapse; font-size: .87rem; }
.tbl th {
  text-align: left; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg-muted); font-weight: 700; padding: 0 .6rem .55rem; white-space: nowrap;
}
.tbl td { padding: .55rem .6rem; border-top: 1px solid var(--rule); vertical-align: middle; }
.tbl tr:hover td { background: color-mix(in srgb, var(--green) 4%, var(--bg-panel)); }
.tbl input[type="text"], .tbl input[type="number"], .tbl select {
  width: 100%; padding: .38rem .55rem; border-radius: 7px;
  border: 1px solid color-mix(in srgb, var(--green) 20%, var(--bg));
  background: var(--bg); font-size: .85rem;
}
.tbl input:focus, .tbl select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.tbl input[type="number"] { font-variant-numeric: tabular-nums; }
.w-price { width: 96px; }
.w-cat { width: 160px; }
.w-act { width: 96px; text-align: right; }

.pill {
  display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem;
  border-radius: 999px; font-size: .72rem; font-weight: 700;
}
.pill--on { background: color-mix(in srgb, var(--green) 14%, var(--bg-panel)); color: var(--green); }
.pill--off { background: color-mix(in srgb, var(--brown) 16%, var(--bg-panel)); color: var(--brown); }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%) translateY(1rem);
  background: var(--green); color: var(--cream); padding: .7rem 1.15rem; border-radius: 999px;
  font-size: .85rem; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
  z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.toast[data-on="true"] { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- phone / tablet ---------------------------------------------- */
.side__toggle { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side {
    flex-direction: row; align-items: center; gap: .5rem; padding: .6rem .8rem;
    overflow-x: auto; position: sticky; top: 0; z-index: 20;
  }
  /* flex items must not shrink here, or the wordmark collapses to 0 wide
     while keeping its intrinsic height and inflates the whole bar */
  .side__brand { flex: none; }
  .side__brand img { width: 96px; height: auto; }
  .side__group { display: flex; align-items: center; gap: .35rem; flex: none; }
  .side__link { flex: none; }
  .side__gh { display: none; }
  .side__link { width: auto; padding: .45rem .75rem; font-size: .85rem; white-space: nowrap; border-radius: 999px; }
  .side__foot { display: none; }
  .main { padding: 1.1rem .9rem 3rem; }
  .ticket { position: static; }
  .tbl thead { display: none; }
  .tbl tr { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; padding: .6rem 0; border-top: 1px solid var(--rule); }
  .tbl td { border: 0; padding: .15rem .2rem; }
  .tbl td[data-l]::before { content: attr(data-l); display: block; font-size: .64rem; letter-spacing: .1em;
    text-transform: uppercase; color: var(--fg-muted); margin-bottom: .15rem; }
  .tbl td.w-act { grid-column: 1 / -1; text-align: left; }
}
