/* ม๋าบ๊อก Backoffice (PUN-88). Colours and type follow public/dashboard/styles.css;
   the layout is the design the owner approved on 19/10/2569. No underlines anywhere. */
:root {
  --terracotta: #c1502e;
  --terracotta-deep: #a34125;
  --beige: #f3e8da;
  --paper: #fffdfa;
  --ink: #1a1a1a;
  --ink-soft: #6b6259;
  --line: #e6d8c6;
  --field: #d6c4ad;
  --bark: #4a3a30;
  --bark-soft: #6a564a;
  --plan-free: #a2968a;
  --good: #1f5f2a;
  --bad: #9e1f1f;
  --rainbow: linear-gradient(100deg, #e0483f, #ef8c1e, #f3cf22, #4aa84f, #2e8bd0, #6b4fbb);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Anuphan', 'Noto Sans Thai', sans-serif;
}
a, a:hover, button { text-decoration: none; }
a { color: var(--terracotta-deep); }
a:hover { color: #7f3119; }
[hidden] { display: none !important; }
.nw { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 1px; }

/* Sign in */
.gate {
  min-height: 100vh;
  background: var(--beige);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
}
.gate-inner { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; align-items: center; gap: 14px; font-size: 22px; font-weight: 700; }
.brand img { width: 52px; height: 52px; border-radius: 50%; }
.card-form {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.card-form h1 { margin: 0; font-size: 24px; font-weight: 600; }
.card-form p { margin: 0; font-size: 15px; color: var(--ink-soft); line-height: 1.6; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 14px; font-weight: 500; }
.field input {
  font: inherit;
  font-size: 16px;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--field);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
}
.field .hint { font-size: 13px; color: var(--ink-soft); }
.otp-big { font-size: 28px !important; letter-spacing: 12px; text-align: center; height: 64px !important; font-variant-numeric: tabular-nums; }
.otp { font-size: 20px !important; letter-spacing: 8px; font-variant-numeric: tabular-nums; }
.primary {
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  height: 48px;
  border: 0;
  border-radius: 10px;
  background: var(--terracotta);
  color: #ffffff;
  cursor: pointer;
}
.primary:disabled { opacity: 0.6; cursor: default; }
.passkey-choice { display: flex; flex-direction: column; gap: 20px; }
.passkey-choice .secondary { height: 48px; justify-content: center; gap: 10px; font-size: 16px; font-weight: 600; }
.secondary:disabled { opacity: 0.6; cursor: default; }
.passkey-choice[hidden] { display: none; }
.or { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-soft); }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.keys { list-style: none; margin: 0; padding: 0; max-width: 640px; border: 1px solid var(--line); border-radius: 14px; background: #ffffff; }
.keys li { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; }
.keys li + li { border-top: 1px solid var(--line); }
.keys li div { display: flex; flex-direction: column; gap: 4px; }
.keys li span { font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.remove { flex-shrink: 0; font: inherit; font-size: 14px; background: none; border: 0; padding: 0; color: var(--terracotta-deep); cursor: pointer; }
.remove.confirm { color: var(--bad); font-weight: 600; }
.links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: 14px; }
.link-button { font: inherit; font-size: 14px; background: none; border: 0; padding: 0; color: var(--terracotta-deep); cursor: pointer; }
.alert { background: #fbeceb; color: var(--bad); border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.5; }
.success { max-width: 480px; background: #e6f2e7; color: var(--good); border-radius: 10px; padding: 14px 16px; font-size: 14px; line-height: 1.6; }

/* Signed in. The menu stays put while the page scrolls (owner, 19/10/2569), and folds to icons. */
.shell { min-height: 100vh; display: flex; }
.nav {
  flex: 0 0 232px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--bark);
  color: var(--beige);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  transition: flex-basis 0.2s ease;
}
.nav .ic { display: none; width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-toggle { margin-left: auto; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: #d9c7b3; cursor: pointer; }
.nav-toggle:hover { background: var(--bark-soft); color: var(--paper); }
.nav-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s ease; }
.shell.folded .nav { flex-basis: 72px; padding: 24px 12px; }
.shell.folded .nav .txt { display: none; }
.shell.folded .nav .ic { display: block; }
.shell.folded .nav-brand { flex-direction: column; gap: 14px; padding: 0; }
.shell.folded .nav-toggle { margin-left: 0; }
.shell.folded .nav-toggle svg { transform: rotate(180deg); }
.shell.folded .nav-links a { justify-content: center; padding: 0; }
.shell.folded .nav-foot { align-items: center; gap: 4px; padding: 0; }
.shell.folded .nav-foot a, .shell.folded .nav-foot button { display: flex; align-items: center; justify-content: center; width: 44px; height: 40px; border-radius: 10px; }
.shell.folded .nav-foot a[aria-current='page'] { background: var(--bark-soft); }
.nav-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.nav-brand img { width: 36px; height: 36px; border-radius: 50%; }
.nav-brand strong { display: block; font-size: 16px; color: var(--paper); }
.nav-brand span { display: block; font-size: 12px; color: #d9c7b3; }
.nav-links { display: flex; flex-direction: column; gap: 4px; }
.nav-links a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  color: #e8dccd;
  font-size: 15px;
}
.nav-links a[aria-current='page'] { background: var(--bark-soft); color: var(--paper); font-weight: 600; }
.nav-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 8px; }
.nav-foot .who { font-size: 13px; color: #d9c7b3; }
.nav-foot a, .nav-foot button { color: var(--beige); font-size: 14px; font-weight: 500; text-align: left; }
.nav-foot button { font-family: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

main { flex: 999 1 560px; min-width: 0; padding: 40px 40px 56px; display: flex; flex-direction: column; gap: 32px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head h1 { margin: 0 0 6px; font-size: 30px; font-weight: 700; }
.sub { font-size: 14px; color: var(--ink-soft); }
.note { font-size: 13px; color: var(--ink-soft); line-height: 1.6; }
section { display: flex; flex-direction: column; gap: 16px; }
section h2 { margin: 0; font-size: 19px; font-weight: 600; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }

.toggle { display: flex; padding: 4px; gap: 4px; border-radius: 12px; background: var(--beige); }
.toggle button {
  font: inherit;
  font-size: 15px;
  min-height: 40px;
  min-width: 76px;
  padding: 0 16px;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  background: transparent;
  color: var(--bark);
}
.toggle button[aria-pressed='true'] { background: #ffffff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(74, 58, 48, 0.18); }

.cards { display: flex; flex-wrap: wrap; gap: 16px; }
.card {
  flex: 1 1 240px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #ffffff;
}
.card .label { font-size: 14px; color: var(--ink-soft); }
.card .value { display: flex; align-items: baseline; gap: 8px; }
.card .value strong { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card .value > span { font-size: 15px; color: var(--ink-soft); }
.delta { font-size: 14px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.delta.up { color: var(--good); font-weight: 600; }
.delta.down { color: var(--bad); font-weight: 600; }
.card .small { font-size: 12px; color: var(--ink-soft); }

.funnel { display: flex; flex-wrap: wrap; gap: 12px; }
.step { flex: 1 1 180px; border-radius: 14px; padding: 18px 20px; color: var(--paper); display: flex; flex-direction: column; gap: 6px; }
.step .t { font-size: 14px; opacity: 0.85; }
.step strong { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.step .p { font-size: 13px; opacity: 0.85; }
.step:nth-child(1) { background: var(--bark); }
.step:nth-child(2) { background: var(--bark-soft); }
.step:nth-child(3) { background: var(--terracotta-deep); }
.step:nth-child(4) { background: var(--terracotta); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #ffffff; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid #efe4d6; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
th { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.right { text-align: right; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; background: #efe4d6; color: var(--bark); font-size: 13px; font-weight: 500; }
.status { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.status::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--good); }
.status.down { color: var(--bad); }
.status.unknown { color: var(--ink-soft); }
.danger { color: var(--bad); font-weight: 500; }

.verdict {
  border-radius: 14px;
  padding: 20px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  flex-direction: row;
}
.verdict h2 { font-size: 17px; display: flex; align-items: center; gap: 10px; }
.verdict h2::before { content: ''; width: 14px; height: 14px; border-radius: 50%; background: currentColor; }
.verdict p { margin: 0; flex: 1 1 320px; font-size: 14px; line-height: 1.6; }
.verdict.yellow { background: #fbf1d6; border: 1px solid #ecd9a2; color: #5a3f00; }
.verdict.yellow h2::before { background: #d39b0a; }
.verdict.green { background: #e6f2e7; border: 1px solid #b9dabc; color: var(--good); }
.verdict.red { background: #fbeceb; border: 1px solid #efc4c0; color: var(--bad); }
.verdict.none { background: var(--beige); border: 1px solid var(--line); color: var(--bark); }

.plans { border: 1px solid var(--line); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 18px; background: #ffffff; }
.plan-bar { display: flex; height: 20px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--beige); }
.plan-bar div { min-width: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 12px 28px; font-size: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.c-free { background: var(--plan-free); }
.c-pro { background: var(--terracotta); }
.c-max { background: var(--rainbow); }

.controls { display: flex; flex-wrap: wrap; gap: 8px; }
.controls select, .secondary {
  font: inherit;
  font-size: 14px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--field);
  background: #ffffff;
  color: var(--ink);
}
.secondary { display: inline-flex; align-items: center; font-weight: 500; padding: 0 18px; cursor: pointer; }
.banner { background: var(--beige); border-radius: 14px; padding: 16px 20px; font-size: 14px; line-height: 1.6; color: var(--bark); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.chart { margin: 0; border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; background: #ffffff; display: flex; flex-direction: column; gap: 14px; }
.chart figcaption { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; row-gap: 2px; }
.chart figcaption .label { flex-basis: 100%; font-size: 14px; color: var(--ink-soft); }
.chart figcaption strong { font-size: 30px; font-weight: 700; }
.chart figcaption > span:not(.label) { font-size: 15px; color: var(--ink-soft); }
.plot-wrap { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 8px; }
.y-axis { position: relative; min-width: 36px; font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; text-align: right; }
.y-axis span { position: absolute; right: 0; transform: translateY(-50%); white-space: nowrap; }
.plot { position: relative; height: 180px; touch-action: pan-y; cursor: crosshair; }
.plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.plot .grid { stroke: var(--line); stroke-width: 1; }
.plot .area { fill: var(--terracotta); opacity: 0.1; }
.plot .line { fill: none; stroke: var(--terracotta); stroke-width: 2.5; stroke-linejoin: round; }
.hover { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--bark-soft); pointer-events: none; }
.hover[hidden] { display: none; }
.hover i { position: absolute; left: -5px; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--terracotta); border: 2px solid #ffffff; }
.hover .tip { position: absolute; top: -8px; left: 8px; background: var(--bark); color: #ffffff; font-size: 13px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hover .tip.flip { left: auto; right: 8px; }
.x-axis { grid-column: 2; display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-soft); }
.feedback { display: flex; flex-direction: column; gap: 12px; }
.feedback article { border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; background: #ffffff; }
.feedback .when { font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.feedback p { margin: 0; font-size: 16px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.center { align-self: center; }
.narrow { max-width: 480px; }
.card-form.plain { background: #ffffff; padding: 28px; }
.empty { color: var(--ink-soft); font-size: 15px; padding: 8px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
footer { font-size: 13px; color: var(--ink-soft); line-height: 1.6; border-top: 1px solid var(--line); padding-top: 16px; }

@media (max-width: 640px) {
  main { padding: 24px 16px 40px; }
  .card-form { padding: 24px; }
  /* A phone has no room beside the page: the menu goes on top, scrolls away and does not fold. */
  .shell, .shell.folded { flex-direction: column; }
  .nav, .shell.folded .nav { position: static; height: auto; flex-basis: auto; padding: 24px 16px; overflow: visible; }
  .nav-toggle { display: none; }
  .shell.folded .nav .txt { display: revert; }
  .shell.folded .nav .ic { display: none; }
  .shell.folded .nav-brand { flex-direction: row; gap: 12px; padding: 0 8px; }
  .shell.folded .nav-links a { justify-content: flex-start; padding: 0 14px; }
  .shell.folded .nav-foot { align-items: flex-start; gap: 16px; padding: 0 8px; }
  .shell.folded .nav-foot a, .shell.folded .nav-foot button { width: auto; height: auto; }
  .nav { gap: 16px; }
  .nav-links { flex-direction: row; flex-wrap: wrap; }
  .nav-foot { flex-direction: row; flex-wrap: wrap; gap: 16px; }
}
