/* Palette taken from leden.tkdhouthalen.be */
:root {
  --tkd-blauw: #0b3c8a;
  --tkd-blauw-donker: #072a63;
  --tkd-blauw-licht: #e8eefb;
  --tkd-grijs: #6b7280;
  --tkd-grijs-licht: #f4f5f7;
  --tkd-rand: #e2e5ea;
  --tkd-rood: #c8102e;
  --tkd-rood-licht: #fdeaed;
  --tkd-wit: #ffffff;
  --tkd-zwart: #1f1f1f;

  --radius: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--tkd-grijs-licht);
  color: var(--tkd-zwart);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
button:focus-visible { outline: 3px solid var(--tkd-blauw); outline-offset: 2px; }

/* ---------- Header ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  background: var(--tkd-zwart);
  color: var(--tkd-wit);
  padding: calc(10px + var(--safe-t)) 16px 12px;
}
.brand { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.brand small {
  font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: #b9bec7;
}
.brand b { font-size: 18px; }
.brand .net { margin-left: auto; font-size: 12px; color: #b9bec7; display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #3fb950; display: inline-block; }
.dot.off { background: var(--tkd-rood); }

/* Segmented tabs like the login page */
.tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: #2c2c2c; border-radius: 10px; padding: 4px;
}
.tabs button {
  padding: 10px 8px; border-radius: 8px; font-weight: 600; color: #c9ccd2;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.tabs button.active { background: var(--tkd-wit); color: var(--tkd-blauw); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.pill {
  min-width: 22px; padding: 1px 7px; border-radius: 999px; font-size: 13px;
  background: rgba(255,255,255,.15);
}
.tabs button.active .pill { background: var(--tkd-blauw-licht); }

.top.sub { display: flex; align-items: center; gap: 8px; padding-bottom: 10px; }
.top.sub h1 { font-size: 18px; margin: 0; flex: 1; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-size: 22px; color: var(--tkd-wit);
  background: #2c2c2c;
}
.icon-btn.danger { color: #ff8a9b; }
.icon-btn.armed { background: var(--tkd-rood); color: var(--tkd-wit); font-size: 14px; width: auto; padding: 0 12px; }
.table-btn {
  flex: 1; text-align: left; padding: 6px 12px; border-radius: 10px; background: #2c2c2c; color: var(--tkd-wit);
  display: flex; align-items: baseline; gap: 8px; min-height: 44px;
}
.table-btn .lbl { font-size: 13px; color: #b9bec7; }
.table-btn b { font-size: 24px; }
.table-btn .edit { margin-left: auto; font-size: 13px; color: #b9bec7; align-self: center; }

/* ---------- Lists ---------- */
main { padding: 16px; max-width: 900px; margin: 0 auto; }
.list { display: grid; gap: 12px; padding-bottom: calc(96px + var(--safe-b)); }
@media (min-width: 700px) { .list { grid-template-columns: 1fr 1fr; } }

.card {
  background: var(--tkd-wit); border: 1px solid var(--tkd-rand); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.card-main { text-align: left; padding: 14px 16px 10px; display: block; width: 100%; }
.card-head { display: flex; align-items: baseline; gap: 10px; }
.card-head .t { font-size: 22px; font-weight: 700; color: var(--tkd-blauw); }
.card-head .meta { margin-left: auto; font-size: 13px; color: var(--tkd-grijs); }
.items { margin-top: 6px; font-size: 15px; line-height: 1.4; color: var(--tkd-zwart); }
.item-list { list-style: none; margin: 8px 0 0; padding: 0; }
.item-list li {
  display: flex; align-items: baseline; gap: 10px; padding: 6px 0;
  border-top: 1px dashed var(--tkd-rand); font-size: 17px;
}
.item-list li:first-child { border-top: 0; }
.item-list .q { min-width: 34px; font-weight: 800; color: var(--tkd-blauw); font-variant-numeric: tabular-nums; }
.item-list .n { flex: 1; font-weight: 600; }
.item-list .s { font-size: 13px; color: var(--tkd-grijs); font-variant-numeric: tabular-nums; }
.items.empty { color: var(--tkd-grijs); font-style: italic; }
.card-foot {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px 12px 16px;
  border-top: 1px solid var(--tkd-rand); background: #fafbfc; margin-top: auto;
}
.tok { margin-right: auto; font-size: 15px; color: var(--tkd-grijs); }
.tok b { font-size: 22px; color: var(--tkd-zwart); }

.btn {
  min-height: 44px; padding: 0 16px; border-radius: 8px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn.primary { background: var(--tkd-blauw); color: var(--tkd-wit); }
.btn.primary:active { background: var(--tkd-blauw-donker); }
.btn.ghost { background: var(--tkd-blauw-licht); color: var(--tkd-blauw); }
.btn.danger { background: var(--tkd-rood-licht); color: var(--tkd-rood); }
.btn.armed { background: var(--tkd-rood); color: var(--tkd-wit); }

.empty-state {
  text-align: center; color: var(--tkd-grijs); padding: 48px 16px;
  border: 2px dashed var(--tkd-rand); border-radius: var(--radius); background: var(--tkd-wit);
}
.empty-state b { display: block; color: var(--tkd-zwart); font-size: 18px; margin-bottom: 6px; }
.warn {
  background: var(--tkd-rood-licht); color: var(--tkd-rood); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 12px; font-size: 14px;
}

.fab-wrap {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: linear-gradient(to top, var(--tkd-grijs-licht) 60%, rgba(244,245,247,0));
}
.fab {
  display: flex; width: 100%; max-width: 868px; margin: 0 auto; min-height: 56px;
  border-radius: var(--radius); background: var(--tkd-blauw); color: var(--tkd-wit);
  font-size: 18px; font-weight: 700; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 4px 14px rgba(11,60,138,.35);
}
.fab:active { background: var(--tkd-blauw-donker); }

.foot-info {
  margin-top: 20px; font-size: 13px; color: var(--tkd-grijs);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
}
.link { color: var(--tkd-blauw); font-weight: 600; padding: 8px 0; }

/* Archive summary */
.summary {
  background: var(--tkd-wit); border: 1px solid var(--tkd-rand); border-radius: var(--radius);
  margin-bottom: 12px;
}
.summary summary { padding: 14px 16px; cursor: pointer; font-weight: 600; list-style: none; display: flex; gap: 8px; }
.summary summary::-webkit-details-marker { display: none; }
.summary summary::after { content: "▾"; margin-left: auto; color: var(--tkd-grijs); }
.summary[open] summary::after { content: "▴"; }
.summary table { width: 100%; border-collapse: collapse; font-size: 15px; }
.summary td { padding: 8px 16px; border-top: 1px solid var(--tkd-rand); }
.summary td.n { text-align: right; font-variant-numeric: tabular-nums; }
.summary .actions { padding: 12px 16px 16px; border-top: 1px solid var(--tkd-rand); }

/* ---------- Table picker ---------- */
.tables {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
}
.tables button {
  position: relative; aspect-ratio: 1; border-radius: 10px;
  background: var(--tkd-wit); border: 1px solid var(--tkd-rand);
  font-size: 20px; font-weight: 700; color: var(--tkd-zwart);
}
.tables button:active { background: var(--tkd-blauw); color: var(--tkd-wit); }
.tables button.busy { background: var(--tkd-blauw-licht); border-color: #b9c8ec; color: var(--tkd-blauw); }
.tables button.current { background: var(--tkd-blauw); color: var(--tkd-wit); }
.tables .badge {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--tkd-rood); color: var(--tkd-wit);
  font-size: 12px; line-height: 20px;
}
.hint { font-size: 13px; color: var(--tkd-grijs); margin: 0 0 12px; }

/* ---------- Order editor ---------- */
.drinks { padding-bottom: calc(150px + var(--safe-b)); }
.drinks h2 {
  font-size: 12px; letter-spacing: .15em; text-transform: uppercase; color: var(--tkd-grijs);
  margin: 18px 0 8px;
}
.drinks h2:first-child { margin-top: 0; }
.grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
@media (max-width: 380px) { .grid { grid-template-columns: 1fr 1fr; } }

.tile { position: relative; }
.tile-add {
  width: 100%; min-height: 88px; padding: 12px 12px 10px; border-radius: var(--radius);
  background: var(--tkd-wit); border: 1px solid var(--tkd-rand);
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 6px;
  text-align: left; transition: transform .06s;
}
.tile-add:active { transform: scale(.97); background: var(--tkd-blauw-licht); }
.tile .name { font-weight: 600; font-size: 16px; line-height: 1.2; padding-right: 30px; }
.tile .price { font-size: 13px; color: var(--tkd-grijs); }
.tile.on .tile-add { border: 2px solid var(--tkd-blauw); background: var(--tkd-blauw-licht); padding: 11px 11px 9px; }
.tile.on .price { padding-right: 50px; }
.qty {
  position: absolute; top: 8px; right: 8px; pointer-events: none;
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px;
  background: var(--tkd-blauw); color: var(--tkd-wit); font-weight: 700; font-size: 16px;
  display: grid; place-items: center;
}
.tile-sub {
  position: absolute; right: 6px; bottom: 6px; width: 44px; height: 36px; border-radius: 8px;
  background: var(--tkd-wit); border: 1px solid var(--tkd-rood); color: var(--tkd-rood);
  font-size: 24px; font-weight: 700; line-height: 1; display: grid; place-items: center;
}
.tile-sub:active { background: var(--tkd-rood); color: var(--tkd-wit); }

.totalbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  background: var(--tkd-zwart); color: var(--tkd-wit);
  padding: 12px 16px calc(12px + var(--safe-b));
  box-shadow: 0 -4px 16px rgba(0,0,0,.2);
}
.totalbar-in { max-width: 868px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.totalbar .sum { flex: 1; min-width: 0; }
.totalbar .lbl { font-size: 11px; letter-spacing: .15em; text-transform: uppercase; color: #b9bec7; }
.totalbar .val { font-size: 34px; font-weight: 800; line-height: 1.1; }
.totalbar .val small { font-size: 16px; font-weight: 600; color: #c9ccd2; margin-left: 4px; }
.totalbar .lines { font-size: 13px; color: #c9ccd2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.totalbar .btn.primary { min-height: 56px; padding: 0 22px; font-size: 18px; }
.totalbar .btn.primary:disabled { background: #3a3a3a; color: #8a8f98; }

/* ---------- Toast & update ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translate(-50%, 20px);
  background: var(--tkd-zwart); color: var(--tkd-wit); border-radius: 10px;
  padding: 12px 16px; font-size: 15px; display: flex; align-items: center; gap: 14px;
  width: max-content; max-width: calc(100% - 32px); opacity: 0; pointer-events: none; transition: .2s; z-index: 50;
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast button { color: #9fb8ff; font-weight: 700; padding: 4px 0; white-space: nowrap; flex: none; }
body[data-view="edit"] #toast { bottom: calc(110px + var(--safe-b)); }

.update {
  background: var(--tkd-blauw); color: var(--tkd-wit); text-align: center; padding: 10px 16px;
  font-size: 14px; font-weight: 600; width: 100%;
}
