/* =========================================================
   Lumie Plus · Admin — same look as the storefront account page
   Pastel page, borderless white cards with soft purple shadows,
   pill buttons and tabs, dark-ink selected state.
   ========================================================= */
:root {
  --bg: #f4f0fa;
  --surface: #fff;
  --surface-2: #faf9fd;
  --ink: #2a2d5c;
  --muted: #6e7196;
  --faint: #a3a5c0;
  --line: #eee9f6;
  --line-strong: #dcd8ea;
  --brand: #7c6cf0;
  --brand-ink: #5b4bd6;
  --brand-soft: #efecfe;
  --ok: #138a59;
  --ok-soft: #e4f6ed;
  --warn: #b26a00;
  --warn-soft: #fff3dc;
  --bad: #d92d45;
  --bad-soft: #fdebee;
  --glow: var(--brand);
  --radius: 22px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(90, 70, 150, .04), 0 8px 24px rgba(90, 70, 150, .08);
  --shadow-pop: 0 18px 40px rgba(90, 70, 150, .22);
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
  --side: 252px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "Prompt", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; font-feature-settings: "liga" 0; }
[hidden] { display: none !important; }
img { display: block; }
svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
kbd {
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: #fff;
  font: 500 12px/1.6 "Prompt", sans-serif;
  color: var(--ink);
}
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.center { text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--faint); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn--primary { border-color: transparent; background: var(--brand); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 30%, transparent); }
.btn--primary:hover:not(:disabled) { background: var(--brand-ink); border-color: transparent; }
.btn--danger { color: var(--bad); }
.btn--danger:hover:not(:disabled) { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 40%, #fff); }
.btn--light { border-color: transparent; background: #fff; color: var(--ink); font-weight: 600; }
.btn--light:hover:not(:disabled) { background: var(--brand-soft); border-color: transparent; }
.btn--ghost-light { border-color: transparent; background: transparent; color: rgba(255, 255, 255, .8); }
.btn--ghost-light:hover:not(:disabled) { background: rgba(255, 255, 255, .12); border-color: transparent; color: #fff; }
.btn--sm { padding: 6px 12px; font-size: 13.5px; }
.btn--block { width: 100%; }
.iconbtn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.iconbtn:hover:not(:disabled) { background: var(--bg); color: var(--ink); }
.iconbtn:disabled { opacity: .35; cursor: default; }
:is(.btn, .iconbtn, .nav, .chip-app, .kpi, .seg button, .switch, summary):focus-visible { outline: none; box-shadow: var(--ring); }

/* ---------- Inputs ---------- */
.input, .field input, .field textarea, .field select, .search input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
select.input { width: auto; padding-right: 32px; }
.field textarea { resize: vertical; min-height: 72px; line-height: 1.55; }
:is(.input, .field input, .field textarea, .field select, .search input):focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.field { display: grid; gap: 6px; min-width: 0; font-size: 13.5px; color: var(--muted); }
.field > span small { color: var(--faint); }
::placeholder { color: var(--faint); }

/* ---------- Login ---------- */
.login {
  width: min(380px, calc(100% - 32px));
  margin: 14vh auto 0;
  padding: 36px 28px 28px;
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow-pop);
}
.login__logo { border-radius: 50%; box-shadow: 0 0 0 4px var(--brand-soft); margin-bottom: 4px; }
.login h1 { font-size: 22px; }
.login p { margin: 0; color: var(--muted); }
.login .input { text-align: center; padding: 11px; }
.login .btn { padding: 11px; }
.login__err { color: var(--bad) !important; min-height: 1.5em; font-size: 14px; }

.login { width: min(420px, calc(100% - 32px)); margin: 8vh auto 32px; }
.lsteps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: 100%; margin: 4px 0 6px; padding: 0; list-style: none; }
.lsteps li { display: grid; justify-items: center; gap: 4px; color: var(--faint); font-size: 12.5px; position: relative; }
.lsteps li i { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--bg); font-style: normal; font-weight: 600; font-size: 13px; z-index: 1; }
.lsteps li + li::before { content: ""; position: absolute; top: 14px; right: 50%; width: 100%; height: 2px; background: var(--line); }
.lsteps li.is-on { color: var(--brand-ink); font-weight: 600; }
.lsteps li.is-on i { background: var(--brand); color: #fff; }
.lsteps li.is-done { color: var(--ok); }
.lsteps li.is-done i { background: var(--ok); color: #fff; }
.lsteps li.is-done + li::before, .lsteps li.is-done + li.is-on::before { background: var(--ok); }
.lpanel { display: grid; gap: 12px; width: 100%; text-align: center; }
.lpanel[hidden] { display: none; }
.lgoogle { display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 600; }
.lqr { justify-self: center; width: 200px; height: 200px; padding: 8px; border-radius: 12px; background: #fff; box-shadow: 0 0 0 1px var(--line); display: grid; place-items: center; }
.lqr svg { width: 100%; height: 100%; }
.lpanel code { font-size: 13px; letter-spacing: .04em; word-break: break-all; }
.lform-a { display: grid; gap: 10px; }
.lcode { font-size: 24px !important; letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.lcam { position: relative; justify-self: center; width: min(300px, 100%); aspect-ratio: 3 / 4; border-radius: 22px; overflow: hidden; background: #111; }
.lcam[hidden] { display: none; }
.lcam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.lcam__ring { position: absolute; inset: 10% 14% 16%; border: 3px dashed rgba(255, 255, 255, .55); border-radius: 50%; transition: border-color .2s; }
.lcam.is-ok .lcam__ring { border-style: solid; border-color: #3ddc84; }
.lcam[data-phase="processing"] .lcam__ring, .lcam[data-phase="done"] .lcam__ring { border-color: var(--brand); }
.lcam__steps { position: absolute; top: 10px; right: 10px; padding: 2px 10px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 13px; }
.lcam__steps:empty { display: none; }
.lprogress { width: 100%; height: 6px; accent-color: var(--brand); }
.lmsg { min-height: 1.5em; color: var(--ink) !important; font-weight: 500; font-size: 15px; }
.lwho { margin: 0; color: var(--muted); }
.lphone { display: grid; justify-items: center; gap: 6px; }
.lphone[hidden] { display: none; }
.lphone .linkbtn { justify-self: center; }
.lqr--phone { width: 220px; height: 220px; }
.lqr--phone.is-off svg { opacity: .15; filter: blur(2px); }
.lqr--phone.is-done { background: var(--ok-soft); }
.lemergency { width: 100%; margin-top: 6px; color: var(--muted); font-size: 13px; }
.lemergency summary { cursor: pointer; text-align: center; }
.lemergency form { margin-top: 10px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100dvh; }

.side {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.side__brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: inherit; text-decoration: none; }
.side__brand img { border-radius: 50%; box-shadow: 0 0 0 3px var(--brand-soft); }
.side__brand span { display: grid; line-height: 1.25; }
.side__brand b { font-weight: 600; font-size: 16px; }
.side__brand small { color: var(--muted); font-size: 12.5px; }
.side__nav { display: grid; gap: 2px; }
.side__foot { margin-top: auto; display: grid; gap: 2px; padding-top: 12px; border-top: 1px solid var(--line); }

.nav {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 11px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.nav svg { width: 20px; height: 20px; }
.nav:hover { background: var(--bg); color: var(--ink); }
.nav.is-active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.nav--sub { font-size: 14px; padding: 8px 12px; }
.nav__badge {
  margin-left: auto;
  min-width: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--bad);
  color: #fff;
  font: 600 12px/20px "Prompt", sans-serif;
  font-style: normal;
  text-align: center;
}
.nav__badge.is-on { background: var(--ok-soft); color: var(--ok); }
.nav__badge.is-off { background: var(--bg); color: var(--muted); }

.content { min-width: 0; padding: 28px 32px 120px; }
.view { display: grid; gap: 18px; max-width: 1180px; margin: 0 auto; align-content: start; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; line-height: 1.25; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- Card ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card--pad { padding: 22px 24px; }
.card__head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.narrow { max-width: 640px; }

/* ---------- Products: app picker ---------- */
.appbar { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-app {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.chip-app img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.chip-app small { padding: 0 7px; border-radius: 999px; background: var(--bg); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chip-app:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.chip-app.is-active {
  border-color: var(--app);
  box-shadow: 0 0 0 1px var(--app), 0 4px 14px color-mix(in srgb, var(--app) 22%, transparent);
  font-weight: 600;
}
.chip-app.is-active small { background: color-mix(in srgb, var(--app) 14%, #fff); color: var(--ink); }
.chip-app.is-empty { color: var(--muted); }

.cur { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.cur img { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; box-shadow: 0 0 0 2px #fff, 0 0 0 4px color-mix(in srgb, var(--glow) 35%, transparent); }
.cur h2 { font-size: 19px; line-height: 1.25; }
.cur a { color: var(--muted); font-size: 13px; text-decoration: none; }
.cur a:hover { color: var(--brand-ink); text-decoration: underline; }

.stats { display: flex; gap: 6px; flex-wrap: wrap; }
.stat {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
}
.stat b { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.stat--ok { background: var(--ok-soft); }
.stat--ok b { color: var(--ok); }
.stat--bad { background: var(--bad-soft); }
.stat--bad b { color: var(--bad); }

/* ---------- Products: spreadsheet table ---------- */
.ptable { container-type: inline-size; }
.ptable__head, .pr__row {
  display: grid;
  grid-template-columns: 28px minmax(170px, 1fr) 96px 108px 96px 82px 118px 108px 34px;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
}
.ptable__head {
  padding-top: 10px;
  padding-bottom: 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}
.pr { border-bottom: 1px solid var(--line); transition: background-color .15s; }
.pr:last-child { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.pr:hover, .pr:focus-within { background: var(--surface-2); }
.pr__row { padding-top: 10px; padding-bottom: 10px; }
.pr__n { color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; text-align: center; }

/* Name + money inputs look like plain text until hover/focus = spreadsheet feel */
.pr__name, .money input {
  width: 100%;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.pr__name { font-weight: 600; }
.pr__name:hover, .money input:hover { border-color: var(--line-strong); background: #fff; }
.pr__name:focus, .money input:focus { outline: none; border-color: var(--brand); background: #fff; box-shadow: var(--ring); }
.pr__name:placeholder-shown { border-color: var(--line-strong); background: #fff; }
.money { display: grid; min-width: 0; }
.money small { display: none; color: var(--muted); font-size: 12px; }
.money__in { position: relative; display: block; }
.money__in i { position: absolute; left: 9px; top: 50%; translate: 0 -50%; color: var(--faint); font-style: normal; font-size: 13px; pointer-events: none; }
.money input { padding-left: 22px; text-align: right; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.money input::-webkit-outer-spin-button, .money input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.money--main input { font-weight: 600; border-color: var(--line-strong); background: #fff; }
.money input.is-auto, .money input.is-auto:hover { border-color: transparent; background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; cursor: default; box-shadow: none; }
.auto-dot { display: inline-block; margin: 0 4px; padding: 0 8px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.auto-cost { display: flex; align-items: center; gap: 4px; min-height: 42px; padding: 0 12px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand-ink); font-size: 14.5px; font-variant-numeric: tabular-nums; }
.auto-cost b { font-weight: 600; }
.money input.is-bad { border-color: var(--bad); background: var(--bad-soft); }
.money input:placeholder-shown { border-color: var(--line-strong); background: #fff; }
.money--compare input:not(:placeholder-shown) { text-decoration: line-through; text-decoration-color: var(--faint); }

.pr__profit { display: grid; text-align: right; font-variant-numeric: tabular-nums; }
.pr__profit small { display: none; color: var(--muted); font-size: 12px; }
.pr__profit b { font-weight: 600; color: var(--faint); }
.pr__profit b.ok { color: var(--ok); }
.pr__profit b.bad { color: var(--bad); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill--plain::before { display: none; }
.pill--ok { background: var(--ok-soft); color: var(--ok); }
.pill--warn { background: var(--warn-soft); color: var(--warn); }
.pill--bad { background: var(--bad-soft); color: var(--bad); }
.pill--brand { background: var(--brand-soft); color: var(--brand-ink); }
.pill--brand::before { display: none; }

/* Status switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 4px;
  border: 0;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.switch i {
  position: relative;
  width: 30px;
  height: 18px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background-color .15s;
}
.switch i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .18s cubic-bezier(.2, .8, .2, 1);
}
.switch.is-on { background: var(--ok-soft); color: var(--ok); }
.switch.is-on i { background: var(--ok); }
.switch.is-on i::after { transform: translateX(12px); }

.pr.is-off .pr__name, .pr.is-off .money input, .pr.is-off .pr__profit b { color: var(--muted); }
.pr__exp svg { transition: transform .2s; }
.pr.is-open .pr__exp { background: var(--brand-soft); color: var(--brand-ink); }
.pr.is-open .pr__exp svg { transform: rotate(180deg); }

.pr__warn { display: grid; gap: 4px; padding: 0 16px 0 52px; }
.pr__warn:empty { display: none; }
.pr__warn p { margin: 0 0 10px; color: var(--bad); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.pr__warn p + p { margin-top: -6px; }
.pr__warn svg { width: 15px; height: 15px; }

.pr__more {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px 18px;
  margin: 0 16px 14px 52px;
  padding: 16px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}
.pr__more > .field:first-child { grid-row: span 2; }
.pr__more > .field:first-child { grid-template-rows: auto 1fr; }
.pr__more > .field:first-child textarea { height: 100%; }
.split-box { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; padding: 12px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--line-strong); }
.split-box .field { align-content: start; }
.split-box .field > span { min-height: 2.9em; }
.split-note { grid-column: 1 / -1; margin: 0; color: var(--brand-ink); font-size: 13px; line-height: 1.6; }
.split-note:empty { display: none; }
.unit-in { position: relative; display: block; }
.unit-in i { position: absolute; right: 12px; top: 50%; translate: 0 -50%; color: var(--faint); font-style: normal; font-size: 13px; pointer-events: none; }
.unit-in input { padding-right: 44px; }
.unit-in--baht i { left: 12px; right: auto; }
.unit-in--baht input { padding-left: 26px; padding-right: 12px; }
.supx { display: grid; justify-items: start; gap: 1px; }
.supx small { color: var(--muted); font-size: 11.5px; white-space: nowrap; padding-left: 4px; }
.pr__tools { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.pr__tools .btn--danger { margin-left: auto; }
.pr__sup-stock { margin-top: 2px; }

.empty-state { display: grid; justify-items: center; gap: 8px; padding: 44px 20px; color: var(--muted); text-align: center; }
.empty-state svg { width: 36px; height: 36px; color: var(--faint); stroke-width: 1.5; }

/* Medium width: 2 lines per product */
@container (max-width: 860px) {
  .ptable__head { display: none; }
  .pr__row {
    grid-template-columns: 24px repeat(4, minmax(0, 1fr)) 104px 34px;
    grid-template-areas:
      "n name name name name stat exp"
      ". cost price cmp prof sup sup";
    row-gap: 8px;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .pr__n { grid-area: n; }
  .pr__name { grid-area: name; }
  .pr__cost { grid-area: cost; }
  .pr__price { grid-area: price; }
  .pr__cmp { grid-area: cmp; }
  .pr__profit { grid-area: prof; text-align: left; align-self: end; padding-bottom: 7px; }
  .pr__sup { grid-area: sup; justify-self: end; align-self: end; padding-bottom: 8px; }
  .pr__switch { grid-area: stat; }
  .pr__exp { grid-area: exp; }
  .money small, .pr__profit small { display: block; padding-left: 2px; margin-bottom: 2px; }
  .money input { border-color: var(--line-strong); background: #fff; }
  .pr__warn { padding-left: 48px; }
  .pr__more { margin-left: 48px; grid-template-columns: 1fr; }
  .pr__more > .field:first-child { grid-row: auto; }
}
/* Phone */
@container (max-width: 520px) {
  .pr__row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "name name"
      "cost price"
      "cmp prof"
      "stat sup"
      "exp exp";
    padding: 14px;
  }
  .pr__n { display: none; }
  .pr__profit { padding-left: 2px; }
  .pr__switch { justify-self: start; }
  .pr__exp { width: 100%; height: 30px; border-radius: 8px; background: var(--bg); }
  .pr__warn { padding: 0 14px; }
  .pr__more { grid-template-columns: 1fr; margin: 0 14px 14px; }
  .pr__more > .field:first-child { grid-row: auto; }
  .split-box { grid-template-columns: 1fr; }
}

/* Preview (collapsible) */
.preview-card > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
  border-radius: var(--radius);
}
.preview-card > summary::-webkit-details-marker { display: none; }
.preview-card > summary > span { display: grid; margin-right: auto; }
.preview-card > summary small { color: var(--muted); font-size: 13px; }
.preview-card .chev { color: var(--muted); transition: transform .2s; }
.preview-card[open] .chev { transform: rotate(180deg); }
.preview {
  margin: 0 20px 20px;
  padding: 20px;
  border-radius: 14px;
  background: #eadcec url("/img/bg/desktop-1280.webp") center / cover;
  isolation: isolate;
  position: relative;
  overflow: hidden;
}
.preview::before { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(255, 255, 255, .3); }

/* ---------- Supplier ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.kpi {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.kpi b { color: var(--ink); font-size: 26px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--faint); font-size: 12px; }
.kpi:hover { transform: translateY(-2px); }
.kpi.is-active { border-color: var(--brand); background: var(--brand-soft); }
.kpi--bad b { color: var(--bad); }
.kpi--warn b { color: var(--warn); }
.kpi--brand b { color: var(--brand-ink); }
.kpi--bad.is-active { border-color: var(--bad); background: var(--bad-soft); }
.kpi--warn.is-active { border-color: var(--warn); background: var(--warn-soft); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.search { position: relative; flex: 1 1 260px; }
.search svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; color: var(--faint); }
.search input { padding-left: 38px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th {
  position: sticky;
  top: 0;
  padding: 10px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}
.table td { padding: 12px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; }
.table td b { font-weight: 600; }
.table td .cat { display: block; color: var(--muted); font-size: 12.5px; }
.table tr.is-out td:not(.num) { color: var(--muted); }
.links { display: flex; gap: 4px; flex-wrap: wrap; }
.table td.price { white-space: nowrap; font-variant-numeric: tabular-nums; }
.table td.price s { font-size: 12.5px; }
.linkbtn { justify-self: start; padding: 0; border: 0; background: none; color: var(--brand-ink); font: inherit; font-size: 12.5px; font-weight: 500; text-decoration: underline; cursor: pointer; }

/* ---------- News ---------- */
.bigswitch { display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); cursor: pointer; font-weight: 600; }
.bigswitch input { position: absolute; opacity: 0; pointer-events: none; }
.bigswitch__track { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--line-strong); transition: background-color .2s; }
.bigswitch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
  transition: transform .2s cubic-bezier(.2, .8, .2, 1);
}
.bigswitch input:checked + .bigswitch__track { background: var(--ok); }
.bigswitch input:checked + .bigswitch__track::after { transform: translateX(18px); }
.bigswitch input:focus-visible + .bigswitch__track { box-shadow: var(--ring); }
.bigswitch:has(input:checked) .bigswitch__label { color: var(--ok); }
.bigswitch__label { color: var(--muted); }

.news-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.news-main { display: grid; gap: 18px; min-width: 0; }
.news-side { position: sticky; top: 24px; display: grid; gap: 10px; }
.news-side__label { color: var(--muted); font-size: 13px; font-weight: 500; text-align: center; }

.step { display: flex; align-items: center; gap: 10px; font-size: 16px; margin: 0 0 12px; }
.step:not(:first-child) { margin-top: 24px; }
.step i {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font: 600 13px "Prompt", sans-serif;
  font-style: normal;
  flex: none;
}
.step i svg { width: 15px; height: 15px; }
.step small { color: var(--muted); font-weight: 400; font-size: 13.5px; }
.step-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.step-head .step { margin: 0; }

.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--bg); }
.seg button { padding: 7px 16px; border: 0; border-radius: 9px; background: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.seg button[aria-checked="true"] { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 4px rgba(42, 45, 92, .1); }

.where { display: grid; gap: 12px; margin-top: 14px; }
.where__note { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-ink); font-size: 14px; }
.where__group { display: grid; gap: 8px; }
.where__group > span { color: var(--muted); font-size: 12.5px; }
.picks { display: flex; flex-wrap: wrap; gap: 6px; }
.pick {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.pick img { width: 20px; height: 20px; border-radius: 50%; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 1.5px solid var(--line-strong);
  background: #fff center / 11px no-repeat;
  flex: none;
}
.pick:hover { border-color: var(--faint); }
.pick:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); font-weight: 500; }
.pick:has(input:checked)::before {
  border-color: var(--brand);
  background-color: var(--brand);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-4.9' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.pick:has(input:focus-visible) { box-shadow: var(--ring); }

.radios { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.radio { position: relative; display: flex; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--line-strong); border-radius: 12px; cursor: pointer; transition: border-color .15s, background-color .15s; }
.radio input { margin: 3px 0 0; accent-color: var(--brand); width: 16px; height: 16px; flex: none; }
.radio span { display: grid; }
.radio b { font-weight: 600; font-size: 14.5px; }
.radio small { color: var(--muted); font-size: 12.5px; }
.radio:hover { border-color: var(--faint); }
.radio:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

.npages { display: grid; gap: 10px; margin-top: 14px; }
.np { border: 1.5px solid var(--line); border-radius: 14px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.np.is-current { border-color: var(--brand); box-shadow: var(--ring); }
.np__head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; }
.np__n { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--bg); color: var(--muted); font-size: 12.5px; flex: none; }
.np.is-current .np__n { background: var(--brand); color: #fff; }
.np__title { flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); font: 600 15.5px "Prompt", sans-serif; }
.np__title:hover, .np__title:placeholder-shown { border-color: var(--line-strong); }
.np__title:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.np__tools { display: flex; }
.np__body { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 14px 14px; }
.np__body .field--wide { grid-column: 1 / -1; }

/* Popup mock (same look as storefront news popup) */
.mock {
  overflow: hidden;
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}
.mock__stage { padding: 18px 14px; background: #eadcec url("/img/bg/mobile-941.webp") center / cover; }
.mock__card { overflow: hidden; border-radius: 20px; background: #fff; box-shadow: 0 14px 34px rgba(42, 30, 90, .28); }
.mock__img { width: 100%; height: auto; max-height: 420px; object-fit: contain; background: var(--bg); }
.mock__body { display: grid; gap: 8px; padding: 16px 16px 14px; }
.mock__title { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.35; }
.mock__text { margin: 0; white-space: pre-line; color: rgba(42, 45, 92, .85); font-size: 13.5px; line-height: 1.65; max-height: 180px; overflow: auto; }
.mock__link { justify-self: start; padding: 6px 14px; border-radius: 999px; background: rgba(42, 45, 92, .07); color: var(--ink); font-size: 13px; font-weight: 600; }
.mock__foot { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.mock__dot { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 999px; background: rgba(42, 45, 92, .22); cursor: pointer; }
.mock__dot.is-on { width: 18px; background: var(--ink); }
.mock__count { margin-right: auto; margin-left: 4px; color: var(--muted); font-size: 12px; }
.mock__btn { padding: 5px 12px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 600; }
.mock__empty { display: grid; place-items: center; gap: 6px; min-height: 240px; padding: 20px; color: var(--muted); font-size: 14px; text-align: center; background: rgba(255, 255, 255, .85); border-radius: 20px; }
.mock__empty svg { width: 32px; height: 32px; color: var(--faint); stroke-width: 1.5; }
.mock.is-off .mock__stage { filter: grayscale(.8); opacity: .65; }
.mock__off { padding: 9px 12px; background: var(--warn-soft); color: var(--warn); font-size: 13px; text-align: center; }

/* ---------- Customers ---------- */
.howto { margin: 0 0 10px; padding-left: 22px; display: grid; gap: 4px; }
.howto li::marker { color: var(--brand); font-weight: 600; }
.reset { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-top: 16px; }
.reset .field { flex: 1; min-width: 220px; }
.reset__out { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: var(--ok-soft); }
.reset__out code {
  padding: 4px 14px;
  border-radius: 8px;
  background: #fff;
  font: 600 22px ui-monospace, Consolas, monospace;
  letter-spacing: .08em;
  user-select: all;
}

/* ---------- Income / expense ---------- */
.view--wide { max-width: 1320px; }
.lg-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.lg-filters .input { min-width: 120px; font-weight: 500; }

.lkpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.lkpi { position: relative; display: grid; gap: 2px; padding: 16px 18px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.lkpi::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--line-strong); }
.lkpi span { color: var(--muted); font-size: 13.5px; }
.lkpi b { font-size: 24px; font-weight: 600; line-height: 1.25; font-variant-numeric: tabular-nums; }
.lkpi small { color: var(--faint); font-size: 12.5px; }
.lkpi small em { color: var(--warn); font-style: normal; }
.lkpi--in::before { background: var(--ok); }
.lkpi--in b { color: var(--ok); }
.lkpi--out::before { background: var(--bad); }
.lkpi--out b { color: var(--bad); }
.lkpi--net::before { background: var(--brand); }
.lkpi--net b { color: var(--brand-ink); }
.lkpi--neg::before { background: var(--bad); }
.lkpi--neg b { color: var(--bad); }
.lkpi--vat::before { background: var(--warn); }
.vatbar { display: block; height: 6px; margin: 4px 0 2px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.vatbar i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.vatbar.is-warn i { background: var(--warn); }

.lg-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.lg-main, .lg-side { display: grid; gap: 18px; min-width: 0; }
.lg-side { position: sticky; top: 24px; }

/* Form */
.lg-form { border-top: 3px solid var(--ok); }
.lg-form[data-type="expense"] { border-top-color: var(--bad); }
.lg-form.is-editing { box-shadow: 0 0 0 2px var(--brand), var(--shadow); border-top-color: var(--brand); }
.lg-form .step-head { margin-bottom: 14px; }
.seg--io button[data-ftype="income"][aria-checked="true"] { background: var(--ok); color: #fff; }
.seg--io button[data-ftype="expense"][aria-checked="true"] { background: var(--bad); color: #fff; }
.lg-sale { display: grid; grid-template-columns: 1fr 96px; gap: 10px 12px; margin-bottom: 14px; padding: 14px; border-radius: 12px; background: var(--ok-soft); }
.lg-withcost { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ok); font-weight: 500; cursor: pointer; }
.lg-withcost input, .lg-evidence input { width: 17px; height: 17px; accent-color: var(--brand); flex: none; margin: 0; }
.lg-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.lg-fields .lg-wide { grid-column: span 2; }
.lg-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.lg-evidence { display: flex; align-items: flex-start; gap: 9px; margin-right: auto; cursor: pointer; }
.lg-evidence input { margin-top: 3px; }
.lg-evidence span { display: grid; font-size: 14px; }
.lg-evidence small { color: var(--muted); font-size: 12.5px; }
.lg-actions .btn--primary { min-width: 120px; }

/* Table */
.lg-count { margin-left: auto; align-self: center; }
.lg-table th, .lg-table td { padding: 10px 10px; }
.lg-table th:first-child, .lg-table td:first-child { padding-left: 18px; }
.lg-table th:last-child, .lg-table td:last-child { padding-right: 12px; }
.lg-table td:nth-child(2) { width: 100%; }
.lg-table .nowrap { white-space: nowrap; }
.lg-table td .sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 2px; color: var(--muted); font-size: 12.5px; }
.lg-table .cat-income { background: var(--ok-soft); color: var(--ok); }
.lg-table .cat-expense { background: var(--bad-soft); color: var(--bad); }
.lg-table .amt-in { color: var(--ok); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lg-table .amt-out { color: var(--bad); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lg-table .acts { white-space: nowrap; text-align: right; width: 76px; }
.lg-table .acts .iconbtn { display: inline-grid; width: 30px; height: 30px; }
.lg-table tr.is-editing td { background: var(--brand-soft); }
.lg-table tfoot td { padding: 12px 20px; background: var(--surface-2); border-top: 1px solid var(--line); font-weight: 500; }
.lg-table tfoot .neg, .mrow__net.neg { color: var(--bad); }

/* Tax */
.lg-allow { margin-bottom: 14px; }
.tax__form { display: grid; gap: 2px; margin-bottom: 12px; padding: 10px 14px; border-radius: 10px; background: var(--brand-soft); }
.tax__form b { color: var(--brand-ink); font-size: 16px; }
.tax__form span { color: var(--muted); font-size: 12.5px; }
.tax__lines { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; margin: 0; font-size: 14px; }
.tax__lines dt { color: var(--ink); }
.tax__lines dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.tax__lines .sub { padding-left: 12px; color: var(--muted); font-size: 13px; }
.tax__lines .dim { color: var(--faint); font-weight: 400; text-decoration: line-through; }
.tax__lines .warn { color: var(--warn); }
.tax__lines .total { padding-top: 8px; border-top: 1px dashed var(--line-strong); font-weight: 600; }
.tax__lines .tax-pick { margin-left: 4px; padding: 0 7px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-size: 11.5px; font-style: normal; font-weight: 600; }
.tax__due { display: flex; align-items: baseline; justify-content: space-between; margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: var(--ink); color: #fff; }
.tax__due span { font-size: 14px; opacity: .8; }
.tax__due b { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tax__note { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

/* Export + profile */
.lg-export { display: grid; gap: 8px; margin-top: 10px; }
.lg-export .btn { justify-content: flex-start; }
.lg-profile-box { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.lg-profile-box summary { cursor: pointer; color: var(--brand-ink); font-size: 14px; font-weight: 500; }
.lg-profile { display: grid; gap: 10px; margin-top: 12px; }
.lg-profile .btn { justify-self: start; }

/* Months */
.mlegend { display: flex; gap: 12px; margin: -4px 0 8px; color: var(--muted); font-size: 12px; }
.mlegend span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 2px; background: var(--line-strong); }
.mlegend .bin::before { background: var(--ok); }
.mlegend .bout::before { background: var(--bad); }
.months { display: grid; gap: 2px; }
.mrow { display: grid; grid-template-columns: 38px 1fr 92px; align-items: center; gap: 10px; padding: 5px 8px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.mrow:hover { background: var(--bg); }
.mrow.is-on { background: var(--brand-soft); }
.mrow.is-empty { color: var(--faint); }
.mrow__bars { display: grid; gap: 2px; }
.mrow__bars i { display: block; height: 5px; min-width: 0; border-radius: 3px; }
.mrow__bars .bin { background: var(--ok); }
.mrow__bars .bout { background: var(--bad); opacity: .75; }
.mrow__net { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }

@media (max-width: 1180px) {
  .lg-grid { grid-template-columns: 1fr; }
  .lg-side { position: static; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
  .lkpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .lg-fields { grid-template-columns: 1fr 1fr; }
  .lg-sale { grid-template-columns: 1fr 80px; }
  .lg-table thead { display: none; }
  .lg-table tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .lg-table td { padding: 0 !important; border: 0 !important; }
  .lg-table td:nth-child(1) { grid-column: 1; color: var(--muted); font-size: 12.5px; }
  .lg-table td:nth-child(2) { grid-column: 1; }
  .lg-table td:nth-child(3) { display: none; }
  .lg-table td:nth-child(4), .lg-table td:nth-child(5) { grid-column: 2; grid-row: 1 / 3; align-self: center; }
  .lg-table td:nth-child(4):empty, .lg-table td:nth-child(5):empty { display: none; }
  .lg-table td.acts { grid-column: 1 / -1; text-align: left; }
  .lg-table tfoot tr { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; }
  .lg-table tfoot td:last-child { display: none; }
}
@media (max-width: 480px) {
  .lkpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .lkpi b { font-size: 19px; }
  .lg-fields { grid-template-columns: 1fr; }
  .lg-fields .lg-wide { grid-column: auto; }
}

/* ---------- Save bar ---------- */
.savebar {
  position: fixed;
  left: calc(50% + var(--side) / 2);
  bottom: 22px;
  z-index: 20;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-pop);
  animation: barIn .25s cubic-bezier(.2, .8, .2, 1);
}
.savebar__dot { width: 8px; height: 8px; border-radius: 50%; background: #ffcf5a; box-shadow: 0 0 0 4px rgba(255, 207, 90, .2); flex: none; }
.savebar__text { margin-right: 8px; font-size: 14px; white-space: nowrap; }
@keyframes barIn { from { opacity: 0; transform: translateY(16px); } }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: calc(50% + var(--side) / 2);
  top: 20px;
  z-index: 30;
  max-width: min(560px, calc(100vw - 32px));
  padding: 11px 18px;
  border-radius: 12px;
  background: var(--ok);
  color: #fff;
  font-size: 14.5px;
  box-shadow: var(--shadow-pop);
  opacity: 0;
  transform: translate(-50%, -12px);
  pointer-events: none;
  transition: opacity .2s, transform .25s cubic-bezier(.2, .8, .2, 1);
}
.toast.is-bad { background: var(--bad); }
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .news-grid { grid-template-columns: 1fr; }
  .news-side { position: static; max-width: 380px; width: 100%; justify-self: center; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* ---------- Orders ---------- */
.oa-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.oa-side { position: sticky; top: 24px; display: grid; gap: 18px; }
.oa-list { display: grid; gap: 14px; min-width: 0; }
.oa { padding: 18px 20px; border-left: 4px solid transparent; }
.oa--review { border-left-color: var(--warn); }
.oa--paid { border-left-color: var(--bad); }
.oa--completed { border-left-color: var(--ok); }
.oa--cancelled { opacity: .7; }
.oa-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.oa-head > div { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.oa-head small { flex-basis: 100%; font-size: 13px; }
.oa-head strong { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.oa-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; margin-top: 12px; }
.oa-main { display: grid; gap: 12px; align-content: start; min-width: 0; }
.oa-items { display: grid; gap: 6px; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--bg); list-style: none; font-size: 14px; }
.oa-items li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; }
.oa-items small { color: var(--muted); }
.oa-items em { padding: 1px 8px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-size: 12px; font-style: normal; font-weight: 600; }
.oa-items em.is-short { background: var(--bad-soft); color: var(--bad); }
.oa-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.oa-warn { flex-basis: 100%; margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }
.oa-manual, .oa-sent { flex-basis: 100%; }
.oa-manual summary, .oa-sent summary { color: var(--brand-ink); font-size: 13.5px; cursor: pointer; }
.oa-manual[open] { display: grid; gap: 8px; }
.oa-manual textarea { width: 100%; margin-top: 8px; font: 13.5px/1.5 ui-monospace, Consolas, monospace; }
.oa-manual .btn { justify-self: start; }
.oa-sent pre, .stk-items pre { margin: 8px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--bg); font: 13px/1.55 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }
.oa-slip { position: relative; display: grid; width: 120px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); overflow: hidden; cursor: zoom-in; align-self: start; }
.oa-slip img { width: 100%; height: 160px; object-fit: cover; object-position: top; }
.oa-slip span { position: absolute; inset: auto 0 0; padding: 4px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; text-align: center; }
.pay-form { display: grid; gap: 12px; margin: 12px 0; }
.pay-form .btn { justify-self: start; }
.dlg-slip { max-width: min(92vw, 560px); max-height: 92vh; padding: 0; border: 0; border-radius: 14px; background: #111; overflow: auto; }
.dlg-slip::backdrop { background: rgba(0, 0, 0, .6); }
.dlg-slip img { display: block; width: 100%; height: auto; }
.dlg-slip form { position: sticky; top: 0; height: 0; display: flex; justify-content: flex-end; }
.dlg-slip__x { margin: 8px; background: rgba(255, 255, 255, .9) !important; }

/* ---------- Settings ---------- */
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.set-col { display: grid; gap: 18px; min-width: 0; }
.set-form { display: grid; gap: 14px; margin-top: 12px; }
.set-form > .btn { justify-self: start; }
.set-sub { display: grid; gap: 10px; padding: 16px 0; border-top: 1px solid var(--line); }
.set-sub:first-of-type { margin-top: 8px; }
.set-sub h3 { margin: 0; font-size: 14px; font-weight: 600; }
.set-switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; cursor: pointer; }
.set-switch span { display: grid; gap: 1px; }
.set-switch b { font-weight: 500; font-size: 14.5px; }
.set-switch small { color: var(--muted); font-size: 12.5px; }
.set-toggle { appearance: none; flex: none; position: relative; width: 42px; height: 24px; margin: 0; border-radius: 999px; background: var(--line-strong); cursor: pointer; transition: background-color .15s; }
.set-toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .18s cubic-bezier(.2, .8, .2, 1); }
.set-toggle:checked { background: var(--ok); }
.set-toggle:checked::after { transform: translateX(18px); }
.set-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.set-notify { display: grid; gap: 12px; margin: 0; padding: 0; border: 0; }
.set-notify legend { margin-bottom: 4px; padding: 0; font-size: 14px; font-weight: 600; }
.set-notify + .set-notify { margin-top: 14px; }
.set-admins { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.set-admins li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--bg); }
.set-admins li span { display: grid; }
.set-admins small { color: var(--muted); font-size: 12px; }
.set-addadmin { display: flex; gap: 8px; margin-top: 10px; }
.set-addadmin .input { flex: 1; min-width: 0; }
.set-admins .tags { display: flex; gap: 4px; margin-top: 3px; }
.set-admins .acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.set-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.set-code { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--brand-soft); }
.set-code[hidden] { display: none; }
.set-code b { font-size: 20px; letter-spacing: .04em; color: var(--brand-ink); }
.set-code code { flex: 1 1 200px; min-width: 0; font-size: 13px; word-break: break-all; }
.set-code small { color: var(--muted); }
.set-integrations { display: grid; gap: 10px; margin: 12px 0; padding: 0; list-style: none; }
.set-integrations li { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 10px; }
.set-integrations li .pill { justify-content: center; }
.set-integrations li span:last-child { display: grid; }
.set-integrations small { color: var(--faint); font-size: 12px; font-family: ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
@media (max-width: 1100px) { .set-grid { grid-template-columns: 1fr; } }

/* ---------- ID stock ---------- */
.stk-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
.stk-left { position: sticky; top: 24px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden; }
.stk-products { overflow: auto; padding: 8px; }
.stk-g h3 { margin: 10px 8px 4px; color: var(--faint); font-size: 12px; font-weight: 600; }
.stk-p { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.stk-p:hover { background: var(--bg); }
.stk-p.is-on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 500; }
.stk-p em { min-width: 28px; padding: 1px 8px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); font-size: 12.5px; font-style: normal; font-weight: 600; text-align: center; }
.stk-p em.is-zero { background: var(--bad-soft); color: var(--bad); }
.stk-right h2 { font-size: 20px; }
.stk-form { display: grid; gap: 10px; margin: 14px 0 20px; }
.stk-form textarea { font: 13.5px/1.55 ui-monospace, Consolas, monospace; }
.stk-form .btn { justify-self: start; }
.stk-h { margin: 0 0 8px; font-size: 15px; }
.stk-items { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.stk-items li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: start; gap: 8px; }
.stk-items pre { margin: 0; }
.stk-acts { display: flex; gap: 2px; }
.stk-edit { display: grid; gap: 6px; min-width: 0; }
.stk-edit textarea { width: 100%; font: 13px/1.55 ui-monospace, Consolas, monospace; resize: vertical; }
.stk-edit span { display: flex; gap: 6px; }
.stk-n { padding-top: 9px; color: var(--faint); font-size: 12.5px; text-align: right; }
.stk-empty { display: block !important; padding: 12px 0; }
@media (max-width: 1180px) {
  .oa-grid { grid-template-columns: 1fr; }
  .oa-side { position: static; }
}
@media (max-width: 760px) {
  .stk-grid { grid-template-columns: 1fr; }
  .stk-left { position: static; max-height: 320px; }
  .oa-body { grid-template-columns: 1fr; }
  .oa-slip { width: 100%; }
  .oa-slip img { height: 200px; }
}

@media (max-width: 900px) {
  :root { --side: 0px; }
  .shell { display: block; }
  .content { padding: 18px 14px 150px; }
  .page-head h1 { font-size: 22px; }
  .savebar { bottom: calc(84px + env(safe-area-inset-bottom)); width: calc(100% - 24px); }
  .savebar__text { margin-right: auto; }
  .card--pad { padding: 18px 16px; }
  .card__head { padding: 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi:first-child { grid-column: 1 / -1; }
  .radios { grid-template-columns: 1fr; }
  .np__body { grid-template-columns: 1fr; }
  .table th, .table td { padding-left: 14px; padding-right: 14px; }
  .appbar { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px; padding: 2px 14px 6px; scrollbar-width: none; }
  .appbar::-webkit-scrollbar { display: none; }
  .chip-app { flex: none; }
}
@media (max-width: 560px) {
  .page-head p { font-size: 13px; }
  .cur { width: 100%; }
  #btn-add { flex: 1; }
  .table thead { display: none; }
  .table tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table td { padding: 0; border: 0; }
  .table td:nth-child(4) { grid-row: 1 / 3; grid-column: 2; align-self: center; }
  .table td:nth-child(2) { color: var(--muted); font-size: 13.5px; }
  .table td:nth-child(3) { grid-column: 1; text-align: left; }
  .table td:nth-child(5) { grid-column: 1 / -1; }
  .table td:nth-child(5):has(.muted) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- หน้าเว็บ (shop content editor) ---------- */
.si-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.si-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 16px; }
.si-tab { padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.si-tab:hover { color: var(--ink); border-color: var(--brand); }
.si-tab.is-on { background: var(--brand); border-color: transparent; color: #fff; }
.si-tab:focus-visible { outline: none; box-shadow: var(--ring); }
/* cards of different heights: flow down 2 columns (no gaps under short cards) */
.si-body { columns: 2 460px; column-gap: 18px; }
.si-body > * { break-inside: avoid; margin: 0 0 18px; }
.si-body .step small { margin-left: 4px; }
.si-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.si-color__row { display: flex; align-items: center; gap: 10px; }
.si-color input[type="color"] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.si-color code { color: var(--muted); font-size: 13px; }
.si-media__row { display: flex; gap: 12px; align-items: flex-start; }
.si-media__prev { flex: none; display: grid; place-items: center; width: 168px; aspect-ratio: 2033 / 774; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2) repeating-conic-gradient(#f0eef6 0 25%, transparent 0 50%) 0 0 / 16px 16px; }
.si-media--logo .si-media__prev, .si-media--icon .si-media__prev { width: 72px; aspect-ratio: 1; }
.si-media--share .si-media__prev { aspect-ratio: 1200 / 630; }
.si-media__prev :is(img, video) { width: 100%; height: 100%; object-fit: cover; }
.si-media--logo .si-media__prev img { object-fit: contain; }
.si-media__none { color: var(--faint); font-size: 12.5px; }
.si-media__ctl { flex: 1; display: grid; gap: 8px; min-width: 0; }
.si-media__btns { display: flex; gap: 6px; flex-wrap: wrap; }
.si-rows { display: grid; gap: 8px; }
.si-rows > .btn { justify-self: start; }
.si-row { display: flex; gap: 8px; align-items: flex-end; }
.si-row > .input, .si-row > .field { flex: 1; min-width: 0; }
.si-move { display: flex; gap: 2px; flex: none; }
.si-move .iconbtn { width: 32px; height: 36px; font-size: 14px; }
.si-move .iconbtn:disabled { opacity: .35; }
.si-del:hover { color: var(--bad); }
.si-slide { display: grid; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.si-slide:first-child { padding-top: 0; }
.si-apps-wrap { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(220px, 280px) 1fr; gap: 18px; align-items: start; }
.si-apps { display: grid; gap: 6px; }
.si-apps > .btn { justify-self: start; margin-top: 6px; }
.si-app { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid transparent; border-radius: var(--radius-sm); background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.si-app img { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; box-shadow: 0 0 0 2px color-mix(in srgb, var(--app) 40%, transparent); }
.si-app span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.si-app em { padding: 1px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: 11.5px; font-style: normal; }
.si-app:hover { background: var(--surface-2); }
.si-app.is-on { border-color: var(--brand); background: var(--brand-soft); }
.si-app.is-hidden img { opacity: .45; filter: grayscale(1); }
.si-app-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.si-app-head b { font-size: 17px; }
.si-legal { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 18px; align-items: start; }
.si-legal textarea { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.si-help code { padding: 1px 5px; border-radius: 5px; background: var(--surface-2); }
.si-preview { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.si-doc { font-size: 14.5px; line-height: 1.7; }
.si-doc h1 { font-size: 22px; margin: 0 0 4px; }
.si-doc h2 { font-size: 16px; margin: 18px 0 6px; }
.si-doc p, .si-doc ul { margin: 0 0 10px; }
.si-doc a { color: var(--brand-ink); }
.si-doc [lang="en"] { color: var(--muted); }
.si-serp { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font-family: Arial, sans-serif; }
.si-serp small { color: #4d5156; font-size: 12px; }
.si-serp b { overflow: hidden; color: #1a0dab; font-size: 18px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.si-serp span { display: -webkit-box; overflow: hidden; color: #4d5156; font-size: 13.5px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
@media (max-width: 860px) {
  .si-apps-wrap { grid-template-columns: 1fr; }
  .si-apps { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .si-media__row { flex-direction: column; }
  .si-two { grid-template-columns: 1fr; }
  .si-preview { position: static; max-height: none; }
}
button.si-media__prev { padding: 0; cursor: pointer; font: inherit; }
button.si-media__prev:hover { border-color: var(--brand); }
button.si-media__prev:focus-visible { outline: none; box-shadow: var(--ring); }
.si-media__ctl > small { font-size: 12.5px; }
.si-media__link summary { width: fit-content; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.si-media__link[open] summary { margin-bottom: 6px; }
.si-media--news .si-media__prev { width: 120px; aspect-ratio: 4 / 3; }
.si-tab { display: inline-flex; align-items: center; gap: 7px; }
.si-tab i { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-style: normal; font-weight: 600; }
.si-tab.is-on i { background: rgba(255, 255, 255, .25); color: #fff; }
.si-tabs__desc { flex-basis: 100%; margin: 4px 2px 0; color: var(--muted); font-size: 13.5px; }

/* ---------- ซื้อจากร้านต้นทาง ---------- */
/* wallet on top, bought list below (list grows down, no inner scroll) */
.buy-top { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; margin: 0 0 18px; }
.buy-card .step { margin-bottom: 10px; }
.buy-bal { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--brand-soft); }
.buy-bal span { color: var(--muted); font-size: 14px; }
.buy-bal b { font-size: 26px; color: var(--brand-ink); }
.buy-bank { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: 10px; font-size: 14px; }
.buy-bank span { flex-basis: 100%; color: var(--muted); }
.buy-bank b { font-size: 17px; letter-spacing: .5px; }
.buy-topup { display: grid; gap: 6px; margin-top: 14px; }
.buy-topup .btn { justify-self: start; }
.buy-hist { margin-top: 12px; font-size: 14px; }
.buy-hist summary { color: var(--muted); cursor: pointer; }
.buy-hist ul { display: grid; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.buy-hist li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.buy-hist li > span:first-child { color: var(--muted); min-width: 140px; }
.buy-err { margin: 6px 0 0; color: var(--bad); font-size: 13.5px; }
.buy-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.buy-list li { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.buy-list__head { display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; }
.buy-list__head span { flex: none; color: var(--muted); }
.buy-list__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; color: var(--muted); font-size: 13px; }
.buy-secrets { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: 13px; white-space: pre-wrap; word-break: break-all; user-select: all; }
.dlg-buy { width: min(92vw, 460px); padding: 22px 24px; border: 0; border-radius: var(--radius); box-shadow: var(--shadow-pop); color: var(--ink); }
.dlg-buy::backdrop { background: rgba(20, 20, 40, .45); }
.dlg-buy[open] { display: grid; gap: 12px; }
.dlg-buy h2 { margin: 0; font-size: 19px; }
.dlg-buy__x { position: absolute; top: 12px; right: 12px; }
.dlg-buy__name { margin: -6px 0 0; color: var(--muted); }
.dlg-buy__facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.dlg-buy__facts div { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.dlg-buy__facts dt { color: var(--muted); font-size: 12.5px; }
.dlg-buy__facts dd { margin: 2px 0 0; font-weight: 600; font-size: 16px; }
.dlg-buy__sum dd { color: var(--brand-ink); font-size: 19px; }
.buy-confirm { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.buy-confirm input { margin-top: 3px; }
.dlg-buy > .btn { justify-self: stretch; padding: 11px; }
.buy-item { display: grid; gap: 6px; padding-top: 8px; border-top: 1px dashed var(--line); }
.buy-item__row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.buy-imp { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.buy-imp select { max-width: 260px; padding: 5px 30px 5px 10px; font-size: 13px; }
.buy-fix summary { color: var(--muted); font-size: 12.5px; cursor: pointer; }
.buy-fix[open] summary { margin-bottom: 6px; }
.stk-move { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.stk-move__all { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; }
.stk-move select { max-width: 280px; padding: 5px 30px 5px 10px; font-size: 13.5px; }
label.stk-n { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }

/* หน้าเว็บ > หนังแนะนำ: poster on the left, fields on the right */
.si-media--poster .si-media__prev { width: 96px; aspect-ratio: 2 / 3; }
.si-movie__row { display: grid; grid-template-columns: minmax(0, 260px) 1fr; gap: 16px; align-items: start; }
.si-movie__fields { display: grid; gap: 10px; min-width: 0; }
@media (max-width: 760px) { .si-movie__row { grid-template-columns: 1fr; } }


/* ---------- Rewards (สะสมแต้ม) ---------- */
.rwa-body { display: grid; gap: 16px; }
.rwa-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.rwa-kpis .kpi { cursor: default; }
.rwa-kpis button.kpi { cursor: pointer; }
.rwa-row { display: grid; gap: 12px; }
.rwa-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rwa-head h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; }
.rwa-acts { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.rwa-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.rwa-grid[hidden] { display: none; }
.rwa-prize { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; padding: 12px; border-radius: var(--radius-sm); background: var(--brand-soft); }
.rwa-inner { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.rwa-sub { margin: 6px 0 0; font-size: 14px; }
.rwa-dot { display: inline-block; width: 14px; height: 14px; border-radius: 4px; }
.rwa-color { height: 40px; padding: 4px; }
.rwa-img { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rwa-img img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.rwa-wheel { width: min(100%, 220px); aspect-ratio: 1; margin: 0 auto; border-radius: 50%; box-shadow: 0 0 0 6px #fff, 0 0 0 8px var(--line-strong); }
.linkish { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.linkish:hover b { text-decoration: underline; }
@media (max-width: 900px) { .rwa-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
img.rwa-wheel { display: block; object-fit: cover; }
.rwa-preview { position: relative; width: min(100%, 240px); margin: 14px auto 0; }
.rwa-preview .rwa-wheel { width: 100%; }
.rwa-preview__pin { position: absolute; z-index: 1; top: -18px; left: 50%; width: 22%; max-height: 30%; object-fit: contain; transform: translateX(-50%); }
.rwa-preview__center { position: absolute; z-index: 1; top: 50%; left: 50%; width: 22%; aspect-ratio: 1; border-radius: 50%; object-fit: contain; transform: translate(-50%, -50%); }
.mock__hide { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; text-decoration: underline; text-align: center; }
.news-hide-sw { margin-top: 16px; }

/* ---------- LINE auto reply ---------- */
.ar-warn { margin-bottom: 16px; }
.ar-msgs { display: grid; gap: 10px; }
.ar-msg { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.ar-msg header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ar-msg header select { width: auto; padding-block: 5px; }
.ar-msg header .rwa-acts { margin-left: auto; }
.ar-msgs > .btn { justify-self: start; }
.ar-rules-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ar-rules-head h2 { margin: 0; font-size: 17px; }
.ar-rules-head small { font-size: 12.5px; font-weight: 400; }
.ar-rule { overflow: hidden; }
.ar-rule.is-off { opacity: .65; }
.ar-rule__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; cursor: pointer; }
.ar-rule__title { display: grid; gap: 4px; min-width: 0; }
.ar-rule__title small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-rule__title code { padding: 1px 6px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-ink); font-size: 12px; }
.ar-rule__side { display: flex; align-items: center; gap: 8px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.ar-rule__body { display: grid; gap: 12px; padding: 0 18px 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.ar-rule__foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.ar-rule__foot .set-switch { flex: 1; }
.ar-test { position: sticky; top: 16px; z-index: 2; }
.ar-test__form { display: flex; gap: 8px; margin: 10px 0; }
.ar-test__form .input { flex: 1; min-width: 0; }
.ar-chat { display: flex; flex-direction: column; gap: 6px; max-height: 360px; min-height: 80px; overflow: auto; padding: 12px; border-radius: var(--radius-sm); background: #8cabd9; }
.ar-b { max-width: 82%; padding: 8px 12px; border-radius: 16px; background: #fff; color: #111; font-size: 14px; white-space: pre-line; overflow-wrap: anywhere; }
.ar-b--me { align-self: flex-end; background: #06c755; color: #fff; }
.ar-b--bot { align-self: flex-start; }
.ar-b img { display: block; max-width: 100%; max-height: 200px; margin-bottom: 6px; border-radius: 10px; }
.ar-b__btn { display: block; margin-top: 8px; padding: 6px; border-top: 1px solid #e5e5e5; color: #2a6fdb; text-align: center; font-weight: 600; }
.ar-sys { align-self: center; padding: 2px 10px; border-radius: 999px; background: rgba(0, 0, 0, .18); color: #fff; font-size: 11.5px; }
.si-media--bg .si-media__prev { width: 168px; aspect-ratio: 16 / 10; }

.ord-search { display: flex; margin: 12px 0 4px; }
.ord-search input { flex: 1; }
code.mno { padding: 0 6px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-ink); font-size: 12px; }
/* LINE auto reply: all message types */
.ar-mono { font: 12.5px/1.5 ui-monospace, Consolas, monospace; }
.ar-acts { display: grid; gap: 8px; padding: 10px; border-radius: var(--radius-sm); background: var(--surface); border: 1px dashed var(--line-strong); }
.ar-acts__h { font-size: 13px; }
.ar-acts > .btn { justify-self: start; }
.ar-act { display: grid; grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 6px; align-items: center; }
@media (max-width: 760px) { .ar-act { grid-template-columns: 1fr 1fr; } }
.ar-col { display: grid; gap: 10px; padding: 10px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }
.ar-col header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ar-quick summary { cursor: pointer; font-size: 14px; font-weight: 600; }
.ar-quick[open] summary { margin-bottom: 8px; }
.rwa-img video, .rwa-img audio { max-width: 220px; max-height: 120px; border-radius: 10px; }
.ar-sticker { width: 96px; height: 96px; object-fit: contain; }
.ar-imap { position: relative; max-width: 280px; border-radius: 10px; overflow: hidden; }
.ar-imap img { display: block; width: 100%; }
.ar-imap__grid { position: absolute; inset: 0; display: grid; }
.ar-imap__grid span { display: grid; place-items: center; border: 1px dashed rgba(255, 255, 255, .9); background: rgba(0, 0, 0, .18); color: #fff; font-weight: 700; }
.ar-imap--full .ar-imap__grid { grid-template: 1fr / 1fr; }
.ar-imap--lr .ar-imap__grid { grid-template: 1fr / 1fr 1fr; }
.ar-imap--tb .ar-imap__grid { grid-template: 1fr 1fr / 1fr; }
.ar-imap--cols3 .ar-imap__grid { grid-template: 1fr / 1fr 1fr 1fr; }
.ar-imap--grid4 .ar-imap__grid { grid-template: 1fr 1fr / 1fr 1fr; }
.ar-b--plain { padding: 0; background: none; }
.ar-b__tag { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; }
.ar-b__row { display: flex; gap: 6px; }
.ar-b__row .ar-b__btn { flex: 1; }
.ar-cards { display: flex; gap: 6px; max-width: 100%; overflow-x: auto; }
.ar-cards .ar-b { flex: none; width: 170px; }
.ar-quickrow { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; }
.ar-quickrow span { padding: 4px 12px; border-radius: 999px; background: #fff; border: 1px solid #06c755; color: #06c755; font-size: 13px; }
/* ---------- Flex Message builder ---------- */
.ar-flex { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 12px; align-items: start; }
.ar-flex__prev { max-height: 360px; overflow: auto; padding: 10px; border-radius: 10px; background: #8cabd9; }
.ar-b--flex { max-width: 100%; overflow-x: auto; }
.fx-dlg { width: min(1400px, calc(100vw - 24px)); height: calc(100dvh - 24px); max-height: none; padding: 0; border: 0; border-radius: 16px; }
.fx-dlg[open] { display: flex; flex-direction: column; }
.fx-dlg::backdrop { background: rgba(20, 20, 40, .5); }
.fx-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.fx-tabs { display: flex; gap: 6px; }
.fx-tpl { display: flex; gap: 6px; }
.fx-tpl select { width: auto; }
.fx-head__end { display: flex; gap: 8px; margin-left: auto; }
.fx-body { flex: 1; min-height: 0; }
.fx-cols { display: grid; grid-template-columns: 280px minmax(0, 1fr) 320px; height: 100%; }
.fx-tree, .fx-props { overflow: auto; padding: 12px; border-right: 1px solid var(--line); }
.fx-props { border-right: 0; border-left: 1px solid var(--line); display: grid; align-content: start; gap: 10px; }
.fx-props h3 { margin: 0; font-size: 15px; text-transform: capitalize; }
.fx-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.fx-addsel { display: grid; gap: 4px; width: 100%; font-size: 12.5px; color: var(--muted); }
.fx-treelist, .fx-treelist ul { margin: 0; padding: 0 0 0 14px; list-style: none; }
.fx-treelist { padding: 0; }
.fx-node { display: block; width: 100%; margin: 1px 0; padding: 4px 8px; border: 0; border-radius: 6px; background: none; color: var(--ink); font: 13px ui-monospace, Consolas, monospace; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-node:hover { background: var(--surface-2); }
.fx-node.is-sel { background: var(--brand); color: #fff; }
.fx-preview { overflow: auto; padding: 24px; background: #8cabd9; display: flex; justify-content: center; align-items: flex-start; }
.fx-color { display: flex; gap: 6px; }
.fx-color input[type="color"] { flex: none; width: 40px; height: 38px; padding: 2px; }
.fx-bool { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.fx-actf { display: grid; gap: 6px; }
.fx-json { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 12px; height: 100%; padding: 12px; }
.fx-json textarea { height: 100%; font: 12.5px/1.5 ui-monospace, Consolas, monospace; resize: none; }
.fx-err { color: var(--bad); font-size: 13px; }
/* preview: looks like a LINE bubble */
.fx-carousel { display: flex; gap: 8px; align-items: flex-start; }
.fx-bubble { flex: none; display: flex; flex-direction: column; overflow: hidden; border-radius: 17px; background: #fff; color: #111; font-family: "Helvetica Neue", "Noto Sans Thai", sans-serif; line-height: 1.35; box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.fx-sec { display: flex; flex-direction: column; }
.fx-sec > .fx-box { flex: 1 1 auto; }
.fx-img { position: relative; overflow: hidden; }
.fx-img img { width: 100%; height: 100%; display: block; }
.fx-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 34px; text-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.fx-btn { display: grid; place-items: center; border-radius: 8px; font-size: 16px; font-weight: 600; padding: 0 12px; }
.fx-fill { min-width: 0; min-height: 0; }
.fx-empty { padding: 30px 16px; color: #999; font-size: 13px; text-align: center; }
.fx-preview .fx-sel { outline: 2px solid #ff4d6d; outline-offset: -1px; }
.fx-preview [data-fp] { cursor: pointer; }
@media (max-width: 1100px) { .fx-cols { grid-template-columns: 220px minmax(0, 1fr); } .fx-props { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); } }

/* type picker tiles, sticker / LINE emoji pickers */
.ar-kindchip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.ar-kindchip small { color: var(--muted); font-weight: 400; }
.ar-kindchip:hover, .ar-kindchip[aria-expanded="true"] { border-color: var(--brand); background: var(--brand-soft); }
.ar-kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.ar-kind { display: grid; justify-items: center; gap: 2px; padding: 10px 6px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; text-align: center; cursor: pointer; }
.ar-kind i { font-size: 24px; font-style: normal; line-height: 1.2; }
.ar-kind b { font-size: 13.5px; }
.ar-kind small { color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.ar-kind:hover { border-color: var(--brand); }
.ar-kind.is-on { border-color: var(--brand); background: var(--brand-soft); }
.ar-picker { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.ar-picker__tabs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.ar-ptab { flex: none; width: 46px; height: 46px; padding: 3px; border: 2px solid transparent; border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.ar-ptab--emo { width: 38px; height: 38px; }
.ar-ptab img { width: 100%; height: 100%; object-fit: contain; }
.ar-ptab.is-on { border-color: var(--brand); background: var(--brand-soft); }
.ar-picker__name { margin: 0; font-size: 13.5px; font-weight: 600; }
.ar-picker__grid { display: grid; gap: 4px; max-height: 300px; overflow: auto; }
.ar-picker__grid--st { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.ar-picker__grid--emo { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); }
.ar-pick { aspect-ratio: 1; padding: 4px; border: 2px solid transparent; border-radius: 10px; background: none; cursor: pointer; }
.ar-pick:hover { background: var(--surface-2); }
.ar-pick.is-on { border-color: var(--brand); background: var(--brand-soft); }
.ar-pick img { width: 100%; height: 100%; object-fit: contain; }
.ar-emobar { display: flex; align-items: center; gap: 8px; }
.ar-emoprev { padding: 8px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--line); white-space: pre-line; font-size: 14px; }
.ar-emo { width: 1.4em; height: 1.4em; vertical-align: -.3em; object-fit: contain; }
/* live chat preview under each message set */
.ar-live { display: grid; gap: 6px; }
.ar-live__h { font-size: 14px; }
.ar-live__h small { font-weight: 400; font-size: 12px; }
.ar-chat--live { max-height: 420px; min-height: 60px; }
.ar-live__oa { align-self: flex-start; color: #fff; font-size: 11.5px; opacity: .9; }
.ar-b--todo { background: rgba(255, 255, 255, .6); color: #666; font-style: italic; }

.ar-act { grid-template-columns: 210px minmax(0, 1fr) minmax(0, 1.4fr) auto; }
.ar-act__wide { grid-column: 2 / -1; }
@media (max-width: 760px) { .ar-act__wide { grid-column: 1 / -1; } }

/* ---------- LINE page tabs: inbox, broadcasts, rich menu, settings ---------- */
.lb-tabs { margin-top: 0; }
.lb-tabs .si-tab i { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11.5px; font-style: normal; font-weight: 700; }
.lb-inbox { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: min(78vh, 760px); overflow: hidden; }
.lb-list { overflow: auto; border-right: 1px solid var(--line); padding: 10px; display: grid; align-content: start; gap: 4px; }
.lb-list form { margin-bottom: 6px; }
.lb-chat { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px; border: 0; border-radius: 10px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.lb-chat:hover { background: var(--surface-2); }
.lb-chat.is-on { background: var(--brand-soft); }
.lb-chat img, .lb-ava { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.lb-ava { display: grid; place-items: center; background: #06c755; color: #fff; font-weight: 700; }
.lb-chat__txt { display: grid; min-width: 0; }
.lb-chat__txt b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-chat__txt small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-chat__side { display: grid; justify-items: end; gap: 2px; font-size: 11.5px; color: var(--faint); }
.lb-chat__side em { min-width: 20px; padding: 0 6px; border-radius: 999px; background: #06c755; color: #fff; font-style: normal; font-weight: 700; text-align: center; }
.lb-chat__side .bad { color: var(--bad); }
.lb-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 10px; gap: 8px; }
.lb-thread__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lb-pause { display: flex; gap: 6px; margin-left: auto; align-items: center; }
.lb-msgs { flex: 1; max-height: none; }
.lb-bot { background: #e9fbe9; color: #111; }
.ar-b--me.lb-bot { background: #e9fbe9; color: #111; }
.lb-time { display: block; margin-top: 4px; opacity: .6; font-size: 11px; }
.lb-reply { display: flex; gap: 8px; }
.lb-reply textarea { flex: 1; resize: none; }
.lb-empty { padding: 30px; text-align: center; }
.lb-days { display: grid; gap: 6px; }
.lb-day { display: grid; grid-template-columns: auto 90px 1fr auto 1fr; gap: 8px; align-items: center; font-size: 14px; }
.lb-day .input { padding-block: 6px; }
.lb-aud { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.lb-audopt { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; padding: 10px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.lb-audopt input { grid-row: span 2; margin-top: 3px; }
.lb-audopt small { color: var(--muted); font-size: 12px; }
.lb-audopt.is-on { border-color: var(--brand); background: var(--brand-soft); }
.lb-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.lb-rl { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.lb-rlopt { display: grid; gap: 6px; justify-items: center; padding: 8px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); font: inherit; cursor: pointer; }
.lb-rlopt.is-on { border-color: var(--brand); background: var(--brand-soft); }
.lb-rlopt small { font-size: 12px; color: var(--muted); }
.lb-rlgrid { display: grid; width: 90px; gap: 2px; }
.lb-rlgrid--full { aspect-ratio: 2500 / 1686; }
.lb-rlgrid--half { aspect-ratio: 2500 / 843; }
.lb-rlgrid i { display: grid; place-items: center; background: #cfd6ff; color: #334; font-size: 11px; font-style: normal; font-weight: 700; border-radius: 3px; }
.lb-rlgrid--6 { grid-template: 1fr 1fr / 1fr 1fr 1fr; }
.lb-rlgrid--4 { grid-template: 1fr 1fr / 1fr 1fr; }
.lb-rlgrid--3, .lb-rlgrid--h3 { grid-template: 1fr / 1fr 1fr 1fr; }
.lb-rlgrid--2, .lb-rlgrid--h2 { grid-template: 1fr / 1fr 1fr; }
.lb-rlgrid--1, .lb-rlgrid--h1 { grid-template: 1fr / 1fr; }
.lb-rlgrid--1\+2 { grid-template: 1fr 1fr / 1fr 1fr; }
.lb-rlgrid--1\+2 i:first-child { grid-column: 1 / -1; }
.lb-rmprev { display: grid; max-width: 420px; margin: 0 auto; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.lb-rmimg { position: relative; }
.lb-rmimg img { display: block; width: 100%; }
.lb-rlgrid--over { position: absolute; inset: 0; width: auto; gap: 0; aspect-ratio: auto; }
.lb-rlgrid--over i { background: rgba(0, 0, 0, .22); color: #fff; border: 1px dashed rgba(255, 255, 255, .8); border-radius: 0; display: grid; align-content: center; gap: 2px; font-size: 16px; }
.lb-rlgrid--over small { font-size: 11px; font-weight: 600; }
.lb-rmbar { padding: 8px; background: #fff; text-align: center; font-size: 13px; font-weight: 600; border-top: 1px solid var(--line); }
@media (max-width: 900px) { .lb-inbox { grid-template-columns: 1fr; height: auto; } .lb-list { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--line); } .lb-msgs { min-height: 300px; } }

/* ---------- rich menu designer ---------- */
.rd { display: grid; grid-template-columns: 250px minmax(0, 1fr) 330px; gap: 14px; align-items: start; }
.rd-list { display: grid; gap: 6px; padding: 12px; }
.rd-list__head { display: flex; justify-content: space-between; align-items: center; }
.rd-item { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px; border: 1.5px solid transparent; border-radius: 10px; background: var(--surface-2); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.rd-item.is-on { border-color: var(--brand); background: var(--brand-soft); }
.rd-item img, .rd-noimg { width: 70px; aspect-ratio: 2500 / 1686; object-fit: cover; border-radius: 6px; background: #ddd; display: grid; place-items: center; font-size: 10px; color: var(--muted); }
.rd-item span { display: grid; min-width: 0; }
.rd-item b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-item small { color: var(--muted); font-size: 11.5px; }
.rd-main { display: grid; gap: 10px; }
.rd-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rd-tools select { width: auto; margin-left: auto; }
.rd-canvas { position: relative; width: 100%; border-radius: 10px 10px 0 0; overflow: hidden; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 20px 20px; cursor: crosshair; touch-action: none; user-select: none; }
.rd-canvas img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.rd-hint { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.rd-area { position: absolute; display: grid; place-content: center; justify-items: center; gap: 2px; border: 2px dashed rgba(255, 255, 255, .95); background: rgba(6, 199, 85, .22); color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); cursor: move; overflow: hidden; }
.rd-area.is-on { border-style: solid; border-color: #ff4d6d; background: rgba(255, 77, 109, .25); z-index: 2; }
.rd-area b { font-size: 18px; }
.rd-area small { font-size: 11px; font-weight: 600; text-align: center; padding: 0 4px; }
.rd-h { position: absolute; right: 0; bottom: 0; width: 14px; height: 14px; background: #fff; border: 2px solid #ff4d6d; cursor: nwse-resize; }
.rd-bar { padding: 8px; margin-top: -10px; border-radius: 0 0 10px 10px; background: #fff; border: 1px solid var(--line); text-align: center; font-size: 13px; font-weight: 600; }
.rd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rd-chip { padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); font: inherit; font-size: 12.5px; cursor: pointer; }
.rd-chip.is-on { border-color: #ff4d6d; background: #ffe8ee; }
.rd-json pre { max-height: 260px; overflow: auto; padding: 10px; border-radius: 8px; background: #23262f; color: #e7e9f0; font-size: 12px; }
.rd-props { display: grid; gap: 14px; }
.rd-xywh { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ar-actf2 { display: grid; gap: 6px; }
.rd-rules { margin-top: 14px; }
.rd-rule { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.rd-rule select { width: auto; }
.rd-num { width: 90px; }
@media (max-width: 1200px) { .rd { grid-template-columns: 220px minmax(0, 1fr); } .rd-props { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; } }
@media (max-width: 800px) { .rd { grid-template-columns: 1fr; } .rd-props { grid-template-columns: 1fr; } }
.rd-area.is-blocked { border-color: var(--bad); background: rgba(209, 42, 67, .35); }

/* ===== เงินเข้า (bank messages) ===== */
.bk-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bk-kpi-match { cursor: default; }
.bk-kpi-match:hover { transform: none; }
.kpi--ok b { color: var(--ok); }
.kpi--ok.is-active { border-color: var(--ok); background: var(--ok-soft); }
.bk-bar { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.bk-src { flex: 0 0 160px; }
.bk--in { border-left-color: var(--ok); }
.bk--out { border-left-color: var(--bad); }
.bk.is-new { box-shadow: 0 0 0 2px var(--ok-soft); }
.bk-amt { font-variant-numeric: tabular-nums; }
.bk--in .bk-amt { color: var(--ok); }
.bk--out .bk-amt { color: var(--bad); }
.bk-text { margin: 10px 0; padding: 10px 12px; border-radius: 10px; background: var(--bg); font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; max-height: 9.5em; overflow: auto; }
.bk-del { margin-left: auto; }
.bk-code code { word-break: break-all; font-size: 12px; }
#bk-try { width: 100%; }
.oa-bank { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-size: 13px; font-weight: 500; }
@media (max-width: 700px) { .bk-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* LINE program on the PC (QR login from admin) */
.bk-login { display: grid; justify-items: center; gap: 8px; margin: 12px 0; padding: 14px; border-radius: 12px; background: var(--bg); text-align: center; }
.bk-login img { width: 220px; height: 220px; border-radius: 8px; background: #fff; image-rendering: pixelated; }
.bk-login b.pin { font-size: 34px; letter-spacing: .2em; color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.bk-login .bad { color: var(--bad); }
.bk-adv summary { cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.bk-adv[open] summary { margin-bottom: 8px; }
.bk-chatlist { display: grid; gap: 10px; margin: 10px 0; }
.bk-picker { margin-top: 10px; display: grid; gap: 8px; }
.bk-pick-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; max-height: 320px; overflow: auto; }
.bk-pick-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 8px; border-radius: 8px; background: var(--bg); }
.bk-pick-list li span { display: grid; min-width: 0; }
.bk-pick-list li b { font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-pick-list small { color: var(--muted); font-size: 12px; }
.bk-tmnform { display: flex; gap: 8px; margin-top: 8px; }
.bk-tmnform .input { flex: 1; min-width: 0; }
.bk-tmnbox h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bk-pane[hidden] { display: none !important; }
.bk-tabdot { display: inline-block; width: 8px; height: 8px; margin-left: 4px; border-radius: 50%; background: var(--bad); vertical-align: middle; }
.bk-tabdot[hidden] { display: none; }
.bk-sugg { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.bk-sugg small { flex-basis: 100%; }
.bk-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.bk-kinds .si-tab { padding: 5px 11px; font-size: 13px; }
.bk-pick-list label { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }
.bk-pick-list input { width: 18px; height: 18px; flex: none; accent-color: var(--brand); }
.bk-tmnline { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.bk-tmnline h3 { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14.5px; }
.bk-tmnline h3 small { font-weight: 400; font-size: 12.5px; }
.bk-tmnline .bk-tmnform { margin-top: 0; }
.bk-apk { display: flex; gap: 14px; align-items: center; margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--bg); }
.bk-apk__qr { flex: none; width: 120px; height: 120px; background: #fff; border-radius: 8px; }
.bk-apk__qr:empty { display: none; }
.bk-apk__qr svg { width: 100%; height: 100%; display: block; }
.bk-apk__info { display: grid; gap: 6px; justify-items: start; }
.bk-apk__info small { font-size: 12.5px; }
.oa-items em.oa-kind { background: var(--brand-soft); color: var(--brand-ink); }

/* =========================================================
   Redesign layer: storefront look + grouped navigation + home
   ========================================================= */
body {
  background:
    radial-gradient(900px 520px at 0% 0%, #efe6ff 0%, transparent 70%),
    radial-gradient(800px 480px at 100% 0%, #ffe8f3 0%, transparent 70%),
    radial-gradient(900px 600px at 50% 100%, #e7f0ff 0%, transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* pill buttons + inputs, like the shop */
.btn { border-radius: 999px; padding: 9px 18px; }
.btn--sm { padding: 6px 14px; }
.btn--primary { background: var(--ink); box-shadow: 0 6px 16px rgba(42, 45, 92, .22); }
.btn--primary:hover:not(:disabled) { background: #3b3f7a; }
.iconbtn { border-radius: 999px; }
.input, .field input, .field textarea, .field select, .search input { border-radius: 12px; background: #fff; }
.field textarea { border-radius: 14px; }

/* cards: borderless, soft shadow, bigger corners */
.card { border-radius: var(--radius); box-shadow: var(--shadow); }
.kpi { border-radius: 18px; }
.kpi.is-active, .kpi--bad.is-active, .kpi--warn.is-active, .kpi--ok.is-active { border-color: var(--ink); background: #fff; }
.seg { border-radius: 999px; background: rgba(42, 45, 92, .06); }
.seg button { border-radius: 999px; }
.seg button[aria-checked="true"] { background: var(--ink); color: #fff; box-shadow: none; }
.si-tab { border-color: transparent; background: rgba(255, 255, 255, .85); box-shadow: 0 1px 2px rgba(90, 70, 150, .08); }
.si-tab:hover { border-color: transparent; background: #fff; color: var(--ink); }
.si-tab.is-on { background: var(--ink); color: #fff; }
.chip-app { border-radius: 999px; }
.page-head h1 { font-size: 28px; font-weight: 700; letter-spacing: -.01em; }
.toast { border-radius: 999px; padding: 11px 22px; }
.savebar { border-radius: 999px; }

/* ---------- Side nav: floating panel, grouped ---------- */
.shell { grid-template-columns: calc(var(--side) + 12px) minmax(0, 1fr); }
.side {
  top: 12px;
  height: calc(100dvh - 24px);
  margin: 12px 0 12px 12px;
  padding: 18px 12px 12px;
  border: 0;
  border-radius: 26px;
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.side__brand { padding: 2px 8px 14px; }
.side__group { display: grid; gap: 2px; margin-top: 10px; }
.side__label { margin: 0 0 2px; padding: 0 14px; color: var(--faint); font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.nav { padding: 9px 14px; border-radius: 999px; }
.nav:hover { background: rgba(42, 45, 92, .06); }
.nav.is-active { background: var(--ink); color: #fff; font-weight: 500; }
.nav.is-active .nav__badge { box-shadow: 0 0 0 2px var(--ink); }

/* ---------- Group tabs at the top of a page (storefront .atabs) ---------- */
.gtabs {
  position: sticky;
  top: 10px;
  z-index: 12;
  display: flex;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 18px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  overflow-x: auto;
  scrollbar-width: none;
}
.gtabs::-webkit-scrollbar { display: none; }
.gtab {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.gtab:hover { color: var(--ink); background: rgba(42, 45, 92, .06); }
.gtab[aria-current="page"] { background: var(--ink); color: #fff; }
.gtab:focus-visible { outline: none; box-shadow: var(--ring); }
.gtab em { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 12px; font-style: normal; line-height: 20px; text-align: center; }
.gtab em.is-on { background: var(--ok-soft); color: var(--ok); }
.gtab em.is-off { background: rgba(42, 45, 92, .08); color: var(--muted); }

/* phone-only parts: hidden on wide screens */
.mtop, .mbar, .scrim { display: none; }

/* ---------- Home (ภาพรวม) ---------- */
.hhero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: clamp(20px, 2.6vw, 32px);
  border-radius: 28px;
  overflow: hidden;
  background: radial-gradient(120% 140% at 0% 0%, #fff 0%, #f3ecff 45%, #ffe6f2 100%);
  box-shadow: var(--shadow);
}
.hhero::after { content: ""; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(185, 140, 255, .28), transparent 70%); pointer-events: none; }
.hhero__who { display: flex; align-items: center; gap: 18px; min-width: 0; }
.hhero__who img { flex: none; border-radius: 50%; box-shadow: 0 0 0 4px #fff, 0 10px 26px rgba(90, 70, 150, .28); }
.hhero__who span { display: grid; min-width: 0; }
.hhero__who small { color: var(--muted); }
.hhero__who h1 { font-size: clamp(22px, 2.4vw, 32px); font-weight: 700; line-height: 1.2; }
.hhero__who p { margin: 2px 0 0; color: var(--muted); }
.hhero__stats { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, minmax(140px, 1fr)); gap: 10px; }
.hstat { display: grid; justify-items: start; gap: 2px; min-width: 0; padding: 12px 16px; border-radius: 18px; background: rgba(255, 255, 255, .78); box-shadow: 0 4px 14px rgba(90, 70, 150, .1); }
.hstat i { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 4px; border-radius: 11px; background: #efe8ff; color: #6b4fd8; }
.hstat:nth-child(2) i { background: #e3f8eb; color: #05873b; }
.hstat:nth-child(3) i { background: #ffe8f2; color: #c43b7c; }
.hstat b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.35em; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.hstat span { color: var(--muted); font-size: 12.5px; }

.hgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.hcard { display: grid; gap: 14px; align-content: start; }
.hcard__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.hcard__head h2 { font-size: 17px; }

.htodo { display: grid; gap: 8px; }
.htodo__item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); color: var(--ink); text-decoration: none; transition: box-shadow .15s; }
.htodo__item:hover, .htodo__item:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ink); }
.htodo__item i { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: #fff; }
.htodo__item span { display: grid; flex: 1; min-width: 0; }
.htodo__item b { font-weight: 600; }
.htodo__item small { color: var(--muted); font-size: 12.5px; }
.htodo__item > svg { color: var(--faint); }
.htodo__item--warn { background: #fff4e0; }
.htodo__item--warn i { color: var(--warn); }
.htodo__item--bad { background: var(--bad-soft); }
.htodo__item--bad i { color: var(--bad); }
.htodo__item--info { background: #e8f0fe; }
.htodo__item--info i { color: #3b5bdb; }
.htodo__item--plain i { color: var(--brand-ink); }
.htodo__done { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 16px; background: var(--ok-soft); color: var(--ok); }
.htodo__done svg { width: 26px; height: 26px; }
.htodo__done span { display: grid; }
.htodo__done small { color: var(--muted); }

/* 7-day sales bars: thin, rounded top, sit on the baseline */
.hbars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; height: 190px; margin-bottom: 22px; padding-top: 22px; border-bottom: 1px solid var(--line-strong); }
.hbars__col { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; outline: none; }
.hbars__col i { width: min(28px, 70%); border-radius: 4px 4px 0 0; background: color-mix(in srgb, var(--brand) 55%, #fff); transition: background-color .15s; }
.hbars__col.is-today i { background: var(--brand); }
.hbars__col small { position: absolute; bottom: -22px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.hbars__col.is-today small { color: var(--ink); font-weight: 600; }
.hbars__val { margin-bottom: 4px; font-size: 12.5px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hbars__tip { position: absolute; bottom: calc(100% - 14px); left: 50%; z-index: 2; translate: -50% 0; padding: 5px 10px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 12.5px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; }
.hbars__col:first-child .hbars__tip { left: 0; translate: 0 0; }
.hbars__col:last-child .hbars__tip { left: auto; right: 0; translate: 0 0; }
.hbars__col:hover .hbars__tip, .hbars__col:focus-visible .hbars__tip { opacity: 1; }
.hbars__col:hover i, .hbars__col:focus-visible i { background: var(--brand-ink); }

.hlist { display: grid; gap: 4px; }
.hrow { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; margin: 0 -10px; padding: 8px 10px; border-radius: 14px; color: var(--ink); text-decoration: none; }
.hrow:hover, .hrow:focus-visible { outline: none; background: var(--surface-2); box-shadow: 0 0 0 1px var(--line-strong); }
.hrow img, .hrow__ph { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; background: var(--bg); }
.hrow__main { display: grid; min-width: 0; }
.hrow__main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.hrow__main small { color: var(--muted); font-size: 12.5px; }
.hrow__side { display: grid; justify-items: end; gap: 3px; }
.hrow__side b { font-variant-numeric: tabular-nums; }

.hquick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.hquick a { display: grid; justify-items: center; gap: 8px; padding: 16px 8px; border-radius: 18px; background: var(--surface-2); color: var(--ink); font-size: 13.5px; font-weight: 500; text-align: center; text-decoration: none; transition: box-shadow .15s, transform .15s; }
.hquick a:hover, .hquick a:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ink); transform: translateY(-2px); }
.hquick i { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: #fff; color: var(--brand-ink); box-shadow: 0 4px 12px rgba(90, 70, 150, .1); }

@media (max-width: 1180px) {
  .hhero { grid-template-columns: 1fr; }
  .hhero__stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Phone + tablet: top bar, drawer menu, bottom group bar ---------- */
@media (max-width: 900px) {
  .hgrid { grid-template-columns: 1fr; }
  .mtop {
    position: sticky;
    top: 0;
    z-index: 14;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
    background: rgba(246, 242, 251, .88);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }
  .mtop b { flex: 1; font-size: 17px; text-align: center; }
  .mtop .iconbtn { width: 40px; height: 40px; color: var(--ink); }
  .mtop .iconbtn svg { width: 22px; height: 22px; }

  /* full menu slides in from the left */
  .side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(300px, 84vw);
    height: 100dvh;
    margin: 0;
    border-radius: 0 26px 26px 0;
    background: #fff;
    translate: -105% 0;
    transition: translate .25s cubic-bezier(.2, .8, .2, 1);
  }
  .side.is-open { translate: 0 0; box-shadow: var(--shadow-pop); }
  .scrim { position: fixed; inset: 0; z-index: 39; display: block; background: rgba(20, 20, 40, .35); }
  .scrim[hidden] { display: none; }

  .mbar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 15;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    padding: 6px;
    border-radius: 24px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 10px 30px rgba(90, 70, 150, .2);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }
  .mbar__btn { position: relative; display: grid; justify-items: center; gap: 2px; padding: 7px 2px 6px; border-radius: 18px; color: var(--muted); font-size: 11.5px; font-weight: 500; text-decoration: none; }
  .mbar__btn svg { width: 22px; height: 22px; }
  .mbar__btn[aria-current="page"] { background: var(--ink); color: #fff; }
  .mbar__btn em { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 10.5px; font-style: normal; line-height: 16px; text-align: center; box-shadow: 0 0 0 2px #fff; }

  .content { padding: 10px 14px calc(110px + env(safe-area-inset-bottom)); }
  .gtabs { top: calc(60px + env(safe-area-inset-top)); width: 100%; margin-bottom: 14px; }
  .gtab { padding: 8px 12px; font-size: 14px; }
  .toast { left: 50%; top: calc(64px + env(safe-area-inset-top)); }
  .savebar { left: 50%; }
  .page-head h1 { font-size: 22px; }
  .hhero { border-radius: 24px; }
  .hhero__who img { width: 56px; height: 56px; }
}
@media (max-width: 560px) {
  .hhero__stats { grid-template-columns: 1fr 1fr; }
  .hstat:first-child { grid-column: 1 / -1; }
  .hquick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* sortable table headers (ซื้อเข้าร้าน) */
th[data-sort] button { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
th[data-sort] button::after { content: "↕"; opacity: .35; font-size: 11px; }
th[data-sort] button:hover { color: var(--ink); }
th[data-sort] button:hover::after { opacity: .7; }
th[data-sort] button:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
th.is-sorted button { color: var(--ink); }
th.is-sorted[aria-sort="ascending"] button::after { content: "↑"; opacity: 1; }
th.is-sorted[aria-sort="descending"] button::after { content: "↓"; opacity: 1; }

/* wrappers that hold several blocks (tab panes, page bodies): same spacing as the page itself */
#home-body, #sup-pane-list, #sup-pane-wallet, .bk-pane:not(.set-grid), #ar-body { display: grid; gap: 18px; align-content: start; min-width: 0; }
#sup-pane-wallet .buy-top { margin: 0; }
.view > .si-tabs { margin: 0; }
#ar-body > .si-tabs, #ar-body > .ar-warn { margin: 0; }
#ar-body > .ar-warn { justify-self: start; }
.view a:not([class]) { color: var(--brand-ink); }

/* ---------- คลังไอดี: main accounts + slots ---------- */
.sa-bar { padding: 0; border: 0; }
.sa-bar select.input { flex: 0 1 260px; width: auto; }
.sa-list { display: grid; gap: 14px; }
.sa-card { display: grid; gap: 14px; padding: 18px 20px; border-left: 4px solid transparent; }
.sa-card--soon { border-left-color: var(--warn); }
.sa-card--expired, .sa-card--problem { border-left-color: var(--bad); }
.sa-card--closed { opacity: .6; }
.sa-card__head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sa-card__head img, .sa-ph { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; background: var(--bg); flex: none; }
.sa-card__title { display: grid; min-width: 0; margin-right: auto; }
.sa-card__title b { font-size: 16px; }
.sa-card__title small { color: var(--muted); font-size: 12.5px; }
.sa-card__pills { display: flex; gap: 6px; flex-wrap: wrap; }
.sa-card__act { display: flex; gap: 6px; }
.sa-login { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sa-field { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 8px 8px 8px 14px; border-radius: 14px; background: var(--surface-2); }
.sa-field small { flex: none; color: var(--muted); font-size: 12.5px; }
.sa-field code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 14px/1.4 ui-monospace, Consolas, monospace; }
.sa-field .iconbtn { width: 30px; height: 30px; }
.sa-field .iconbtn svg { width: 16px; height: 16px; }
.sa-meta { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; }
.sa-meta div { display: grid; gap: 1px; }
.sa-meta dt { color: var(--muted); font-size: 12px; }
.sa-meta dd { margin: 0; font-weight: 500; font-size: 14px; }
.sa-meta dd small { color: var(--muted); font-weight: 400; }
.sa-devs { display: flex; gap: 4px; }
.sa-devs i { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--bg); color: var(--faint); opacity: .55; }
.sa-devs i.is-on { background: var(--ok-soft); color: var(--ok); opacity: 1; }
.sa-devs svg { width: 15px; height: 15px; }
.sa-note { margin: 0; padding: 8px 12px; border-radius: 12px; background: #fff8e6; color: var(--ink); font-size: 13.5px; white-space: pre-line; }
.sa-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.sa-slot { display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.sa-slot > b { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: #fff; font-size: 12.5px; }
.sa-slot > span { display: grid; flex: 1; min-width: 0; }
.sa-slot em { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-style: normal; font-weight: 500; font-size: 13.5px; }
.sa-slot small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.sa-slot .iconbtn { width: 28px; height: 28px; font-weight: 700; }
.sa-slot--free { background: var(--ok-soft); border-color: transparent; }
.sa-slot--free small { color: var(--ok); }
.sa-slot--sold > b { background: var(--ink); color: #fff; }
.sa-slot--held { opacity: .65; }
.sa-slot--bad { background: var(--bad-soft); border-color: transparent; }
.sa-slot--bad small { color: var(--bad); }

.stk-legacy__info { margin: 0; padding: 0 20px 12px; }
.stk-legacy .stk-grid { padding: 0 16px 16px; }

/* add / edit dialog */
.dlg-acc { width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 24px; box-shadow: var(--shadow-pop); color: var(--ink); }
.dlg-acc::backdrop { background: rgba(20, 20, 40, .45); }
.sa-form { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: calc(100dvh - 24px); }
.sa-form__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 10px; }
.sa-form__head h2 { font-size: 19px; }
.sa-form__body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; padding: 6px 22px 16px; overflow-y: auto; }
.sa-wide { grid-column: 1 / -1; }
.sa-exp { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.sa-exp > small { grid-column: 1 / -1; margin-top: 4px; }
.sa-devs-in { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 0; border: 0; color: var(--ink); }
.sa-devs-in legend { margin-bottom: 6px; padding: 0; color: var(--muted); font-size: 13.5px; }
.sa-devs-in label { display: inline-flex; white-space: nowrap; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); cursor: pointer; }
.sa-devs-in input { accent-color: var(--brand); }
.sa-slots-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.sa-slots-head .linkbtn { margin-left: auto; }
.sa-slots-in { display: grid; gap: 6px; }
.sa-srow { display: grid; grid-template-columns: 28px minmax(0, 1.4fr) minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.sa-srow > b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--bg); font-size: 12.5px; }
.sa-srow small { white-space: nowrap; }
.sa-form__foot { display: flex; align-items: center; gap: 8px; padding: 12px 22px 18px; border-top: 1px solid var(--line); }
.sa-form__foot .login__err { flex: 1; margin: 0; text-align: left; font-size: 13.5px; }
@media (max-width: 700px) {
  .sa-login, .sa-form__body { grid-template-columns: 1fr; }
  .sa-srow { grid-template-columns: 28px 1fr 1fr; }
  .sa-srow small { grid-column: 2 / -1; }
  .sa-card { padding: 16px; }
  .sa-card__act { width: 100%; }
  .sa-card__act .btn { flex: 1; }
}

/* alias + inbox */
.sa-email-row { display: flex; gap: 6px; }
.sa-email-row .input { flex: 1; min-width: 0; }
.sa-mailbtn { flex: none; }
.sa-mailbtn.has-new { background: var(--ink); color: #fff; border-color: transparent; }
.dlg-mail { width: min(640px, calc(100vw - 24px)); }
.mail-list { display: grid; gap: 10px; padding: 6px 22px 16px; overflow-y: auto; align-content: start; }
.mail { display: grid; gap: 8px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); }
.mail.is-new { box-shadow: inset 3px 0 0 var(--brand); }
.mail header { display: grid; }
.mail header small { color: var(--muted); font-size: 12.5px; }
.mail__codes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mail__codes small { color: var(--muted); font-size: 12px; }
.mail__code { padding: 6px 14px; border: 0; border-radius: 12px; background: var(--ink); color: #fff; font: 600 18px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .12em; cursor: pointer; }
.mail__code:hover { background: var(--brand-ink); }
.mail details summary { color: var(--brand-ink); font-size: 13px; cursor: pointer; }
.mail pre { max-height: 320px; margin: 8px 0 0; padding: 10px; overflow: auto; border-radius: 10px; background: #fff; font: 13px/1.55 "Prompt", sans-serif; white-space: pre-wrap; overflow-wrap: anywhere; }
.sa-form__head > span:first-child { display: grid; }
.sa-form__head > span:last-child { display: flex; align-items: center; gap: 6px; }

/* ---------- เงินเข้า: day groups + compact rows ---------- */
.bk-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bk-stat { cursor: default; }
.bk-stat:hover { transform: none; }
button.bk-stat { cursor: pointer; }
.bk-stat.has-match { box-shadow: 0 0 0 2px var(--warn), var(--shadow); }
.bk-cats { margin: 0; }
.si-tab--alert:not(.is-on) { background: var(--warn-soft); color: var(--warn); }
.oa-list#bk-list { gap: 18px; }
.bkday { display: grid; gap: 8px; }
.bkday__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 0 6px; }
.bkday__head b { font-size: 15px; }
.bkday__head span { display: flex; align-items: baseline; gap: 10px; }
.bkday__head em { font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; }
.bkday__head .is-in { color: var(--ok); }
.bkday__head .is-out { color: var(--bad); }
.bkday__head small { color: var(--muted); font-size: 12.5px; }
.bkrows { overflow: hidden; }
.bkrow + .bkrow { border-top: 1px solid var(--line); }
.bkrow > summary { display: grid; grid-template-columns: 46px 34px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 18px; list-style: none; cursor: pointer; }
.bkrow > summary::-webkit-details-marker { display: none; }
.bkrow > summary:hover { background: var(--surface-2); }
.bkrow time { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.bkrow__ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--bg); color: var(--muted); }
.bkrow--in .bkrow__ic { background: var(--ok-soft); color: var(--ok); }
.bkrow--out .bkrow__ic { background: var(--bad-soft); color: var(--bad); }
.bkrow__main { display: grid; min-width: 0; }
.bkrow__main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.bkrow__main > small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.bk-src { margin-left: 4px; padding: 1px 7px; border-radius: 999px; background: var(--bg); color: var(--muted); font-size: 11.5px; font-weight: 500; }
.bkrow__side { display: grid; justify-items: end; gap: 3px; }
.bkrow__side strong { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bkrow--in .bkrow__side strong { color: var(--ok); }
.bkrow--out .bkrow__side strong { color: var(--bad); }
.bk-tag { padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-style: normal; font-weight: 600; white-space: nowrap; }
.bk-tag--match { background: var(--warn-soft); color: var(--warn); }
.bk-tag--ok { background: var(--ok-soft); color: var(--ok); }
.bkrow.is-match { background: #fffaf0; box-shadow: inset 4px 0 0 var(--warn); }
.bkrow.is-new > summary time { color: var(--brand-ink); font-weight: 600; }
.bkrow__more { display: grid; gap: 8px; padding: 0 18px 14px 110px; }
.bkrow__more .bk-text { margin: 0; }
.bkrow__more p { margin: 0; }
@media (max-width: 700px) {
  .bk-kpis { grid-template-columns: 1fr 1fr; }
  .bk-kpis .kpi:first-child { grid-column: auto; }
  .bk-kpis button.bk-stat { grid-column: 1 / -1; }
  .bkrow > summary { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; padding: 12px 14px; }
  .bkrow time { grid-column: 2; grid-row: 2; font-size: 12px; }
  .bkrow__ic { grid-column: 1; grid-row: 1 / 3; width: 30px; height: 30px; }
  .bkrow__main { grid-column: 2; grid-row: 1; }
  .bkrow__side { grid-column: 3; grid-row: 1 / 3; }
  .bkrow__more { padding: 0 14px 14px; }
}

/* ---------- ลูกค้า: member list ---------- */
.mb-count { align-self: center; white-space: nowrap; }
.mlist { overflow: hidden; }
.mrow { display: grid; grid-template-columns: minmax(200px, 1fr) 150px 120px 100px 120px 70px 200px; align-items: center; gap: 14px; padding: 12px 18px; }
.mrow + .mrow { border-top: 1px solid var(--line); }
.mrow:hover { background: var(--surface-2); }
.mrow__who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mrow__who img, .mrow__av { flex: none; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.mrow__av { display: grid; place-items: center; background: linear-gradient(135deg, #b98cff, #ff9ccc); color: #fff; font-weight: 700; }
.mrow__who > span { display: grid; min-width: 0; }
.mrow__who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.mrow__who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12.5px; }
.mrow__no { padding: 0; border: 0; background: none; color: var(--brand-ink); font: inherit; font-weight: 600; cursor: copy; }
.mrow__mail { font-size: 12px !important; }
.mrow__login { display: flex; flex-wrap: wrap; gap: 4px; }
.mprov { padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); font-size: 11.5px; font-style: normal; font-weight: 600; }
.mprov--line { background: #e3f8e9; color: #06a33b; }
.mprov--google { background: #e8f0fe; color: #1a5fd0; }
.mprov--discord { background: #ecebff; color: #5865f2; }
.mprov--pw { background: var(--brand-soft); color: var(--brand-ink); }
.mrow__num { display: grid; min-width: 0; }
.mrow__num small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow__num b { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mrow__act { display: flex; gap: 6px; justify-content: flex-end; }
.mb-more { justify-self: center; }
.reset-body { padding: 0 24px 22px; }
@media (max-width: 1100px) {
  .mrow { grid-template-columns: minmax(0, 1fr) repeat(4, auto); }
  .mrow__who { grid-column: 1 / -1; }
  .mrow__login { grid-column: 1 / -1; }
  .mrow__act { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 560px) {
  .mrow { grid-template-columns: 1fr 1fr; padding: 14px; }
}

/* cancel an ID already sold */
.dlg-revoke { width: min(560px, calc(100vw - 24px)); }
.rv-body { grid-template-columns: 1fr; }
.rv-mode { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; }
.rv-mode legend { margin-bottom: 6px; padding: 0; color: var(--muted); font-size: 13.5px; }
.rv-mode label { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); color: var(--ink); cursor: pointer; }
.rv-mode label:has(input:checked) { box-shadow: 0 0 0 2px var(--ink); background: #fff; }
.rv-mode input { margin-top: 4px; accent-color: var(--ink); }
.rv-mode span { display: grid; }
.rv-mode small { color: var(--muted); font-size: 12.5px; }
.sa-revoke { flex: none; padding: 4px 10px; font-size: 12.5px; }
.oa-sid { display: grid; gap: 6px; justify-items: start; }
.oa-sid + .oa-sid { margin-top: 8px; }
.oa-gone { margin: 0; padding: 8px 12px 8px 28px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-size: 13px; }
.rv-mode input { flex: none; width: auto; }
.rv-mode span { flex: 1; }

/* ---------- ลูกค้า > one member ---------- */
.mb-listview, .mb-detail { display: grid; gap: 18px; align-content: start; min-width: 0; }
.mb-detail > [data-back] { justify-self: start; }
.mrow { cursor: pointer; }
.mrow:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ink); }
.mhero__av { display: grid; place-items: center; flex: none; width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(135deg, #b98cff, #ff9ccc); color: #fff; font-size: 30px; font-weight: 700; box-shadow: 0 0 0 4px #fff; }
.mhero .hhero__who img { border-radius: 50%; object-fit: cover; }
.mhero p { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.mhero .hstat i { font-style: normal; font-weight: 700; }
.mtabs { margin: 0; }
.mpane { display: grid; gap: 12px; min-width: 0; }
.morder { display: grid; gap: 10px; padding: 16px 20px; border-left: 4px solid transparent; }
.morder--review { border-left-color: var(--warn); }
.morder--paid { border-left-color: var(--bad); }
.morder--completed { border-left-color: var(--ok); }
.morder--cancelled { opacity: .65; }
.morder header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.morder header strong { margin-left: auto; font-size: 18px; font-variant-numeric: tabular-nums; }
.morder ul { display: grid; gap: 6px; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); list-style: none; font-size: 14px; }
.morder li { display: flex; align-items: center; gap: 8px; }
.morder li img { border-radius: 8px; }
.morder li span { margin-left: auto; font-variant-numeric: tabular-nums; }
.morder p { margin: 0; }
.mids { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.mid { display: grid; gap: 8px; padding: 16px; align-content: start; }
.mid header { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.mid header .pill { margin-left: auto; }
.mid pre { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--ink); color: #fff; font: 13px/1.55 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }
.mid p { margin: 0; }
.mid.is-gone { opacity: .7; background: var(--bad-soft); }
.mpoints, .maccount { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.mpoints__form { display: grid; grid-template-columns: 140px 1fr auto; gap: 8px; }
.mlog { display: grid; margin: 0; padding: 0; list-style: none; }
.mlog li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; }
.mlog li + li { border-top: 1px solid var(--line); }
.mlog li > span:first-child { display: grid; min-width: 0; }
.mlog small { color: var(--muted); font-size: 12px; }
.mlog em { font-style: normal; font-weight: 700; font-variant-numeric: tabular-nums; }
.mlog .is-in { color: var(--ok); }
.mlog .is-out { color: var(--bad); }
.mdl { display: grid; gap: 8px; margin: 0; }
.mdl div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; }
.mdl dt { color: var(--muted); }
.mdl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.mchat { display: grid; grid-template-rows: minmax(260px, 60vh) auto; overflow: hidden; }
.mchat__msgs { display: flex; flex-direction: column; gap: 8px; padding: 16px; overflow-y: auto; background: var(--surface-2); }
.mchat__m { display: grid; max-width: 75%; }
.mchat__m p { margin: 0; padding: 8px 12px; border-radius: 16px; background: #fff; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px 2px rgba(42, 45, 92, .06); }
.mchat__m small { color: var(--muted); font-size: 11px; padding: 2px 6px; }
.mchat__m--out { align-self: flex-end; justify-items: end; }
.mchat__m--out p { background: #06c755; color: #fff; }
.mchat__form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
@media (max-width: 900px) {
  .mpoints, .maccount { grid-template-columns: 1fr; }
  .mpoints__form { grid-template-columns: 1fr 1fr; }
  .mpoints__form .btn { grid-column: 1 / -1; }
}

/* PIN only when the app uses one */
.sa-pin-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--surface-2); font-size: 13px; cursor: pointer; }
.sa-pin-toggle input { accent-color: var(--brand); }
.sa-slots-head .sa-pin-toggle { margin-left: auto; }
.sa-slots-head .linkbtn { margin-left: 0; }
#sa-slots.no-pin [data-spin] { display: none; }
#sa-slots.no-pin .sa-srow { grid-template-columns: 28px minmax(0, 1fr) auto; }
.sa-form__body .field { align-content: start; }
#sa-source { width: 100%; }

/* ===== เพจ Facebook ===== */
.fb-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: start; margin-top: 16px; }
.fb-grid--post { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
@media (max-width: 900px) { .fb-grid--post { grid-template-columns: 1fr; } }
.fb-grid .card { padding: 18px 20px; display: grid; gap: 12px; }
.fb-grid h3 { margin: 0; font-size: 16px; }
.fb-need { margin-top: 16px; padding: 28px; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.fb-need p { margin: 0; }
.fb-page { display: flex !important; flex-wrap: wrap; align-items: center; gap: 14px; grid-column: 1 / -1; }
.fb-page img, .fb-page .lb-ava { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; }
.fb-page > div:not(.fb-page__act) { display: grid; gap: 2px; flex: 1 1 220px; min-width: 0; }
.fb-page__act { display: flex; gap: 8px; flex-wrap: wrap; }
.fb-steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; line-height: 1.6; }
.fb-steps code, .fb-note code, .fb-grid .muted code { font-size: 12px; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.fb-pages { display: grid; gap: 8px; }
.fb-pagepick { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.fb-pagepick:has(input:checked) { outline: 2px solid var(--brand); }
.fb-pagepick img { width: 36px; height: 36px; border-radius: 50%; }
.fb-pagepick span { display: grid; }
.fb-copy { display: flex; gap: 8px; }
.fb-copy .input { flex: 1; min-width: 0; font-family: ui-monospace, monospace; font-size: 13px; }
.fb-note { margin: 0; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, #f5a623 14%, transparent); font-size: 13px; line-height: 1.6; }
.fb-grid .grid2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.fb-grid .row-end { display: flex; justify-content: flex-end; gap: 8px; }
.fb-grid .switch-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.fb-grid .switch-row input { margin-top: 4px; accent-color: var(--brand); width: 18px; height: 18px; flex: none; }
.fb-grid .switch-row span { display: grid; gap: 2px; }
.fb-img { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.fb-img img { width: 180px; max-height: 120px; object-fit: cover; border-radius: 10px; background: var(--surface-2); }
.fb-posts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.fb-posts li { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.fb-posts li.is-bad { background: color-mix(in srgb, #e5484d 10%, transparent); }
.fb-posts img { width: 64px; height: 48px; object-fit: cover; border-radius: 8px; flex: none; }
.fb-posts li > span { display: grid; gap: 2px; min-width: 0; }
.fb-posts b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view-fb .lb-inbox { margin-top: 16px; }
#view-fb .fb-note + .lb-reply { margin-top: 8px; }

.fb-ch { display: inline-grid; place-items: center; min-width: 22px; height: 18px; padding: 0 5px; border-radius: 6px; background: #0866ff; color: #fff; font-size: 10px; font-weight: 700; vertical-align: 1px; }
.fb-ch--ig { background: linear-gradient(45deg, #f9a03f, #e1306c 55%, #833ab4); }
.fb-targets { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.fb-grid .switch-row.is-off { opacity: .55; cursor: not-allowed; }

/* หน้าเว็บ > ตะกร้า & วิธีสั่งซื้อ: step picture (square) + wide header picture */
.si-media--step .si-media__prev { width: 150px; aspect-ratio: 16 / 9; }
.si-media--wide .si-media__prev { width: min(100%, 320px); aspect-ratio: 16 / 9; }
.rwa-links { margin: 0; padding-left: 1.2em; display: grid; gap: 2px; }

/* ---------- ผู้ดูแล & สิทธิ์ (admin-admins.js) ---------- */
#ad-body { display: grid; gap: 16px; }
#ad-body > .si-tabs { margin: 0; }
.ad-me { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 20px; }
.ad-me > div { display: grid; }
.ad-role { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--rc) 13%, #fff); color: color-mix(in srgb, var(--rc) 80%, #000); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.ad-role::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--rc); }
.ad-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ad-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--bg); }
.ad-row.is-off { opacity: .6; }
.ad-ava { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: 18px; }
.ad-ava img { width: 100%; height: 100%; object-fit: cover; }
.ad-who { display: grid; gap: 3px; min-width: 0; }
.ad-who > b, .ad-who > small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-who > small:first-of-type { color: var(--muted); }
.ad-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 2px 0; }
.ad-note { padding: 4px 8px; border-radius: 8px; background: var(--surface); color: var(--muted); white-space: normal !important; }
.ad-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ad-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ad-head .step { margin: 0; }
.ad-warn { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); font-size: 13.5px; }
.ad-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 8px; }
.ad-permhead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 18px 0 10px; }
.ad-permhead h3 { margin: 0; font-size: 15px; }
.ad-permhead h3 small { color: var(--muted); font-weight: 500; }
.ad-permhead p { margin: 0; flex: 1; }
.ad-matrix { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; align-items: start; }
.ad-group { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.ad-group header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--bg); }
.ad-group header small { color: var(--muted); font-variant-numeric: tabular-nums; }
.ad-group__all { margin-left: auto; color: var(--faint); font-size: 12px; }
.ad-perm { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start; padding: 9px 12px; border-top: 1px solid var(--line); cursor: pointer; }
.ad-perm.is-on { background: color-mix(in srgb, var(--ok) 6%, #fff); }
.ad-perm input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--brand); cursor: pointer; }
.ad-perm input:disabled { cursor: not-allowed; }
.ad-perm span { display: grid; gap: 2px; font-size: 13.5px; }
.ad-perm b { font-weight: 500; }
.ad-perm small { color: var(--muted); font-size: 12px; }
.ad-nogive { color: var(--faint) !important; }
.ad-diff { width: fit-content; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-style: normal; font-weight: 600; }
.ad-diff--add { background: var(--ok-soft); color: var(--ok); }
.ad-diff--cut { background: var(--bad-soft); color: var(--bad); }
.ad-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.ad-foot__sp { flex: 1; }
.ad-roles { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.ad-roles li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--bg); }
.ad-roles__dot { width: 12px; height: 12px; border-radius: 50%; background: var(--rc); }
.ad-roles li > div { display: grid; gap: 3px; min-width: 0; }
.ad-roles li small { color: var(--muted); }
.ad-roles__pages { display: flex; flex-wrap: wrap; gap: 4px; }
.ad-roles__pages em { padding: 1px 8px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 11.5px; font-style: normal; }
.ad-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.ad-color { width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--c); cursor: pointer; box-shadow: 0 0 0 2px #fff, 0 0 0 3px transparent; }
.ad-color.is-on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--c); }
.ad-table-wrap { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 12px; }
.ad-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ad-table th, .ad-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.ad-table td:first-child { text-align: left; white-space: normal; min-width: 220px; }
.ad-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.ad-table thead th span { display: inline-block; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--rc) 13%, #fff); color: color-mix(in srgb, var(--rc) 80%, #000); }
.ad-table thead th:first-child { text-align: left; }
.ad-table td:not(:first-child) { color: var(--ok); font-weight: 700; }
.ad-table__g th { background: var(--bg); text-align: left; font-weight: 600; }
@media (max-width: 640px) {
  .ad-row { grid-template-columns: 40px minmax(0, 1fr); }
  .ad-row .ad-acts { grid-column: 1 / -1; justify-content: flex-start; }
  .ad-roles li { grid-template-columns: 12px minmax(0, 1fr); }
  .ad-roles li .ad-acts { grid-column: 2; justify-content: flex-start; }
}

/* คลังไอดี: slot rows. Login mode = username + password per slot (profile hidden), else profile name */
#sa-slots .sa-srow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
#sa-slots .sa-srow > .input { flex: 1 1 150px; min-width: 0; }
#sa-slots .sa-srow > b { flex: none; }
#sa-slots .sa-srow > small:empty { display: none; }
#sa-slots .sa-srow > small { flex-basis: 100%; padding-left: 34px; }
#sa-slots [data-suser], #sa-slots [data-spass] { display: none; }
#sa-slots.use-login [data-suser], #sa-slots.use-login [data-spass] { display: block; }
#sa-slots.use-login [data-sprofile] { display: none; }
#sa-slots [data-spin] { flex: 0 1 120px; }
.sa-slots-head .sa-pin-toggle + .sa-pin-toggle { margin-left: 0; }

/* แชตลูกค้า (admin-inbox.js): LINE + Messenger + Instagram */
.ib-filters { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.ib-filter { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; }
.ib-filter.is-on { border-color: var(--ink); background: var(--ink); color: #fff; }
.ib-filter i { font-style: normal; font-weight: 600; }
.ib-ch { display: inline-grid; place-items: center; min-width: 22px; height: 18px; padding: 0 5px; border-radius: 6px; background: #06c755; color: #fff; font-size: 9.5px; font-weight: 700; vertical-align: 1px; }
.ib-inbox { margin-top: 4px; }
