:root {
  color-scheme: light;
  --blue: #24324A;
  --blue-dark: #1B2638;
  --sage: #5E8B72;
  --paper: #F6F3EC;
  --surface: #FFFDFC;
  --ink: #1A2230;
  --muted: #5E6573;
  --line: #DED8CC;
  --red: #B42318;
  --shadow: 0 18px 40px rgba(36, 50, 74, .08);
  --font: "IBM Plex Sans Thai", "Leelawadee UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
}

img { max-width: 100%; height: auto; }

a {
  color: var(--blue);
  text-underline-offset: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -40px;
  z-index: 20;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  text-decoration: none;
}

.skip-link:focus { top: 12px; }

.page-wrap {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-logo,
.brand-mark img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-lockup strong {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.brand-lockup small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  color: #fff;
  background: var(--blue);
}

.btn-primary:hover { background: var(--blue-dark); }

.btn-lg {
  min-height: 52px;
  padding: 12px 22px;
  font-size: 17px;
}

.cmd {
  display: inline;
  padding: .12em .4em;
  border-radius: 6px;
  background: #EEF1F4;
  color: var(--blue);
  font: inherit;
  font-weight: 600;
}

#landing-root { display: block; }
#manage-root { display: none; }
html[data-view="manage"] #landing-root { display: none; }
html[data-view="manage"] #manage-root { display: block; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 8;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 92%, white);
  backdrop-filter: blur(10px);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
}

.header-cta {
  flex-shrink: 0;
  white-space: nowrap;
}

.hero { padding: 28px 0 20px; }

.hero-grid {
  display: grid;
  gap: 28px;
}

.hero-copy h1,
.landing h2 {
  margin: 0;
  text-wrap: balance;
  letter-spacing: -.04em;
  line-height: 1.18;
}

.hero-copy h1 {
  font-size: clamp(2.15rem, 8vw, 3.6rem);
  font-weight: 700;
}

.hero-copy > p,
.lede {
  max-width: 34rem;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-copy .btn { margin-top: 22px; }

.qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: fit-content;
  margin-top: 22px;
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}

.qr-card img {
  display: block;
  width: 160px;
  height: 160px;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
}

.qr-line { box-shadow: inset 0 0 0 1px rgba(36, 50, 74, .06); }

.qr-support {
  margin: 0;
  box-shadow: inset 0 0 0 1px rgba(94, 139, 114, .18);
}

.qr-support figcaption {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.qr-support strong {
  color: var(--ink);
  font-size: 15px;
}

.chat-sheet {
  padding: 14px 14px 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chat-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--blue);
  font-weight: 600;
  font-size: 14px;
}

.chat-top img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.chat-thread {
  display: grid;
  gap: 10px;
}

.row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.row.me { justify-content: flex-end; }

.bubble {
  max-width: min(100%, 22rem);
  margin: 0;
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.bubble.me {
  background: var(--blue);
  color: #f7f4ee;
  border-bottom-right-radius: 5px;
}

.bubble.me .cmd {
  background: rgba(255, 255, 255, .12);
  color: #fff;
}

.bubble.bot {
  background: #F3EEE4;
  color: var(--ink);
  border-bottom-left-radius: 5px;
}

.bot-mark {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: none;
}

.bot-stack { display: grid; gap: 8px; }

.keep-card {
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: min(100%, 22rem);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font-size: 13px;
  line-height: 1.35;
}

.keep-card > span:last-child { min-width: 0; }

.keep-card strong { display: block; font-size: 14px; }

.keep-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #ECE7DC;
  flex: none;
}

.time-gap {
  margin: 6px 0;
  color: var(--sage);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.band { padding: 56px 0; }
.band-tight { padding: 28px 0 56px; }

.landing h2 {
  font-size: clamp(1.7rem, 4vw, 2.35rem);
  font-weight: 700;
}

.flow-line {
  display: grid;
  gap: 0;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.flow-line li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 14px;
  align-items: start;
  padding-bottom: 22px;
  background: linear-gradient(var(--line), var(--line)) 13px 22px / 2px calc(100% - 22px) no-repeat;
}

.flow-line li:last-child {
  padding-bottom: 0;
  background: none;
}

.flow-num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.flow-line strong { display: block; font-size: 1.05rem; }
.flow-line p { margin: 4px 0 0; color: var(--muted); }
.cmd-example { margin-top: 10px !important; }

.silent-grid,
.support-grid,
.close-grid,
.free-band {
  display: grid;
  gap: 28px;
}

.quiet-sheet { max-width: 420px; }

.space-split {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.space-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.space-card h3 {
  margin: 0 0 14px;
  font-size: 15px;
}

.space-card ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}

.space-card ul li::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--sage);
}

.space-card.yours { box-shadow: var(--shadow); }

.space-card.theirs {
  opacity: .72;
  background: #F1EEE6;
}

.space-card.theirs p {
  margin: 0;
  color: var(--muted);
}

.inline-link { margin: 18px 0 0; }

.free-band,
.close-band .close-grid {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
}

.free-band { align-items: center; }

.support-grid p { margin: 12px 0 0; }
.support-grid .lede { margin-top: 12px; }

.fine-print {
  color: var(--muted);
  font-size: 13px;
}

.close-band { padding-bottom: 64px; }
.close-qr { display: none; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 36px;
  color: var(--muted);
  font-size: 14px;
}

.footer-row {
  display: grid;
  gap: 16px;
}

.site-footer nav,
.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.site-footer a { color: inherit; }

.legal {
  padding: 28px 0 72px;
}

.legal h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -.03em;
  line-height: 1.2;
}

.legal .lede { margin-top: 10px; }

.legal article {
  max-width: 40rem;
  margin-top: 28px;
}

.legal h2 {
  margin: 28px 0 8px;
  font-size: 1.15rem;
}

.legal p { margin: 0 0 12px; color: var(--muted); }

.shell { width: min(920px, calc(100% - 32px)); margin: 0 auto; }

.manage .masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.manage .hero { padding: 48px 0 28px; }
.manage .eyebrow {
  margin: 0 0 10px;
  color: var(--sage);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .18em;
}

.manage .hero h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: .95;
  letter-spacing: -.045em;
}

.manage .hero > p {
  max-width: 560px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.panel {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.state { padding: 42px 12px; color: var(--muted); text-align: center; }
.state.error { color: var(--red); }
.usage-row { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.label { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
#usage-text { font-size: 24px; }
.jumwai-code { margin: 12px 0 0; }
.jumwai-code strong { font-size: 16px; letter-spacing: .08em; }
.space-chip {
  padding: 6px 10px;
  border: 1px solid #c9dccf;
  border-radius: 999px;
  color: var(--sage);
  background: #edf4ef;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
}
.meter { height: 10px; margin-top: 16px; overflow: hidden; border-radius: 999px; background: #e6e2d8; }
.meter span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--sage); transition: width .25s ease; }

.toolbar { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 30px 0 14px; }
.search span, .date-filters span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.search input, .date-filters input { padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); font: inherit; }
.search input { width: min(320px, 70vw); }
.search input:focus, .date-filters input:focus { outline: 3px solid rgba(36, 50, 74, .15); border-color: var(--blue); }
.date-filters { display: flex; gap: 8px; }
.date-filters input { width: 150px; }
.count { color: var(--muted); font-size: 13px; }

.file-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.file { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 4px; border-bottom: 1px solid var(--line); }
.file-name { display: block; overflow: hidden; color: var(--ink); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { margin-top: 4px; color: var(--muted); font-size: 12px; }
.actions { display: flex; gap: 8px; }
.button { padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: white; font: inherit; font-size: 13px; text-decoration: none; cursor: pointer; }
.button:hover { border-color: var(--blue); }
.button.danger { color: var(--red); }
.button:disabled { opacity: .5; cursor: wait; }

.manage-foot { padding: 28px 0 40px; color: var(--muted); font-size: 12px; text-align: center; }

@media (min-width: 880px) {
  .hero { padding: 36px 0 24px; }
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 1.05fr);
    gap: 48px;
    align-items: center;
  }
  .qr-card img { width: 180px; height: 180px; }
  .flow-line {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    margin-top: 36px;
  }
  .flow-line li {
    grid-template-columns: 28px 1fr;
    padding-bottom: 0;
    background:
      linear-gradient(var(--line), var(--line)) 28px 13px / calc(100% - 28px) 2px no-repeat;
  }
  .flow-line li:last-child { background: none; }
  .silent-grid,
  .support-grid,
  .close-grid {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    gap: 48px;
    align-items: start;
  }
  .space-split { grid-template-columns: 1fr 1fr; gap: 28px; }
  .free-band { grid-template-columns: 1fr auto; }
  .close-qr { display: flex; }
  .footer-row {
    grid-template-columns: auto 1fr auto;
    align-items: center;
  }
  .site-footer nav { justify-content: center; }
}

@media (max-width: 560px) {
  .page-wrap { width: min(1180px, calc(100% - 28px)); }
  .header-cta {
    min-height: 40px;
    padding-inline: 12px;
    font-size: 14px;
  }
  .band { padding: 44px 0; }
  .panel { padding: 18px; border-radius: 16px; }
  .file { grid-template-columns: 1fr; }
  .actions { justify-content: flex-end; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search input { width: 100%; }
  .date-filters input { width: 100%; }
  .date-filters label { flex: 1; }
  .count { text-align: right; }
  .free-band, .close-band .close-grid { padding: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
