/* คลิปไว — one typeface, cool paper, ink text, hot-pink actions, 9:16 phone frame as the signature */
:root {
  --ink: #141B34;
  --ink-2: #4A5270;
  --ink-3: #7A8199;
  --paper: #F3F4F8;
  --surface: #FFFFFF;
  --line: #DCE0EA;
  --accent: #E8336D;
  --accent-ink: #B91D52;
  --accent-soft: #FDE7EF;
  --teal: #0C8C7B;
  --teal-soft: #DDF3EF;
  --amber: #B97A00;
  --amber-soft: #FFF2D6;
  --danger: #C8261A;
  --danger-soft: #FCE4E2;
  --radius: 10px;
  --radius-lg: 16px;
  --font: "IBM Plex Sans Thai", "Loma", "Noto Sans Thai", system-ui, sans-serif;
  --side: 236px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.65; color: var(--ink);
  background: var(--paper);
}
a { color: var(--accent-ink); text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.005em; }
h1 { font-size: 30px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p { margin: 0 0 1em; }
small, .muted { color: var(--ink-2); }
.tiny { font-size: 13px; color: var(--ink-3); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 22px 14px;
  background: var(--ink); color: #E7E9F2; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 18px; color: #fff; text-decoration: none; }
.brand-mark { width: 22px; height: 38px; border-radius: 6px; border: 3px solid var(--accent); position: relative; }
.brand-mark::after { content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-35%, -50%);
  border-left: 8px solid var(--accent); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.brand-name { font-size: 22px; font-weight: 700; }
.nav-group { margin: 14px 10px 4px; font-size: 13px; color: #8E94AE; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: #D5D8E5; text-decoration: none; font-size: 15px;
}
.nav a:hover { background: #222A48; color: #fff; }
.nav a[aria-current="page"] { background: #2A3356; color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.side-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid #2A3356; font-size: 14px; }
.side-foot form { margin: 0; }
.plan-chip { display: inline-block; padding: 2px 10px; border-radius: 99px; background: #2A3356; color: #fff; font-size: 13px; }
.linkbtn { background: none; border: 0; padding: 0; color: #B9BED3; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.main { min-width: 0; padding: 28px 40px 80px; }
.page { max-width: 1080px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: end; justify-content: space-between; margin-bottom: 22px; }
.page-head p { margin: 0; color: var(--ink-2); max-width: 62ch; }

.tabbar { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .main { padding: 18px 16px 96px; }
  h1 { font-size: 25px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--ink); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: #B9BED3; text-decoration: none; font-size: 11.5px; padding: 4px 0; }
  .tabbar a[aria-current="page"] { color: #fff; }
  .tabbar a[aria-current="page"] svg { color: var(--accent); }
  .tabbar svg { width: 21px; height: 21px; }
  .mobile-top { display: flex !important; }
}
.mobile-top { display: none; align-items: center; justify-content: space-between; margin-bottom: 16px; }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; }
.panel + .panel { margin-top: 16px; }
.panel-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.panel-title h2, .panel-title h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
@media (max-width: 980px) { .split { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.sticky { position: sticky; top: 20px; }

/* ---------- forms ---------- */
label { display: block; font-weight: 500; font-size: 15px; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.hint { font-size: 13.5px; color: var(--ink-3); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #fff;
  border: 1px solid #C9CEDC; border-radius: var(--radius); padding: 10px 12px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=color] { width: 52px; height: 40px; padding: 2px; border: 1px solid #C9CEDC; border-radius: 8px; background: #fff; }

/* segmented choices (radio pills) */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices input { position: absolute; opacity: 0; pointer-events: none; }
.choices label {
  margin: 0; font-weight: 500; font-size: 15px; padding: 8px 14px; border-radius: 99px; cursor: pointer;
  border: 1px solid #C9CEDC; background: #fff; color: var(--ink);
}
.choices input:checked + label { background: var(--ink); color: #fff; border-color: var(--ink); }
.choices input:focus-visible + label { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }
.choices.cards label { border-radius: 12px; padding: 10px 14px; min-width: 132px; }
.choices.cards label small { display: block; font-weight: 400; font-size: 13px; color: inherit; opacity: .75; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 400; margin: 6px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; font-size: 15.5px;
  padding: 10px 18px; border-radius: var(--radius); border: 1px solid transparent; cursor: pointer; text-decoration: none;
  background: var(--accent); color: #fff; line-height: 1.3;
}
.btn:hover { background: var(--accent-ink); }
.btn.big { padding: 13px 22px; font-size: 17px; }
.btn.ghost { background: #fff; color: var(--ink); border-color: #C9CEDC; }
.btn.ghost:hover { border-color: var(--ink); }
.btn.dark { background: var(--ink); }
.btn.dark:hover { background: #2A3356; }
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn.danger { background: #fff; color: var(--danger); border-color: #E9B8B3; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
form.inline { display: inline; margin: 0; }

/* ---------- messages ---------- */
.flash { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px; font-size: 15px; border: 1px solid; }
.flash.ok { background: var(--teal-soft); border-color: #A6DDD3; color: #075F53; }
.flash.error { background: var(--danger-soft); border-color: #F0B4AE; color: #8E1A11; }
.flash.warn { background: var(--amber-soft); border-color: #F2D28A; color: #6B4700; }
.demo-note { background: var(--amber-soft); border: 1px dashed #E0B85A; color: #6B4700; border-radius: var(--radius); padding: 10px 14px; font-size: 14px; margin-bottom: 16px; }
.empty { text-align: left; padding: 22px; border: 1px dashed #C9CEDC; border-radius: var(--radius-lg); color: var(--ink-2); background: #FAFBFD; }

/* ---------- quota meters ---------- */
.meters { display: grid; gap: 12px; }
.meter-top { display: flex; justify-content: space-between; font-size: 14.5px; }
.meter { height: 8px; background: #E6E9F1; border-radius: 99px; overflow: hidden; margin-top: 4px; }
.meter > span { display: block; height: 100%; background: var(--teal); border-radius: 99px; }
.meter.low > span { background: var(--amber); }
.meter.out > span { background: var(--danger); }

/* ---------- start tiles (dashboard) ---------- */
.starts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
@media (max-width: 860px) { .starts { grid-template-columns: 1fr; } }
.start {
  display: grid; grid-template-columns: 54px 1fr; gap: 16px; align-items: center; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px;
}
.start:hover { border-color: var(--ink); }
.start h3 { margin: 0 0 2px; }
.start p { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.mini-phone { width: 54px; aspect-ratio: 9/16; border-radius: 10px; border: 3px solid var(--ink); background: var(--accent-soft);
  display: grid; place-items: center; color: var(--accent-ink); }
.mini-phone svg { width: 22px; height: 22px; }

/* ---------- the phone frame (signature) ---------- */
.phone {
  position: relative; aspect-ratio: 9/16; width: 100%; border-radius: 26px; border: 7px solid var(--ink);
  background: #1F2642; overflow: hidden; box-shadow: 0 1px 0 #0002;
}
.phone::before { content: ""; position: absolute; top: 7px; left: 50%; width: 30%; height: 5px; transform: translateX(-50%);
  border-radius: 99px; background: #0009; z-index: 2; }
.phone video, .phone img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.phone .phone-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 18px;
  color: #D5D8E5; font-size: 14px; }
.phone .score { position: absolute; z-index: 3; left: 8px; bottom: 8px; background: #fff; color: var(--ink); border-radius: 99px;
  padding: 1px 9px; font-size: 12.5px; font-weight: 600; }
.clip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 22px 18px; }
@media (max-width: 560px) { .clip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; } .phone { border-width: 5px; border-radius: 20px; } }
.clip-card h3 { font-size: 15px; margin: 10px 0 4px; }
.clip-card .row { margin-top: 8px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #ffffff33; border-top-color: var(--accent); animation: spin 1s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- waiting for AI ---------- */
.busy-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--ink) 55%, transparent); }
.busy-overlay[hidden] { display: none; }
.busy-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: var(--radius-lg); padding: 28px 24px;
  text-align: center; box-shadow: 0 12px 40px #0003; }
.busy-card .spinner { width: 40px; height: 40px; border-color: var(--accent-soft); border-top-color: var(--accent); margin-bottom: 16px; }
.busy-card h2 { font-size: 19px; margin-bottom: 6px; }
.busy-card p { color: var(--ink-2); font-size: 15px; margin: 0; }
.busy-card .busy-time { margin-top: 14px; font-size: 14px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- lists & tables ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list a { color: var(--ink); text-decoration: none; font-weight: 500; }
.list a:hover { color: var(--accent-ink); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--ink-2); font-size: 13.5px; }
.table-wrap { overflow-x: auto; }
.tag { display: inline-block; font-size: 12.5px; padding: 1px 9px; border-radius: 99px; background: #E9ECF4; color: var(--ink-2); font-weight: 500; }
.tag.ok { background: var(--teal-soft); color: #075F53; }
.tag.warn { background: var(--amber-soft); color: #6B4700; }
.tag.bad { background: var(--danger-soft); color: #8E1A11; }
.tag.accent { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- script output ---------- */
.script { border-left: 4px solid var(--accent); padding-left: 16px; }
.script .hook { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.script ol { margin: 0 0 10px; padding-left: 22px; }
.script ol li { margin: 3px 0; }
.script .cta { font-weight: 600; color: var(--accent-ink); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 14px; font-size: 15px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }
details summary { cursor: pointer; font-weight: 500; }
.shots { counter-reset: s; }
.shot { display: grid; grid-template-columns: 54px 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.shot-no { width: 54px; aspect-ratio: 9/16; border-radius: 8px; border: 2px solid var(--ink); display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.prompt { font-size: 13.5px; background: #F5F6FA; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-top: 6px; color: var(--ink-2); white-space: pre-wrap; }

/* ---------- upload ---------- */
.drop { border: 2px dashed #B9C0D3; border-radius: var(--radius-lg); padding: 28px 20px; text-align: center; background: #FAFBFD; cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop strong { display: block; font-size: 17px; margin-bottom: 4px; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 12px; margin-top: 14px; }
.file { font-size: 12.5px; color: var(--ink-2); }
.file .thumb { aspect-ratio: 9/16; border-radius: 10px; background: #1F2642 center/cover no-repeat; border: 2px solid var(--ink); margin-bottom: 4px; position: relative; }
.file .thumb form { position: absolute; top: 4px; right: 4px; }
.file .thumb button { width: 24px; height: 24px; border-radius: 50%; border: 0; background: #fff; color: var(--ink); cursor: pointer; font-size: 15px; line-height: 1; }
.progress { height: 6px; background: #E6E9F1; border-radius: 99px; overflow: hidden; margin-top: 10px; display: none; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ---------- pricing ---------- */
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 860px) { .plans { grid-template-columns: 1fr; } }
.plan { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; display: flex; flex-direction: column; }
.plan.featured { border: 2px solid var(--ink); }
.price { font-size: 40px; font-weight: 700; line-height: 1; margin: 10px 0 4px; }
.price small { font-size: 16px; font-weight: 500; }
.plan ul { padding-left: 20px; margin: 16px 0 22px; flex: 1; }
.plan li { margin: 6px 0; font-size: 15px; }

/* ---------- landing ---------- */
.landing { max-width: 1100px; margin: 0 auto; padding: 24px 20px 80px; }
.land-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }
.land-top .brand { padding: 0; color: var(--ink); }
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
.hero h1 { font-size: clamp(34px, 5.5vw, 58px); line-height: 1.15; letter-spacing: -.02em; margin-bottom: 18px; }
.hero p { font-size: 19px; color: var(--ink-2); max-width: 34ch; }
.phones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: end; }
.phones .phone:nth-child(2) { transform: translateY(-28px); }
.phone .demo-ui { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 24px 10px 14px; }
.demo-ui .hk { align-self: center; background: var(--accent); color: #fff; font-weight: 700; font-size: 12px; padding: 4px 8px; border-radius: 4px; text-align: center; line-height: 1.35; }
.demo-ui .sb { color: #fff; font-weight: 600; font-size: 11.5px; text-align: center; text-shadow: 0 1px 2px #000, 0 0 3px #000; line-height: 1.4; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin: 70px 0 50px; }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } }
.step h3 { margin-bottom: 4px; }
.step-no { font-weight: 700; color: var(--accent); font-size: 15px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .panel { width: 100%; max-width: 420px; }
.auth .brand { color: var(--ink); justify-content: center; padding-bottom: 8px; }

/* ---------- receipt ---------- */
.receipt { max-width: 560px; }
@media print { .side, .tabbar, .no-print { display: none !important; } .shell { display: block; } .main { padding: 0; } .panel { border: 0; } }
.brand-by { display: block; font-size: 11px; font-weight: 500; opacity: .8; letter-spacing: .02em; margin-top: -2px; }
