/* Ai ZaxBot — Settings v2 (one page per topic, #settings/<page>). Uses only the theme tokens from
   index.html :root so every theme (minimal / dark / light / emerald / rose / amber) works. 4/8px spacing. */

#view-settings {
  --st-good: color-mix(in srgb, var(--green) 62%, var(--ink));
  --st-bad: color-mix(in srgb, var(--red) 78%, var(--ink));
  --st-warn: color-mix(in srgb, var(--amber) 60%, var(--ink));
}
.st-page[hidden], .st-loaderr[hidden], .st-confirm[hidden], .st-guard[hidden], .st-toast[hidden], .st-pill[hidden] { display: none !important; }
.st :focus-visible, .st-guard :focus-visible, .st-toast :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.st .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout: left menu + page ---------- */
.st { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 28px; align-items: start; max-width: 1180px; margin: 0 auto; }
.st-main { min-width: 0; max-width: 860px; }
.st-nav { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); max-height: calc(100vh - 112px); overflow-y: auto; }
.st-glabel { padding: 14px 10px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; color: var(--faint); }
.st-link { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 10px; border-radius: 10px; color: var(--ink); font-size: 13.5px; text-decoration: none; transition: background .15s, color .15s; }
.st-link svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.st-link .st-ln { flex: 1; min-width: 0; }
.st-link:hover { background: var(--hover); }
.st-link.on { background: rgba(var(--accentRgb), .12); color: var(--accent); font-weight: 600; }
.st-link.on svg { color: var(--accent); }
.st-pill { flex: none; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(var(--accentRgb), .14); color: var(--accent); font-variant-numeric: tabular-nums; }
.st-pill:empty { display: none; }
.st-back { display: none; align-items: center; gap: 4px; min-height: 40px; margin: -6px 0 8px -4px; padding: 6px 8px; border: none; background: transparent; color: var(--accent); font-weight: 600; font-size: 14px; }
.st-back svg { width: 18px; height: 18px; }
.st-back:hover { background: var(--hover); }

/* ---------- page chrome ---------- */
.st-head { margin: 0 0 18px; }
.st-head h2 { margin: 0 0 4px; font-size: 20px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.st-head p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.st-subline b { color: var(--ink); }
.st-pastdue { display: inline-flex; align-items: center; gap: 4px; color: var(--st-bad); font-weight: 600; }
.st-card { margin-bottom: 16px; }
.st-card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.st-card-h h3 { margin: 0 0 3px; font-size: 15px; font-weight: 700; color: var(--ink); }
.st-card-h p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.st-callout { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 16px; padding: 11px 14px; border-radius: 12px; font-size: 13px; line-height: 1.55; color: var(--ink); background: rgba(var(--accentRgb), .08); border: 1px solid rgba(var(--accentRgb), .22); }
.st-callout svg.bi { margin-top: 2px; color: var(--accent); }
.st-ro { display: none; align-items: center; gap: 6px; margin-bottom: 14px; padding: 8px 12px; border-radius: 10px; font-size: 12.5px; color: var(--muted); background: var(--hover); border: 1px dashed var(--line2); }
.st-readonly .st-ro, .st:not(.st-owner) .st-ro-owner { display: flex; }
.st-readonly .st-page[data-shop] .st-bar, .st-readonly .st-mgr { display: none !important; }
.st-loaderr { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 10px 14px; border-radius: 12px; font-size: 13px; color: var(--st-bad); background: color-mix(in srgb, var(--red) 8%, var(--card)); border: 1px solid color-mix(in srgb, var(--red) 30%, var(--line)); }
.st-empty { padding: 22px 8px; text-align: center; font-size: 13px; color: var(--muted); }

/* ---------- fields ---------- */
.st-fields { display: flex; flex-direction: column; gap: 16px; }
.st-row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.st-f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.st-l { font-size: 13px; font-weight: 600; color: var(--ink); }
.st-f input:not([type="checkbox"]):not([type="range"]), .st-f textarea, .st-f select { width: 100%; }
.st textarea { resize: vertical; line-height: 1.55; }
.st-hint { font-size: 12px; line-height: 1.5; color: var(--muted); }
.st-err { font-size: 12px; font-weight: 500; color: var(--st-bad); }
.st-err:empty { display: none; }
.st [aria-invalid="true"] { border-color: var(--red) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent) !important; }
.st input:disabled, .st textarea:disabled, .st select:disabled { opacity: .7; cursor: not-allowed; }
.st button:disabled { opacity: .55; cursor: not-allowed; }
.st-inline { display: flex; align-items: center; gap: 8px; }
.st-inline input { flex: 1; min-width: 0; }
.st-inline button { flex: none; min-height: 38px; }
.st-dim { opacity: .55; }
.st .switch { min-height: 40px; min-width: 44px; justify-content: center; }
.st .switch .track { position: relative; } /* knob sits on the track, not the (taller) touch target */
.st-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.st-toggle-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.st-toggle-txt b { font-size: 14px; color: var(--ink); }
.st-toggle-txt span { font-size: 12.5px; line-height: 1.5; color: var(--muted); }

/* ---------- save bar (one per page) ---------- */
/* Quiet while nothing changed; floats (sticky card) once there is something to save. */
.st-bar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 16px; padding: 10px 12px 10px 16px; border-radius: 14px; border: 1px solid transparent; transition: border-color .18s, background .18s, box-shadow .18s; }
.st-bar.is-dirty { position: sticky; bottom: 12px; z-index: 5; background: var(--card); border-color: rgba(var(--accentRgb), .55); box-shadow: var(--shadow); }
.st-bar .st-save { min-height: 40px; min-width: 112px; font-weight: 600; }
.st-bar-in { position: static; margin: 16px 0 0; padding: 0; border: none; box-shadow: none; background: transparent; }
.st-msg { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); }
.st-msg.dirty { color: var(--st-warn); font-weight: 600; }
.st-msg.ok { color: var(--st-good); font-weight: 600; }
.st-msg.err { color: var(--st-bad); font-weight: 600; }

/* ---------- getting started ---------- */
.st-prog { margin-bottom: 6px; }
.st-prog-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; font-size: 14px; color: var(--ink); }
.st-prog-top span { font-size: 13px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.st-prog-track { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.st-prog-fill { height: 100%; width: 0; border-radius: 999px; background: var(--grad); transition: width .4s ease; }
.st-steps { list-style: none; margin: 8px 0 0; padding: 0; }
.st-step { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.st-steps .st-step:first-child { border-top: none; }
.st-sicon { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--muted); border: 2px solid var(--line2); font-variant-numeric: tabular-nums; }
.st-step.done .st-sicon { background: var(--green); border-color: transparent; color: #fff; }
.st-sbody { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.st-sbody b { font-size: 14px; color: var(--ink); }
.st-sbody span { font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.st-sbtn { min-height: 38px; white-space: nowrap; font-weight: 600; font-size: 13px; }
.st-sbtn.ghost { color: var(--accent); }
.st-sbtn.ghost:hover { background: var(--hover); }
.st-step--sk { display: block; height: 52px; margin: 6px 0; border: none; border-radius: 10px; background: linear-gradient(90deg, var(--hover), var(--card2), var(--hover)); background-size: 200% 100%; animation: st-sk 1.2s linear infinite; }
@keyframes st-sk { to { background-position: -200% 0; } }

/* ---------- hours ---------- */
.st-now { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 9px 12px; border-radius: 10px; font-size: 13px; color: var(--muted); background: var(--hover); }
.st-now::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.st-now.is-open { color: var(--st-good); font-weight: 600; } .st-now.is-open::before { background: var(--green); }
.st-now.is-closed { color: var(--st-warn); font-weight: 600; } .st-now.is-closed::before { background: var(--amber); }
.st-days { display: flex; flex-direction: column; }
.st-day { display: grid; grid-template-columns: 92px 48px auto minmax(0, 1fr); align-items: center; gap: 6px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.st-day:first-child { border-top: none; }
.st-dname { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.st-dtimes { display: inline-flex; align-items: center; gap: 6px; }
.st-dtimes input { width: 140px; font-variant-numeric: tabular-nums; }
.st-dash { color: var(--muted); }
.st-dnote { font-size: 12px; color: var(--muted); }
.st-day.closed .st-dtimes { display: none; }
.st-day.closed .st-dname { color: var(--muted); }

/* ---------- chips (holidays, handoff words) ---------- */
.st-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.st-chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 12px; border-radius: 999px; font-size: 13px; color: var(--ink); background: var(--card2); border: 1px solid var(--line2); }
.st-chip.past { opacity: .55; }
.st-chip-x { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; min-height: 30px; padding: 0; border: none; border-radius: 50%; background: transparent; color: var(--muted); }
.st-chip-x:hover { background: var(--hover); color: var(--st-bad); }
.st-chips-empty { font-size: 12.5px; color: var(--muted); }
.st-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.st-suggest:empty { display: none; }
.st-sug { padding: 5px 10px; min-height: 32px; border-radius: 999px; font-size: 12.5px; border-style: dashed; color: var(--muted); }
.st-sug:hover { color: var(--accent); }

/* ---------- sales policy ---------- */
.st-pct { font-size: 30px; line-height: 1; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.st-range { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; margin: 10px 0 6px; padding: 0; border: none; border-radius: 999px; background: linear-gradient(90deg, var(--accent) var(--p, 0%), var(--line2) var(--p, 0%)); cursor: pointer; }
.st-range:focus { box-shadow: none; }
.st-range::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--card); border: 3px solid var(--accent); box-shadow: var(--shadow); }
.st-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--card); border: 3px solid var(--accent); box-shadow: var(--shadow); }
.st-range:disabled { cursor: not-allowed; opacity: .6; }
.st-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.st-explain { margin-top: 14px; padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.7; color: var(--ink); background: var(--hover); border-left: 3px solid var(--accent); }
.st-explain.warn { border-left-color: var(--amber); }
.st-explain b { font-variant-numeric: tabular-nums; }

/* ---------- link cards (to other pages) ---------- */
.st-linkcard { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; padding: 16px 18px; border-radius: 14px; background: var(--card2); border: 1px solid var(--line); }
.st-linkcard > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 240px; }
.st-linkcard b { font-size: 14px; color: var(--ink); }
.st-linkcard span { font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.st-linkcard button, .st-btnlink { min-height: 40px; font-weight: 600; font-size: 13px; }
.st-btnlink { display: inline-flex; align-items: center; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line2); background: var(--card); color: var(--ink); }
.st-btnlink:hover { border-color: var(--accent); }

/* ---------- inline confirm (replaces confirm()) ---------- */
.st-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: 13px; color: var(--ink); background: color-mix(in srgb, var(--red) 7%, var(--card)); border: 1px solid color-mix(in srgb, var(--red) 28%, var(--line)); }
.st-confirm > span { flex: 1 1 220px; min-width: 0; line-height: 1.5; }
.st-confirm button { min-height: 36px; }
#view-settings .danger, .st-guard .danger { color: var(--st-bad); background: transparent; border: 1px solid color-mix(in srgb, var(--red) 45%, var(--line2)); }
#view-settings .danger:hover, .st-guard .danger:hover { background: color-mix(in srgb, var(--red) 10%, transparent); border-color: var(--red); }

/* ---------- channels / relay ---------- */
.chan-card .chdel { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; padding: 0; border-radius: 8px; color: var(--st-bad); }
.chan-card .chdel:hover { background: color-mix(in srgb, var(--red) 10%, transparent); }
.st-howto { margin-top: 16px; }
.st-howto .note { margin-top: -1px; border-top-left-radius: 0; border-top-right-radius: 0; line-height: 1.7; }
.st-howto code { word-break: break-all; }

/* ---------- roles table ---------- */
.st-tablecard { padding: 6px 20px 10px; overflow-x: auto; }
table.st-roles { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.st-roles th, .st-roles td { padding: 12px 8px; border-top: 1px solid var(--line); text-align: center; }
.st-roles thead th { border-top: none; font-size: 12px; font-weight: 700; color: var(--muted); }
.st-roles th[scope="row"], .st-roles thead th:first-child { text-align: left; font-weight: 500; color: var(--ink); }
.st-roles thead th:first-child { color: var(--muted); font-weight: 700; }
.st-yes { display: inline-flex; color: var(--st-good); }
.st-no { color: var(--faint); }
.st-who { display: none; }

/* ---------- PDPA customers ---------- */
.st-search { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 0 12px; border-radius: 10px; background: var(--input); border: 1px solid var(--line2); }
.st-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accentRgb), .18); }
.st-search svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.st-search input { flex: 1; min-width: 0; padding: 10px 0; border: none; background: transparent; box-shadow: none; }
.st-search input:focus { box-shadow: none; }
.st-cust-meta { padding: 12px 0 4px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.st-cust { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.st-cust .chico { width: 30px; height: 30px; border-radius: 8px; }
.st-cust-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.st-cust-main b { font-size: 13.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-cust-main span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.st-cust .st-cdel { min-height: 36px; }
.st-cust .st-confirm { grid-column: 1 / -1; margin-top: 0; }
#st-cust-list[aria-busy="true"] { opacity: .6; }

/* ---------- unsaved-changes dialog + toast ---------- */
.st-guard { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(10, 12, 24, .5); }
.st-guard-card { width: 100%; max-width: 440px; padding: 22px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.st-guard-card h3 { margin: 0 0 6px; font-size: 16px; font-weight: 700; color: var(--ink); }
.st-guard-card p { margin: 0 0 18px; font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.st-guard-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.st-guard-btns button { min-height: 40px; font-weight: 600; }
.st-toast { position: fixed; left: 50%; bottom: 24px; z-index: 85; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); padding: 8px 8px 8px 16px; border-radius: 12px; font-size: 13px; color: var(--card); background: var(--ink); box-shadow: var(--shadow); }
.st-toast b { font-weight: 700; }
.st-toast button { flex: none; min-height: 36px; font-size: 13px; font-weight: 600; }
.st-toast .st-toast-go { background: var(--card); color: var(--ink); border: none; }
.st-toast .st-toast-x { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; padding: 0; border: none; background: transparent; color: var(--card); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .st { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .st-nav { position: static; max-height: none; overflow: visible; padding: 0; background: transparent; border: none; box-shadow: none; }
  .st-glabel { padding: 16px 4px 8px; }
  .st-link { min-height: 52px; margin-bottom: 6px; padding: 12px 14px; font-size: 14.5px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
  .st-link::after { content: ""; flex: none; width: 8px; height: 8px; margin: 0 4px 0 6px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(-45deg); }
  .st-link.on { background: var(--card); color: var(--ink); font-weight: 500; }
  .st-link.on svg { color: var(--muted); }
  .st:not(.st-has-page) .st-main { display: none; }
  .st.st-has-page .st-nav { display: none; }
  .st-back { display: inline-flex; }
  .st-bar { bottom: 8px; }
  .st-bar .st-save { min-height: 44px; }
}
@media (max-width: 640px) {
  .st-row2 { grid-template-columns: minmax(0, 1fr); }
  .st-step { grid-template-columns: 32px minmax(0, 1fr); }
  .st-step .st-sbtn { grid-column: 2; justify-self: start; }
  .st-day { grid-template-columns: minmax(0, 1fr) 48px; }
  .st-dtimes, .st-dnote { grid-column: 1 / -1; }
  .st-dnote:empty { display: none; }
  .st-dtimes input { flex: 1; width: auto; min-width: 0; }
  .st-dtimes { display: flex; }
  .st-roles thead { display: none; }
  .st-roles tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 12px 0; border-top: 1px solid var(--line); }
  .st-roles tbody tr:first-child { border-top: none; }
  .st-roles th[scope="row"] { grid-column: 1 / -1; padding: 0 0 4px; border: none; }
  .st-roles td { display: flex; align-items: center; gap: 6px; padding: 0; border: none; font-size: 12px; text-align: left; }
  .st-who { display: inline; color: var(--muted); }
  .st-cust { grid-template-columns: auto minmax(0, 1fr); }
  .st-cust .st-cdel { grid-column: 2; justify-self: start; }
  .st-toggle-row { align-items: flex-start; }
  .st-guard-btns button { flex: 1 1 100%; }
  .st-toast { left: 16px; right: 16px; transform: none; flex-wrap: wrap; }
}

/* ---------- รายงานประจำวัน (Phase 3 — morning report page; markup built in settings.js) ---------- */
.rp .rp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; }
.rp .rp-btn svg { width: 16px; height: 16px; flex: none; }
.rp-plan .st-callout > svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--accent); }
.rp-plan-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rp-plan-txt b { font-weight: 600; }
.rp-plan a, .rp-plan-txt a { color: var(--accent); font-weight: 600; white-space: nowrap; }
.rp-warn { color: var(--st-warn); }
.rp-time { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.rp-time input[type="time"] { max-width: 160px; font-variant-numeric: tabular-nums; }
.rp-note { margin: 12px 0 0; }

/* link code */
.rp-code { margin-bottom: 14px; padding: 14px 16px; border-radius: 12px; background: rgba(var(--accentRgb), .07); border: 1px dashed rgba(var(--accentRgb), .45); }
.rp-code-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rp-code-l { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.rp-code-v { font-family: Inter, ui-monospace, monospace; font-size: 26px; font-weight: 700; letter-spacing: .08em; color: var(--ink); font-variant-numeric: tabular-nums; user-select: all; }
.rp-code-v.is-old { color: var(--faint); text-decoration: line-through; }
.rp-code-how { margin: 8px 0 4px; font-size: 13px; line-height: 1.55; color: var(--ink); }
.rp-code-exp { margin: 0; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rp-code-exp.is-bad { color: var(--st-bad); font-weight: 600; }

/* recipients */
.rp-targets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rp-t { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.rp-t:first-child { border-top: none; padding-top: 4px; }
.rp-t .chico, .rp-chico-off { width: 32px; height: 32px; border-radius: 9px; flex: none; }
.rp-chico-off { display: inline-block; background: var(--line2); }
.rp-t-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rp-t-main b { font-size: 14px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-t-main span { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.rp-t-main .rp-t-warn { color: var(--st-warn); }
.rp-t-main .rp-t-warn.is-bad { color: var(--st-bad); }
.rp-t-del { flex: none; min-height: 36px; }
.rp-t-del.is-armed { color: #fff; background: var(--red); border-color: transparent; }
.rp-empty { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 12px; background: var(--card2); border: 1px dashed var(--line2); }
.rp-empty > svg { width: 22px; height: 22px; flex: none; color: var(--muted); }
.rp-empty-t { font-size: 14px; font-weight: 600; color: var(--ink); }
.rp-empty-s { font-size: 12.5px; line-height: 1.5; color: var(--muted); margin-top: 2px; }

/* preview + history */
.rp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rp-prev-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: 12.5px; color: var(--muted); }
.rp-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--hover); white-space: nowrap; }
.rp-tag-ai { color: color-mix(in srgb, var(--accent) 75%, var(--ink)); background: rgba(var(--accentRgb), .12); }
.rp-text { margin: 0; padding: 14px 16px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line); font-family: "Noto Sans Thai", Inter, sans-serif; font-size: 13.5px; line-height: 1.65; color: var(--ink); white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto; }
.rp-status { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.rp-status:empty { display: none; }
.rp-status .is-ok { color: var(--st-good); font-weight: 600; }
.rp-status .is-bad { color: var(--st-bad); }
.rp-hist { list-style: none; margin: 0; padding: 0; }
.rp-hist > li + li { border-top: 1px solid var(--line); }
.rp-h summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 44px; padding: 8px 4px; cursor: pointer; list-style: none; border-radius: 8px; }
.rp-h summary::-webkit-details-marker { display: none; }
.rp-h summary::before { content: ""; flex: none; width: 7px; height: 7px; margin-right: 4px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(-45deg); transition: transform .15s; }
.rp-h[open] summary::before { transform: rotate(45deg); }
.rp-h summary:hover { background: var(--hover); }
.rp-h-day { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.rp-h-st { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.rp-h .rp-text { margin: 4px 0 12px; }
@media (max-width: 640px) {
  .rp .st-card-h > .rp-btn, .rp-actions { width: 100%; }
  .rp-actions .rp-btn { flex: 1 1 0; min-height: 44px; }
  .rp .st-card-h > .rp-btn { min-height: 44px; }
  .rp-code-v { font-size: 22px; }
  .rp-h-st { margin-left: 0; flex-basis: 100%; padding-left: 15px; }
}
