@font-face {
  font-family: Inter;
  src: url("/fonts/inter-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Inter;
  src: url("/fonts/inter-latin-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Manrope;
  src: url("/fonts/manrope-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Manrope;
  src: url("/fonts/manrope-latin-ext.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Inter;
  src: url("/fonts/inter-cyrillic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Manrope;
  src: url("/fonts/manrope-cyrillic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Noto Sans Thai";
  src: url("/fonts/noto-sans-thai.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}

:root {
  --ink: #12252c;
  --muted: #71838a;
  --secondary: #47565c;
  --line: #dde7e8;
  --line-strong: #b3c5c8;
  --bg: #f4f7f7;
  --bg-soft: #e6eef0;
  --sunken: #eef3f3;
  --accent: #67b300;
  --accent-hover: #5a9c00;
  --accent-soft: #eaf6da;
  --ok: #2e7d32;
  --ok-soft: #e6f4e2;
  --warn: #a8650a;
  --warn-soft: #faedd8;
  --display: Manrope, "Noto Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --body: Inter, "Noto Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--body);
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, .brand p { font-family: var(--display); }
code { font-family: ui-monospace, Menlo, monospace; font-size: 0.92em; }

.app {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}
#app[hidden], #gate[hidden] { display: none !important; }
.app.panel-open { grid-template-columns: 260px minmax(320px, 1fr) minmax(400px, 460px); }

.side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: white;
  border-right: 1px solid var(--line);
  overflow: auto;
}
.brand { padding: 22px 18px 10px; }
.brand img { width: 210px; height: auto; display: block; }
.brand p {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--secondary);
}
.side-label {
  margin: 22px 18px 8px;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.menu, .people, .lens { display: grid; gap: 4px; padding: 0 12px; }
.lens { padding-bottom: 8px; }
.lens button {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 8px 12px;
  text-align: left;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
}
.lens button:hover { background: var(--sunken); }
.lens button.on { background: var(--accent-soft); color: var(--ink); }
.menu button, .people button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
  color: var(--ink);
}
.menu button:hover, .people button:hover { background: var(--sunken); }
.menu button.on, .people button.on { background: var(--accent-soft); color: var(--ink); }
.menu b {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--sunken);
  font-family: var(--display);
  font-weight: 700;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--secondary);
  text-align: center;
}
.menu button.on b { background: var(--accent); color: var(--ink); }
.people button { align-items: flex-start; }
.people strong { display: block; font-family: var(--display); font-size: 14px; font-weight: 700; }
.people small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.35; }

.side-foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.lang { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.lang select, .settings input, .assign select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: white;
}
.ghost, .primary, .quiet {
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
  padding: 10px 12px;
}
.ghost { width: 100%; font-weight: 600; text-align: left; }
.ghost:hover { border-color: var(--line-strong); }
.ghost:disabled { opacity: 0.6; cursor: wait; }
#settings-btn.on { background: var(--accent-soft); border-color: transparent; }
.profile {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 4px 2px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-weight: 700;
  flex: none;
}
.profile strong { display: block; font-family: var(--display); font-size: 14px; font-weight: 700; }
.profile small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.settings { overflow: auto; min-height: 0; padding: 4px 24px 28px; }
.settings-stack { display: grid; gap: 16px; align-content: start; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid white;
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--line-strong);
}
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
.own-color {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--secondary);
}
.own-color input[type="color"] {
  width: 42px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.settings-card {
  max-width: 480px;
  display: grid;
  gap: 14px;
  padding: 22px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
}
.settings-card h2 { margin: 0; font-size: 22px; letter-spacing: -0.03em; }
.settings-card p { margin: 0; color: var(--secondary); font-size: 14px; line-height: 1.5; }
.whatsapp-qr {
  width: 220px;
  height: 220px;
  object-fit: contain;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.link-btn {
  justify-self: start;
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
}
.link-btn:hover { background: var(--accent-hover); }
.link-btn:disabled { opacity: 0.6; cursor: wait; }
.settings form { display: grid; gap: 10px; }
.settings label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.settings form button {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
}
.settings form button:hover { background: var(--accent-hover); }
.settings form button:disabled { opacity: 0.6; cursor: wait; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.hello-block { padding: 22px 24px 0; }
.hello-block h2 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.hello-facts {
  margin: 8px 0 0;
  max-width: 720px;
  color: var(--secondary);
  font-size: 16px;
  line-height: 1.5;
}
.bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  padding: 14px 24px 10px;
}
.bar h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.bar p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.verdict {
  margin: 0;
  max-width: 340px;
  padding: 10px 14px;
  border-radius: 14px;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  text-align: right;
}
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.issue { background: var(--warn-soft); color: var(--warn); }
.note, .status { margin: 0 24px 10px; font-size: 14px; line-height: 1.45; color: var(--secondary); }
.status { display: none; padding: 10px 12px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); }
.status.show { display: block; }
.status.good { background: var(--ok-soft); color: var(--ok); }

.stay-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 16px 12px;
}
.stay-filter[hidden] { display: none; }
.stay-filter button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
}
.stay-filter button b {
  min-width: 1.4em;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--sunken);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.stay-filter button.on {
  background: var(--accent-soft);
  border-color: transparent;
}
.stay-filter button.on b { background: white; color: var(--ink); }

.list {
  overflow: auto;
  min-height: 0;
  margin: 0 16px 16px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
}
.row {
  width: 100%;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: white;
  text-align: left;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--sunken); }
.row.on { background: var(--accent-soft); }
.dot { width: 8px; height: 8px; margin-top: 7px; border-radius: 99px; background: var(--warn); }
.dot.ok { background: var(--ok); }
.group-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  padding: 14px 18px 8px;
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.group-head span:last-child { letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums; }
.object-row { cursor: default; }
.object-row:hover { background: white; }
.dot.idle { background: var(--line-strong); }
.row h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.row .meta { margin: 4px 0 0; color: var(--secondary); font-size: 13px; }
.row .side-meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.empty-state { padding: 56px 28px; color: var(--secondary); }
.empty-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ok);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.empty-state.issue strong { color: var(--warn); }

.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin: 16px 16px 16px 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
}
.panel[hidden] { display: none !important; }
.panel-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.kicker {
  margin: 0;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel-bar h2 { margin: 6px 0 0; font-size: 22px; font-weight: 700; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.icon {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  font-size: 22px;
  line-height: 1;
}
.panel-body { overflow: auto; padding: 18px 18px 28px; }
.who-line { margin: 0 0 14px; color: var(--secondary); font-size: 14px; overflow-wrap: anywhere; }
.ticket {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
  background: white;
}
.ticket.focus { border-color: #c5e39a; background: #fbfff6; }
.ticket h3 { margin: 8px 0; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.chip {
  display: inline-block;
  margin-right: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.prep { background: var(--sunken); color: var(--muted); }
.quote { margin: 0 0 8px; color: var(--secondary); white-space: pre-wrap; overflow-wrap: anywhere; }
.step {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  min-height: 42px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.step input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--accent); }
.step small { display: block; color: var(--muted); }
.step.done span { color: var(--muted); }
.primary {
  background: var(--accent);
  color: var(--ink);
  border-color: var(--accent);
  border-radius: 999px;
  margin-top: 12px;
  font-family: var(--display);
  font-weight: 700;
}
.primary:hover { background: var(--accent-hover); }
.quiet {
  color: var(--ink);
  border-color: var(--line-strong);
  background: white;
  border-radius: 999px;
  margin-top: 8px;
  font-weight: 600;
}
.done-note { color: var(--ok); font-size: 13px; font-weight: 600; }
.thread { margin-top: 8px; }
.thread h3 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.msg { padding: 12px 0; border-top: 1px solid var(--line); }
.msg .by { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.msg p { margin: 6px 0; white-space: pre-wrap; line-height: 1.45; }
.msg.guest p { background: var(--bg-soft); border-radius: 14px; padding: 10px 12px; }
.assign { display: grid; gap: 6px; margin: 0 0 16px; font-size: 13px; color: var(--secondary); }

@media (max-width: 900px) {
  .app, .app.panel-open { grid-template-columns: 1fr; height: auto; min-height: 100vh; overflow: visible; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .menu, .people, .lens { display: flex; gap: 6px; overflow: auto; padding-bottom: 10px; }
  .menu button, .people button, .lens button { width: auto; white-space: nowrap; }
  .side-foot { margin-top: 0; }
  .list { min-height: 50vh; }
  .panel {
    position: fixed;
    top: 12px;
    right: 12px;
    bottom: 12px;
    width: min(460px, calc(100% - 24px));
    z-index: 5;
    margin: 0;
  }
  .verdict { text-align: left; }
  .bar { flex-direction: column; align-items: flex-start; }
  .hello-block { padding: 16px 16px 0; }
  .hello-block h2 { font-size: 26px; }
}

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.gate-card {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  padding: 28px 24px 22px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 20px;
}
.gate-card img { width: 220px; height: auto; display: block; }
.gate-kicker {
  margin: 0;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--secondary);
}
.gate-card h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: -0.03em;
}
.gate-card label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--secondary); }
.gate-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: white;
}
.gate-error {
  min-height: 1.2em;
  margin: 0;
  color: var(--warn);
  font-size: 13px;
  font-weight: 600;
}
.gate-submit {
  border: 0;
  background: var(--accent);
  color: var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: var(--display);
  font-weight: 700;
}
.gate-submit:hover { background: var(--accent-hover); }
.gate-submit:disabled { opacity: 0.6; cursor: wait; }

.side.menu-custom .menu button:hover,
.side.menu-custom .lens button:hover,
.side.menu-custom #settings-btn:hover {
  background: color-mix(in srgb, var(--menu) 14%, white);
}
.side.menu-custom .menu button.on,
.side.menu-custom .lens button.on,
.side.menu-custom #settings-btn.on {
  background: color-mix(in srgb, var(--menu) 18%, white);
  color: var(--ink);
  border-color: transparent;
}
.side.menu-custom .menu button.on b {
  background: var(--menu);
  color: var(--menu-on, #12252c);
}
