/* ============================================================
   คู่มือการใช้งาน Steak Pluto POS
   ============================================================ */

@font-face {
  font-family: "Noto Sans Thai";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/NotoSansThai-thai.woff2") format("woff2");
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: "Noto Sans Thai";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/NotoSansThai-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F;
}

:root {
  /* Pluto palette (ตรงกับแอป) */
  --text: #33201a;
  --green: #c0160d;
  --green-700: #96120a;
  --green-600: #c0160d;
  --green-100: #fbe5e2;
  --green-deep: #6d0d07;
  --cream: #fdf0e0;
  --cream-soft: #fef8f0;
  --cream-tint: #f9e7cf;
  --orange: #eda90f;
  --orange-600: #cc900a;
  --orange-700: #a37006;
  --brown: #4a2419;
  --line: #f2ddc4;
  --line-strong: #ddc19e;
  --surface: #ffffff;
  --surface-strong: #fffaf3;
  --muted: #8a7060;
  --muted-strong: #63503f;
  --green-ink: #96120a;
  --ink-green: #7a3a2b;
  --shadow-rgb: 90, 25, 20;
  --success: #31845e;
  --success-soft: #e7f3ed;
  --danger: #a32727;
  --danger-soft: #fdf1ee;
  --warning: #b87722;
  --warning-soft: #fff0d5;
  --info: #476fc1;
  --info-soft: #e8eefb;
  --radius-s: 10px;
  --radius-m: 14px;
  --radius-l: 20px;
  --radius-xl: 24px;
  --shadow-1: 0 1px 3px rgba(var(--shadow-rgb), 0.05), 0 8px 24px rgba(var(--shadow-rgb), 0.08);
  --shadow-2: 0 2px 6px rgba(var(--shadow-rgb), 0.06), 0 18px 44px rgba(var(--shadow-rgb), 0.15);
  --header-h: 72px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Noto Sans Thai", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--cream);
  color: var(--text);
  min-width: 320px;
  line-height: 1.65;
}

/* ---------- Header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: var(--header-h);
  background: var(--green-700);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px clamp(14px, 3vw, 28px);
  box-shadow: var(--shadow-1);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; flex-shrink: 0; }
.brand img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; box-shadow: 0 2px 8px rgba(0,0,0,0.25); }
.brand .brand-title { display: flex; flex-direction: column; line-height: 1.25; }
.brand .brand-title strong { font-size: 17px; letter-spacing: -0.01em; color: #fff; }

.menu-btn {
  display: none;
  background: rgba(255,255,255,0.14);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 12px;
  min-height: 44px;
  padding: 0 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* ---------- Search ---------- */
.search-wrap { position: relative; flex: 1; max-width: 560px; margin-left: auto; }
.search-input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 14px;
  background: rgba(255,255,255,0.96);
  color: var(--text);
  font: inherit;
  padding: 0 92px 0 44px;
  box-shadow: var(--shadow-1);
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus { outline: 3px solid rgba(237,169,15,0.45); border-color: #fff; }
.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-size: 17px; color: var(--muted); pointer-events: none;
}
.search-kbd {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--muted);
  border: 1px solid var(--line-strong); border-radius: 6px;
  padding: 2px 7px; background: var(--cream-soft); pointer-events: none;
}
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-2);
  max-height: min(60vh, 480px);
  overflow: auto;
  padding: 6px;
  display: none;
}
.search-results.open { display: block; }
.search-results .sr-group {
  font-size: 11px; font-weight: 800; letter-spacing: 0.12em;
  color: var(--green-700); padding: 10px 12px 4px; text-transform: uppercase;
}
.search-hit {
  display: block; width: 100%; text-align: left;
  border: 0; background: transparent; font: inherit; color: inherit;
  padding: 10px 12px; border-radius: var(--radius-m); cursor: pointer;
}
.search-hit:hover, .search-hit.active { background: var(--green-100); }
.search-hit .hit-title { font-weight: 800; color: var(--brown); }
.search-hit .hit-snippet { font-size: 13px; color: var(--muted-strong); margin-top: 2px; }
.search-hit mark { background: rgba(237,169,15,0.4); border-radius: 4px; padding: 0 2px; }
.search-empty { padding: 18px 14px; color: var(--muted); font-size: 14px; }

/* ---------- Layout ---------- */
.shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: clamp(16px, 3vw, 40px);
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 26px clamp(14px, 3vw, 32px) 80px;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  align-self: start;
  max-height: calc(100vh - var(--header-h) - 40px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-1);
  padding: 14px 12px 18px;
  scrollbar-width: thin;
}
.nav-group-title {
  font-size: 11px; font-weight: 800; letter-spacing: 0.14em;
  color: var(--green-700);
  padding: 14px 10px 6px;
}
.nav-group-title:first-child { padding-top: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px;
  border-radius: var(--radius-m);
  color: var(--muted-strong);
  text-decoration: none;
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.4;
}
.nav-link:hover { background: var(--cream-soft); color: var(--brown); }
.nav-link.active { background: var(--green-700); color: #fff; box-shadow: var(--shadow-1); }
.nav-link .num {
  flex-shrink: 0; width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: 11.5px; font-weight: 800;
  background: var(--cream-tint); color: var(--ink-green);
}
.nav-link.active .num { background: rgba(255,255,255,0.22); color: #fff; }

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0; z-index: 45;
  background: rgba(61,13,9,0.5);
}

/* ---------- Content ---------- */
.content { min-width: 0; }
.eyebrow {
  font-size: 12px; font-weight: 800; letter-spacing: 0.14em;
  color: var(--green-700);
}
.section {
  display: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-1);
  padding: clamp(22px, 3.5vw, 40px);
  animation: fadein 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.section.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.section h2 {
  margin: 6px 0 4px;
  color: var(--brown);
  font-size: clamp(26px, 3.4vw, 34px);
  letter-spacing: -0.025em;
  line-height: 1.25;
}
.section h3 {
  margin: 34px 0 10px;
  color: var(--brown);
  font-size: 20px;
  letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 10px;
}
.section h3::before {
  content: ""; width: 8px; height: 22px; border-radius: 4px;
  background: var(--orange); flex-shrink: 0;
}
.section p { margin: 10px 0; color: var(--text); }
.section ul, .section ol { margin: 10px 0; padding-left: 26px; }
.section li { margin: 7px 0; }
.section li::marker { color: var(--green-600); font-weight: 800; }
.section a { color: var(--green-700); font-weight: 700; }
b, strong { color: var(--brown); }

/* ---------- Figure / screenshots ---------- */
figure.shot {
  margin: 18px 0 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--cream-soft);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
figure.shot img { display: block; width: 100%; height: auto; }
figure.shot.narrow img { max-width: 420px; margin: 0 auto; }
figure.shot figcaption {
  padding: 10px 16px;
  font-size: 13.5px;
  color: var(--muted-strong);
  border-top: 1px dashed var(--line-strong);
  background: var(--surface-strong);
}
figure.shot figcaption b { color: var(--green-ink); }

/* ---------- Callout boxes ---------- */
.tip, .warn, .note {
  border-radius: var(--radius-m);
  padding: 13px 16px 13px 46px;
  margin: 16px 0;
  font-size: 14.5px;
  position: relative;
  border: 1px solid;
}
.tip::before, .warn::before, .note::before {
  position: absolute; left: 15px; top: 12px; font-size: 17px;
}
.tip { background: var(--success-soft); border-color: #cfe6da; }
.tip::before { content: "💡"; }
.warn { background: var(--danger-soft); border-color: #e7b7ac; }
.warn::before { content: "⚠️"; }
.note { background: var(--info-soft); border-color: #c9d8f2; }
.note::before { content: "ℹ️"; }
.tip b, .warn b, .note b { color: inherit; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; margin: 16px 0; border: 1px solid var(--line); border-radius: var(--radius-m); }
table.tbl {
  width: 100%; border-collapse: collapse; font-size: 14px;
  background: var(--surface);
}
table.tbl th {
  background: var(--green-700); color: #fff;
  text-align: left; padding: 10px 14px; font-weight: 700; white-space: nowrap;
}
table.tbl td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: top; }
table.tbl tr:nth-child(even) td { background: var(--surface-strong); }
table.tbl td:first-child { font-weight: 700; color: var(--brown); white-space: nowrap; }

/* ---------- Steps ---------- */
ol.steps { list-style: none; padding: 0; counter-reset: step; margin: 16px 0; }
ol.steps li {
  counter-increment: step;
  position: relative;
  padding: 6px 0 6px 46px;
  margin: 0;
}
ol.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 8px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: var(--green-700); color: #fff;
  font-weight: 800; font-size: 13.5px;
  box-shadow: var(--shadow-1);
}
ol.steps li + li { border-top: 1px dashed var(--line); }
ol.steps li b { display: inline; }

/* ---------- Pill / kbd / role chips ---------- */
.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px; font-weight: 800;
  background: var(--green-100); color: var(--green-ink);
  border: 1px solid #f0c7c2;
  vertical-align: middle;
}
.pill.gold { background: #fdf0d2; color: var(--orange-700); border-color: #ecd9a4; }
.kbd {
  display: inline-block; padding: 1px 8px;
  border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 6px; background: var(--cream-soft);
  font-size: 12.5px; font-weight: 700; color: var(--brown);
}

/* ---------- Prev / next pager ---------- */
.pager {
  display: flex; gap: 12px; justify-content: space-between;
  margin-top: 34px; padding-top: 22px;
  border-top: 1px solid var(--line);
}
.pager a {
  flex: 1; min-width: 0;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface-strong);
  padding: 12px 16px;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.pager a:hover { transform: translateY(-2px); box-shadow: var(--shadow-1); }
.pager a.next { text-align: right; }
.pager .dir { font-size: 11.5px; font-weight: 800; letter-spacing: 0.1em; color: var(--muted); }
.pager .dest { font-weight: 800; color: var(--green-700); display: block; margin-top: 2px; }

/* ---------- Footer ---------- */
.footer {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 0 clamp(14px, 3vw, 32px) 40px;
  color: var(--muted);
  font-size: 13px;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between;
}

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .menu-btn { display: inline-flex; align-items: center; gap: 6px; }
  .sidebar {
    position: fixed;
    z-index: 50;
    top: 0; left: 0; bottom: 0;
    width: min(320px, 86vw);
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
    max-height: none;
    transform: translateX(-105%);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .sidebar-backdrop { display: block; }
  .search-kbd { display: none; }
  .pager { flex-direction: column; }
}
@media (max-width: 560px) {
  .search-input { padding-right: 16px; }
  .section { padding: 20px 16px 26px; border-radius: var(--radius-l); }
}

/* ---------- Search highlight flash ---------- */
.section.flash { animation: flash 1.6s ease; }
@keyframes flash {
  0% { box-shadow: 0 0 0 3px rgba(237,169,15,0.9), var(--shadow-1); }
  100% { box-shadow: var(--shadow-1); }
}

/* no-JS fallback: แสดงทุกหมัดเมื่อไม่มี JS */
noscript ~ .shell .section { display: block; }
