/* Grab & Go HQ — tema hijau & kuning emas, inspirasi corak geometri Arab */
:root {
  --bg: #f7f7ef;
  --bg-2: #eef0e2;
  --card: #ffffff;
  --ink: #1b2414;
  --ink-2: #3b4a33;
  --muted: #6f7a66;
  --line: #e1e5d3;
  --maroon: #2f6b12;
  --maroon-2: #225509;
  --maroon-soft: #e6f1dc;
  --saffron: #e0b42a;
  --saffron-soft: #fbf3d5;
  --gold: #c9962b;
  --ok: #2f7d5b;
  --ok-soft: #e1f2ea;
  --bad: #b3261e;
  --bad-soft: #fbe4e2;
  --shadow: 0 1px 2px rgba(30, 45, 20, .06), 0 8px 24px rgba(30, 45, 20, .06);
  --shadow-lg: 0 20px 50px rgba(30, 60, 10, .18);
  --r: 16px;
  --r-sm: 10px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Reem Kufi", "Plus Jakarta Sans", system-ui, sans-serif;
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.10' stroke-width='1.2'%3E%3Cpath d='M28 6l6.5 15.5L50 28l-15.5 6.5L28 50l-6.5-15.5L6 28l15.5-6.5z'/%3E%3Crect x='17' y='17' width='22' height='22' transform='rotate(45 28 28)'/%3E%3Ccircle cx='28' cy='28' r='4'/%3E%3C/g%3E%3C/svg%3E");
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f140c; --bg-2: #151c11; --card: #1a2215; --ink: #eef3e6; --ink-2: #cfdcc4; --muted: #93a287;
    --line: #2c3a25; --maroon: #8fd16a; --maroon-2: #a6e083; --maroon-soft: #1e3313; --saffron: #f2c94c;
    --saffron-soft: #3a3212; --ok: #6cc59b; --ok-soft: #173326; --bad: #f08a80; --bad-soft: #3d1c19;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--maroon); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 750; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; border-radius: 6px; }

/* ---------- Susun atur admin ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; padding: 22px 16px; color: #fff;
  background: var(--pattern), linear-gradient(170deg, #2f6b12 0%, #173f05 100%);
  display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, #f2d27a, #c9962b); display: grid; place-items: center; color: #173f05; font: 800 15px var(--font); letter-spacing: -.02em; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.brand-name { font: 600 1.25rem/1 var(--display); }
.brand-sub { font-size: .72rem; opacity: .75; letter-spacing: .06em; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: rgba(255,255,255,.82); font-weight: 600; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav a.on { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 3px 0 0 #f2d27a; }
.nav svg { width: 20px; height: 20px; flex: none; }
.side-foot { margin-top: auto; padding: 12px; font-size: .8rem; opacity: .8; }
.side-foot button { background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; padding: 6px 12px; border-radius: 999px; cursor: pointer; font: inherit; }
.main { padding: 28px clamp(16px, 3vw, 40px) 60px; max-width: 1240px; width: 100%; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.top p { margin: 0; }
.bottomnav { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 18px 16px 96px; }
  .mobilebar { display: flex !important; }
  .bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0 0; z-index: 30;
    background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; font-weight: 600; color: var(--muted); padding: 4px 0; }
  .bottomnav a.on { color: var(--maroon); }
  .bottomnav a:hover { text-decoration: none; }
  .bottomnav svg { width: 22px; height: 22px; }
}
.mobilebar { display: none; align-items: center; gap: 10px; margin: -18px -16px 18px; padding: 14px 16px; color: #fff; background: var(--pattern), linear-gradient(170deg, #2f6b12, #173f05); }

/* ---------- Komponen ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-h h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .g2, .g3 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 16px; }

.stat { position: relative; overflow: hidden; }
.stat .k { padding-right: 46px; min-height: 2.4em; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat .v { font-size: 1.9rem; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; }
.stat .s { font-size: .82rem; color: var(--muted); }
.stat .ico { position: absolute; right: 16px; top: 16px; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--maroon-soft); color: var(--maroon); }
.stat .ico svg { width: 20px; height: 20px; }
.stat.hero { color: #fff; border: 0; background: var(--pattern), linear-gradient(140deg, #2f6b12, #173f05); }
.stat.hero .k, .stat.hero .s { color: rgba(255,255,255,.78); }
.stat.hero .ico { background: rgba(255,255,255,.15); color: #f2d27a; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; cursor: pointer;
  padding: 10px 18px; border-radius: 12px; font: 700 .92rem var(--font); background: var(--maroon); color: #fff;
  transition: transform .08s ease, box-shadow .2s ease, background .2s; text-decoration: none !important; white-space: nowrap;
}
.btn:hover { background: var(--maroon-2); box-shadow: 0 6px 18px rgba(47, 107, 18, .25); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.gold { background: linear-gradient(135deg, #f2c25e, #d99a2b); color: #3e1408; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--bg-2); box-shadow: none; }
.btn.danger { background: var(--bad); }
.btn.wa { background: #1f9d55; }
.btn.sm { padding: 6px 12px; font-size: .82rem; border-radius: 10px; }
.btn.lg { padding: 15px 22px; font-size: 1.05rem; border-radius: 14px; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; }

label { display: block; font-weight: 650; font-size: .86rem; margin-bottom: 6px; color: var(--ink-2); }
.field { margin-bottom: 14px; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
input, select, textarea {
  width: 100%; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: 500 .95rem var(--font); transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--saffron); box-shadow: 0 0 0 4px color-mix(in srgb, var(--saffron) 22%, transparent); }
input.big { font-size: 1.5rem; font-weight: 750; padding: 14px 16px; letter-spacing: .02em; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1 1 160px; margin-bottom: 0; }

.table-wrap { overflow-x: auto; margin: 0 -20px -20px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 10px 20px; background: var(--bg-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: color-mix(in srgb, var(--saffron) 7%, transparent); }
td.r, th.r { text-align: right; }
.who { display: flex; align-items: center; gap: 12px; }
.av { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: .85rem; color: #fff; background: linear-gradient(135deg, #4a9a24, #225509); }
.who b { display: block; }
.who span span { font-size: .8rem; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 750; white-space: nowrap; background: var(--bg-2); color: var(--ink-2); }
.badge.Ahli { background: var(--maroon-soft); color: var(--maroon); }
.badge.Perak { background: linear-gradient(135deg, #e6eaef, #c3cad3); color: #3c4652; }
.badge.Emas { background: linear-gradient(135deg, #f7e2a6, #e0b14d); color: #5a3a05; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--saffron-soft); color: #9a5f05; }
@media (prefers-color-scheme: dark) { .badge.warn { color: var(--saffron); } }
.pts { font-weight: 800; color: var(--maroon); }
.pos { color: var(--ok); font-weight: 750; }
.neg { color: var(--bad); font-weight: 750; }

.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-weight: 600; display: flex; gap: 10px; align-items: flex-start; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.info { background: var(--saffron-soft); color: #7a4a04; }
@media (prefers-color-scheme: dark) { .alert.info { color: var(--saffron); } }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); font-weight: 650; font-size: .85rem; }
.chip.on { background: var(--maroon); border-color: var(--maroon); color: #fff; }
.chip:hover { text-decoration: none; border-color: var(--maroon); }

.bar { height: 10px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #e0b42a, #2f6b12); }
.stackbar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--bg-2); }
.stackbar i { display: block; height: 100%; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: .82rem; color: var(--ink-2); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--c); vertical-align: -1px; }

.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font: 600 11px var(--font); }
.chart .grid-l { stroke: var(--line); }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { width: 48px; height: 48px; opacity: .5; margin-bottom: 8px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.timeline li:last-child { border-bottom: 0; }
.tl-dot { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; font-size: 15px; background: var(--bg-2); }
.tl-dot.earn, .tl-dot.bonus { background: var(--ok-soft); }
.tl-dot.redeem { background: var(--saffron-soft); }
.tl-dot.expire, .tl-dot.adjust { background: var(--bad-soft); }
.tl-body { flex: 1; min-width: 0; }
.tl-body b { display: block; font-size: .92rem; }
.tl-body span { font-size: .8rem; color: var(--muted); }

.drop { border: 2px dashed var(--line); border-radius: var(--r); padding: 28px; text-align: center; cursor: pointer; transition: .15s; background: var(--bg); }
.drop:hover, .drop.over { border-color: var(--saffron); background: var(--saffron-soft); }
.drop input { display: none; }
.drop b { display: block; font-size: 1rem; margin-bottom: 4px; }
.steps { display: flex; gap: 8px; margin-bottom: 16px; }
.steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps span.on { background: var(--maroon); }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 14px; font-weight: 700; opacity: 0; transition: .25s; z-index: 60; box-shadow: var(--shadow-lg); pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 860px) { .toast { bottom: 90px; } }

dialog { border: 0; border-radius: 20px; padding: 0; width: min(440px, calc(100vw - 32px)); background: var(--card); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(10, 25, 5, .45); backdrop-filter: blur(3px); }
dialog .dh { padding: 20px 22px 0; }
dialog .db { padding: 16px 22px 22px; }

/* ---------- Kad ahli (page awam) ---------- */
.public { min-height: 100vh; background: radial-gradient(1200px 500px at 50% -120px, #2f6b12 0%, #173f05 45%, var(--bg) 46%); }
@media (prefers-color-scheme: dark) { .public { background: radial-gradient(1200px 500px at 50% -120px, #225509 0%, #0f2a04 45%, var(--bg) 46%); } }
.pwrap { max-width: 460px; margin: 0 auto; padding: 22px 16px 48px; }
.phead { display: flex; align-items: center; justify-content: space-between; color: #fff; margin-bottom: 18px; }
.phead .brand { padding: 0; }
.mcard {
  position: relative; border-radius: 24px; padding: 22px; color: #fff; overflow: hidden; min-height: 210px;
  box-shadow: var(--shadow-lg); isolation: isolate;
  background: var(--pattern), linear-gradient(135deg, #3d8a1a 0%, #225509 60%, #123304 100%);
}
.mcard.Perak { background: var(--pattern), linear-gradient(135deg, #7d8792 0%, #4b5560 55%, #2c333b 100%); }
.mcard.Emas { background: var(--pattern), linear-gradient(135deg, #d8a53f 0%, #a8761c 50%, #6e4a0a 100%); }
.mcard::after { content: ""; position: absolute; inset: -40% -30% auto auto; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.22), transparent 65%); z-index: -1; }
.mcard .tier { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: rgba(255,255,255,.16); font-weight: 800; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; backdrop-filter: blur(4px); }
.mcard .nm { font: 600 1.35rem var(--display); margin-top: 26px; }
.mcard .ph { opacity: .75; font-size: .85rem; letter-spacing: .08em; }
.mcard .bal { position: absolute; right: 22px; bottom: 20px; text-align: right; }
.mcard .bal b { display: block; font-size: 2.8rem; line-height: 1; font-weight: 800; letter-spacing: -.03em; }
.mcard .bal span { font-size: .78rem; opacity: .8; text-transform: uppercase; letter-spacing: .1em; }
.mcard .chipmark { position: absolute; right: 22px; top: 24px; font: 800 .7rem var(--font); letter-spacing: .18em; opacity: .85; }
.progress-card { margin-top: -14px; padding-top: 30px; border-radius: 0 0 20px 20px; }
.rw { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.rw:last-child { border-bottom: 0; }
.rw .ic { width: 46px; height: 46px; border-radius: 14px; flex: none; display: grid; place-items: center; font-size: 22px; background: var(--saffron-soft); }
.rw.locked .ic { filter: grayscale(1); opacity: .55; }
.rw .t { flex: 1; min-width: 0; }
.rw .t b { display: block; font-size: .95rem; }
.rw .t span { font-size: .8rem; color: var(--muted); }

/* ---------- Kaunter ---------- */
.kaunter { max-width: 560px; margin: 0 auto; }
.keypad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.keypad button { padding: 12px 0; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 750 1rem var(--font); cursor: pointer; }
.keypad button:hover { border-color: var(--saffron); background: var(--saffron-soft); }
.result-pop { text-align: center; padding: 26px 10px; }
.result-pop .big-pts { font-size: 3.2rem; font-weight: 800; color: var(--ok); letter-spacing: -.03em; line-height: 1; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
.result-pop .big-pts { animation: pop .45s ease-out; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--pattern), linear-gradient(160deg, #2f6b12, #0f2a04); }
.login .card { width: min(400px, 100%); padding: 30px; border: 0; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; background: var(--bg-2); border-radius: 14px; margin-bottom: 18px; }
.tabs label { margin: 0; text-align: center; padding: 9px; border-radius: 10px; cursor: pointer; font-weight: 700; color: var(--muted); }
.tabs input { display: none; }
.tabs input:checked + span { color: var(--ink); }
.tabs label:has(input:checked) { background: var(--card); box-shadow: var(--shadow); color: var(--ink); }

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

/* Elak jadual menolak grid keluar skrin; susun menegak pada skrin sederhana */
.grid > * { min-width: 0; }
@media (max-width: 1100px) { .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; } }

/* Mobile: sembunyi lajur sekunder, input 16px (elak auto-zoom iOS), sasaran sentuh lebih besar */
@media (max-width: 640px) {
  .hide-sm { display: none; }
  input, select, textarea { font-size: 16px; }
  td, th { padding-left: 14px; padding-right: 14px; }
  .table-wrap { margin: 0 -16px -16px; }
  .card { padding: 16px; border-radius: 14px; }
  .top h1 { font-size: 1.35rem; }
  .top .row { width: 100%; }
  .top .row .btn { flex: 1; }
  .stat .v { font-size: 1.55rem; }
  .g4 { gap: 10px; }
  .btn { min-height: 44px; }
}
.brand-mark { font-size: 12px !important; letter-spacing: -.03em; }
.login .brand-mark, .phead .brand-mark { font-size: 15px !important; }

.who b { color: var(--ink); }
a.who:hover { text-decoration: none; }
a.who:hover b { color: var(--maroon); }

/* ---------- CRM ---------- */
.badge.seg { background: color-mix(in srgb, var(--sc) 16%, transparent); color: var(--sc); }
@media (prefers-color-scheme: dark) { .badge.seg { color: color-mix(in srgb, var(--sc) 55%, #fff); } }
.seg-card { border-top: 4px solid var(--sc); }
.tasks { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
@media (max-width: 640px) { .tasks { grid-template-columns: 1fr; } }
.task + .task { margin-top: 0; }
.task-h { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.task-meta { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.task.done { opacity: .72; }
.task.done:hover { opacity: 1; }
details.msg summary { cursor: pointer; font-weight: 700; font-size: .85rem; color: var(--maroon); }
.bubble { margin-top: 8px; background: #e7ffdb; color: #111; padding: 12px 14px; border-radius: 14px 14px 14px 4px; font-size: .9rem; white-space: pre-wrap; box-shadow: var(--shadow); }
.outcomes .chips { gap: 6px; }
.outcomes .btn.sm { min-height: 38px; }
.sm-select { width: auto; padding: 7px 10px; font-size: .85rem; }
.sm-input { flex: 1 1 180px; padding: 7px 10px; font-size: .85rem; }
ul.plain { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
ul.plain li { padding: 4px 0; }
:target { scroll-margin-top: 20px; }
.task:target { box-shadow: 0 0 0 3px var(--saffron), var(--shadow); }
@media (max-width: 640px) {
  .hub-stats { grid-template-columns: repeat(3, 1fr) !important; gap: 8px; }
  .hub-stats .card { padding: 10px; }
  .hub-stats .ico, .hub-stats .s { display: none; }
  .hub-stats .v { font-size: 1.1rem; }
  .hub-stats .k { font-size: .6rem; padding-right: 0; min-height: 2.6em; letter-spacing: .02em; }
}

/* ---------- Kaunter walk-in ---------- */
.ks { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.ks-cart { position: sticky; top: 16px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.ks-cart + .card { margin-top: 0; }
.cart-lines { overflow-y: auto; flex: 1 1 auto; min-height: 40px; }
.cline { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.cname b { display: block; font-size: .9rem; line-height: 1.25; }
.cqty { display: flex; align-items: center; gap: 6px; }
.qbtn { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: 800 1.1rem var(--font); cursor: pointer; }
.qbtn:hover { border-color: var(--maroon); color: var(--maroon); }
.cline-t { min-width: 64px; text-align: right; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
.pbtn { position: relative; text-align: left; padding: 12px; min-height: 84px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; font: inherit; transition: border-color .12s, transform .06s, box-shadow .12s; }
.pbtn:hover { border-color: var(--maroon); box-shadow: var(--shadow); }
.pbtn:active { transform: scale(.98); }
.pbtn.on { border-color: var(--maroon); background: color-mix(in srgb, var(--maroon) 7%, var(--card)); }
.pname { font-weight: 700; font-size: .88rem; line-height: 1.25; }
.pprice { font-weight: 800; color: var(--maroon); font-size: .9rem; }
.ptag { font-size: .66rem; font-weight: 800; color: #7a5a00; background: var(--saffron-soft); padding: 2px 6px; border-radius: 999px; vertical-align: 1px; }
.pqty { position: absolute; top: -8px; right: -8px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 999px; background: var(--maroon); color: #fff; font-weight: 800; font-size: .8rem; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
@media (max-width: 1000px) {
  .ks { grid-template-columns: 1fr; }
  .ks-cart { position: sticky; bottom: 0; top: auto; max-height: 58vh; margin: 0 -16px; border-radius: 18px 18px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,.12); z-index: 20; order: 2; }
}
@media (max-width: 860px) { .has-bnav .ks-cart { bottom: 64px; } .no-bnav .main { padding-bottom: 24px; } }
@media (max-width: 640px) { .pgrid { grid-template-columns: repeat(2, 1fr); } .pbtn { min-height: 76px; } }
.menu-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.menu-row .mr-name { flex: 3 1 240px; }
.menu-row .mr-price { flex: 0 0 96px; }
.menu-row .mr-cat { flex: 1 1 140px; }
.mr-chk { display: inline-flex; gap: 6px; align-items: center; margin: 0; font-weight: 600; white-space: nowrap; }
.mr-chk input { width: auto; }
tr.muted .menu-row input:not([type=checkbox]) { color: var(--muted); }

.cart-toggle { all: unset; cursor: default; display: flex; align-items: center; gap: 8px; }
.cart-caret { display: none; font-size: .9rem; color: var(--muted); transition: transform .2s; }
@media (max-width: 1000px) {
  .cart-toggle { cursor: pointer; }
  .cart-caret { display: inline; }
  .ks-cart { max-height: 82vh; padding: 12px 16px; }
  .ks-cart.open .cart-caret { transform: rotate(180deg); }
  .ks-cart:not(.open) .cart-lines, .ks-cart:not(.open) #ks-promo, .ks-cart:not(.open) #ks-clear,
  .ks-cart:not(.open) .cart-foot > :not(#ks-save):not(#ks-hint) { display: none !important; }
  .ks-cart:not(.open) .card-h { margin-bottom: 6px !important; }
  .ks-cart:not(.open) #ks-hint { margin: 4px 0 0 !important; }
}

/* Templat mesej segmen — senarai ringkas, buka satu-satu */
.tpl-list { margin-top: 10px; border: 1px solid var(--line, #e7e2d3); border-radius: 12px; overflow: hidden; background: #fff; }
.tpl { border-top: 1px solid var(--line, #eee8d8); }
.tpl:first-child { border-top: 0; }
.tpl > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 11px 12px; cursor: pointer; font-size: .9rem; }
.tpl > summary::-webkit-details-marker { display: none; }
.tpl > summary::after { content: '▾'; margin-left: 6px; color: #9a9483; font-size: .8rem; transition: transform .15s; }
.tpl[open] > summary::after { transform: rotate(180deg); }
.tpl[open] > summary { background: #faf8f1; }
.tpl:hover > summary { background: #fbfaf5; }
.tpl.off .tpl-name, .tpl.off .tpl-no { opacity: .45; }
.tpl-no { flex: none; width: 22px; height: 22px; border-radius: 50%; background: #f0ede2; color: #5d5848; display: grid; place-items: center; font-size: .72rem; font-weight: 800; }
.tpl-name { flex: 1 1 auto; min-width: 0; font-weight: 600; line-height: 1.3; }
.tpl-tag { flex: none; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #fbf1d3; color: #8a6412; }
.tpl-tag.off { background: #eee; color: #777; }
.tpl-perf { flex: none; font-size: .75rem; font-weight: 700; color: var(--green, #2f6b12); min-width: 2ch; text-align: right; }
.tpl-body { padding: 4px 12px 14px; background: #faf8f1; display: grid; gap: 10px; }
.tpl-body textarea { width: 100%; font-size: .88rem; line-height: 1.45; }
.tpl-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.tpl-grid label { display: grid; gap: 4px; font-size: .75rem; font-weight: 700; color: #6b6655; }
.tpl-grid input, .tpl-grid select { width: 100%; min-width: 0; font-weight: 500; }
.tpl-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tpl-on { display: flex; gap: 6px; align-items: center; font-size: .82rem; font-weight: 600; }
.tpl-on input { width: auto; }
.tpl-act { display: flex; justify-content: flex-end; gap: 8px; }
.tpl-act .btn.danger { background: transparent; border-color: transparent; color: #b03a2e; box-shadow: none; margin-right: auto; }
.tpl-act .btn.danger:hover { background: #fbeceb; }
.tpl-tools { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; }
.linkbtn { background: none; border: 0; padding: 4px 2px; font: inherit; font-size: .85rem; font-weight: 700; color: var(--green, #2f6b12); cursor: pointer; }
.linkbtn.muted { color: #8a8574; font-weight: 600; }
.tpl-hint { margin: 6px 0 0; }

/* ---------- Duit masuk & keluar ---------- */
.cb-form .tabs { margin-bottom: 14px; }
.cb-form:has(input[name="kind"][value="in"]:checked) .cb-out,
.cb-form:has(input[name="kind"][value="out"]:checked) .cb-in { display: none; }
.cb-list { list-style: none; margin: 0; padding: 0; }
.cb-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line, #ece7da); }
.cb-row:last-child { border-bottom: 0; }
.cb-row.sys { background: color-mix(in srgb, var(--ok, #2f6b12) 5%, transparent); border-radius: 10px; padding: 10px; margin-bottom: 6px; border-bottom: 0; }
.cb-row.voided { opacity: .5; }
.cb-row.voided .cb-r b { text-decoration: line-through; }
.cb-ic { flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; }
.cb-ic.out { background: color-mix(in srgb, var(--bad, #b3261e) 12%, transparent); color: var(--bad, #b3261e); }
.cb-ic.in { background: color-mix(in srgb, var(--ok, #2f6b12) 12%, transparent); color: var(--ok, #2f6b12); }
.cb-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cb-t span { font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.cb-r { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.cb-r form { margin: 0; }
.cb-r .linkbtn { color: var(--bad, #b3261e); padding: 0; font-size: .78rem; }
.cb-bar { margin-bottom: 12px; }
.cb-bar-t { display: flex; justify-content: space-between; gap: 10px; font-size: .86rem; margin-bottom: 5px; }
.bar.out > i { background: linear-gradient(90deg, #e8a07a, #b3261e); }

/* ---------- HR: tab, tempoh ---------- */
.hr-tabs { display: flex; gap: 6px; padding: 5px; background: var(--bg-2); border-radius: 14px; margin: 0 0 16px; overflow-x: auto; }
.hr-tabs a { flex: 1; text-align: center; padding: 9px 12px; border-radius: 10px; font-weight: 700; color: var(--muted); text-decoration: none; white-space: nowrap; }
.hr-tabs a.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.seg-pills { display: flex; gap: 4px; margin-left: auto; background: var(--bg-2); border-radius: 999px; padding: 3px; }
.seg-pills a { padding: 6px 12px; border-radius: 999px; font-size: .82rem; font-weight: 700; color: var(--muted); text-decoration: none; }
.seg-pills a.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
@media (max-width: 640px) { .seg-pills { margin-left: 0; width: 100%; } .seg-pills a { flex: 1; text-align: center; } }

/* ---------- Jam kerja ---------- */
.clock-now { font-size: 2rem; font-weight: 800; text-align: right; line-height: 1; }
.clock-now span { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-top: 4px; }
.punch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.punch { padding: 0; }
.punch.on { border-color: color-mix(in srgb, var(--ok, #2f6b12) 45%, transparent); }
.punch summary { display: flex; align-items: center; gap: 12px; padding: 14px; cursor: pointer; list-style: none; }
.punch summary::-webkit-details-marker { display: none; }
.punch-av { flex: 0 0 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--bg-2); color: var(--ink-2); }
.punch.on .punch-av { background: color-mix(in srgb, var(--ok, #2f6b12) 15%, transparent); color: var(--ok, #2f6b12); }
.punch-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.punch-t span { font-size: .8rem; color: var(--muted); }
.punch[open] summary .btn { display: none; }
.punch-f { display: flex; gap: 8px; padding: 0 14px 14px; }
.punch-f input { flex: 1; min-width: 0; font-size: 1.2rem; letter-spacing: .3em; text-align: center; }

/* ---------- Kehadiran ---------- */
tr.warn td { background: color-mix(in srgb, var(--bad, #b3261e) 6%, transparent); }
.ot-f { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ot-f input { width: 76px; padding: 6px 8px; }
.ot-f select { width: auto; padding: 6px 8px; font-size: .82rem; }
.edit-d summary { list-style: none; cursor: pointer; }
.edit-d summary::-webkit-details-marker { display: none; }
.edit-f { display: grid; gap: 8px; margin-top: 8px; min-width: 220px; text-align: left; }
.edit-f label { margin: 0; font-size: .78rem; }
.edit-f input { margin-top: 3px; padding: 6px 8px; }
.btn.danger { color: var(--bad, #b3261e); }
.add-shift summary { cursor: pointer; }

/* ---------- Gaji ---------- */
.pay { padding: 0; margin-bottom: 12px; }
.pay summary { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; list-style: none; }
.pay summary::-webkit-details-marker { display: none; }
.pay-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pay-t span { font-size: .8rem; color: var(--muted); }
.pay-r { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.pay-r b { font-size: 1.1rem; }
.pay-body { padding: 0 16px 16px; border-top: 1px solid var(--line); }
.pay-lines { width: 100%; margin-top: 8px; }
.pay-lines td { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.pay-lines tfoot td { border-bottom: 0; padding-top: 10px; }
.item-f { margin-top: 12px; gap: 8px; }
.item-f .field { margin: 0; }
.tpl-tag.ok { background: color-mix(in srgb, var(--ok, #2f6b12) 14%, transparent); color: var(--ok, #2f6b12); }

/* ---------- Slip gaji (cetak) ---------- */
body.slips { background: #e9ebe4; color: #111; font-family: "Plus Jakarta Sans", system-ui, sans-serif; margin: 0; padding: 70px 16px 30px; }
.slip-bar { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; background: #1f4a0b; color: #fff; z-index: 5; }
.slip { background: #fff; max-width: 720px; margin: 0 auto 24px; padding: 28px 30px; border-radius: 8px; box-shadow: 0 2px 12px rgba(0,0,0,.08); position: relative; font-size: 13px; }
.slip.draft::after { content: "DRAF"; position: absolute; top: 40%; left: 50%; transform: translate(-50%,-50%) rotate(-18deg); font-size: 90px; font-weight: 800; color: rgba(179,38,30,.09); pointer-events: none; }
.slip header { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #1f4a0b; padding-bottom: 12px; margin-bottom: 14px; }
.slip header h1 { font-size: 18px; margin: 0 0 2px; color: #1f4a0b; }
.slip header div { color: #444; line-height: 1.4; }
.slip-h { text-align: right; } .slip-h b { display: block; font-size: 16px; letter-spacing: .12em; color: #111; } .slip-h span { color: #444; }
.slip table { width: 100%; border-collapse: collapse; }
.slip-info td { padding: 4px 6px 4px 0; vertical-align: top; } .slip-info td:nth-child(odd) { color: #666; width: 16%; }
.slip-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 16px 0; align-items: start; }
.slip-cols th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #555; border-bottom: 1px solid #bbb; padding: 6px 0; }
.slip-cols td { padding: 6px 0; border-bottom: 1px dashed #ddd; }
.slip-cols tfoot td { font-weight: 700; border-bottom: 0; border-top: 1px solid #bbb; }
.slip .r { text-align: right; } .slip .muted { color: #999; }
.slip-net { display: flex; justify-content: space-between; align-items: center; background: #f1f5ea; border: 1px solid #cfdcc0; border-radius: 6px; padding: 12px 16px; }
.slip-net span { font-weight: 700; letter-spacing: .1em; } .slip-net b { font-size: 22px; color: #1f4a0b; }
.slip footer { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 40px; }
.sig { font-size: 11px; color: #555; } .sig span { display: block; border-bottom: 1px solid #888; height: 34px; }
.slip-note { margin: 18px 0 0; font-size: 10px; color: #888; text-align: center; }
@media (max-width: 560px) { .slip { padding: 18px; } .slip-cols, .slip header { grid-template-columns: 1fr; display: grid; } .slip-h { text-align: left; } }
@media print {
  @page { size: A5 portrait; margin: 8mm; }
  body.slips { background: #fff; padding: 0; }
  .no-print { display: none !important; }
  .slip { box-shadow: none; border-radius: 0; margin: 0; max-width: none; padding: 0; page-break-after: always; break-after: page; font-size: 11px; }
  .slip:last-of-type { page-break-after: auto; break-after: auto; }
  .slip-cols { grid-template-columns: 1fr 1fr; }
}

/* Elak kandungan lebar menolak grid utama melebihi skrin */
.main { min-width: 0; }

/* Logo syarikat */
.logo-pick { display: flex; gap: 14px; align-items: flex-start; }
.logo-prev { width: 72px; height: 72px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 4px; }
.slip-co { display: flex; gap: 12px; align-items: flex-start; }
.slip-logo { width: 64px; height: 64px; object-fit: contain; flex: 0 0 64px; }
@media print { .slip-logo { width: 52px; height: 52px; flex-basis: 52px; } }

/* ---------- Order ---------- */
.ord-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
@media (max-width: 640px) { .ord-link { padding: 11px 12px; } .ord-link span { display: none; } }
.ord-link { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); }
.ord-link:hover { border-color: var(--saffron); }
.ord-link span { font-size: .8rem; color: var(--muted); }
.ord-list { list-style: none; margin: 0; padding: 0; }
.ord { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ord:last-child { border-bottom: 0; }
.ord-h { display: flex; align-items: center; gap: 8px; }
.ord-t { color: var(--muted); font-size: .85rem; min-width: 40px; }
.ord-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ord-who a { color: inherit; }
.ord-ch { font-size: .8rem; color: var(--muted); margin: 4px 0 0 48px; }
.ord-items { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .84rem; margin: 4px 0 0 48px; }
.ord-ph { margin: 2px 0 0 48px; }
.src-chip { font-size: .7rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.src-chip.web { background: color-mix(in srgb, #e0b42a 22%, transparent); color: #8a6a06; }
.src-chip.orderla { background: color-mix(in srgb, #3b6fd1 15%, transparent); color: #2c55a3; }
.src-chip.walkin { background: color-mix(in srgb, var(--ok, #2f6b12) 14%, transparent); color: var(--ok, #2f6b12); }
.kv { list-style: none; margin: 0; padding: 0; }
.kv li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: .88rem; }
.kv li:last-child { border-bottom: 0; }
.kv li span { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) { .ord-ch, .ord-items, .ord-ph { margin-left: 0; } }
/* Tablet / iPad: 3 kad sebaris, senarai order lebih lebar, nama tidak dipotong */
@media (min-width: 641px) and (max-width: 1000px) { .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 641px) { .ord-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); } }
.ord-who { white-space: normal; overflow: visible; }

/* ---------- Menu Website ---------- */
.wm-bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; font-size: .85rem; color: var(--muted); }
.wm-bar form { margin: 0; }
.wm-sec { margin-bottom: 14px; }
.wm-sec.off { opacity: .6; }
.wm-sh { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.wm-sh h2 { margin: 0; }
.wm-list { list-style: none; margin: 0; padding: 0; }
.wm-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.wm-row:last-child { border-bottom: 0; }
.wm-row.off { opacity: .55; }
.wm-row.out .wm-t b { text-decoration: line-through; color: var(--muted); }
.wm-ph { flex: 0 0 56px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--bg-2); display: grid; place-items: center; font-size: .6rem; color: var(--muted); text-align: center; text-decoration: none; }
.wm-ph img { width: 100%; height: 100%; object-fit: cover; }
.wm-t { flex: 1; min-width: 0; display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.wm-t span { font-size: .82rem; color: var(--muted); }
.wm-tg { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.wm-tg form, .wm-mvs form { margin: 0; }
.wm-chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: .8rem; font-weight: 700; color: var(--muted); cursor: pointer; min-height: 34px; }
.wm-chip.on.bad { background: color-mix(in srgb, var(--bad, #b3261e) 12%, transparent); border-color: transparent; color: var(--bad, #b3261e); }
.wm-chip.on.ok { background: color-mix(in srgb, var(--ok, #2f6b12) 14%, transparent); border-color: transparent; color: var(--ok, #2f6b12); }
.wm-mvs { display: flex; flex-direction: column; gap: 2px; }
.wm-mv { width: 26px; height: 20px; border: 0; background: var(--bg-2); border-radius: 6px; cursor: pointer; font-size: .75rem; color: var(--ink-2); padding: 0; }
.wm-mv:disabled { opacity: .3; cursor: default; }
.wm-img { display: flex; gap: 12px; align-items: flex-start; }
.img-prev { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); flex: none; }
.wm-cks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.wm-ck { display: flex; align-items: center; gap: 8px; font-weight: 600; margin: 6px 0; }
.wm-ck input { width: auto; margin: 0; }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
@media (max-width: 640px) { .wm-row { flex-wrap: wrap; } .wm-tg { width: 100%; justify-content: flex-start; padding-left: 68px; } }
