:root {
  --bg: #faf9f6;
  --surface: #f1efe7;
  --surface-2: #e9e6db;
  --line: #e2ded2;
  --ink: #161512;
  --muted: #7a765e;
  --gold: #c8932a;
  --gold-hover: #b07f22;
  --gold-ink: #161512;
  --gold-tint: #f6ead0;
  --green: #157a4d;
  --green-tint: #dcf1e5;
  --orange: #b45f10;
  --orange-tint: #fbe9d6;
  --red: #b3271f;
  --red-tint: #fbe1de;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-1: 0 1px 2px rgba(22,21,18,.06);
  --shadow-2: 0 8px 24px rgba(22,21,18,.10);
  --font: 'IBM Plex Sans Thai', 'Noto Sans Thai', -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { color: var(--gold-hover); }
h1, h2, h3 { margin: 0 0 .4em; font-weight: 800; letter-spacing: -.02em; }
.tnum { font-variant-numeric: tabular-nums; }

.eyebrow { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); font-weight: 700; }

.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -.15em; shape-rendering: crispEdges; fill: currentColor; }
.icon.lg { width: 1.4em; height: 1.4em; }
.icon-flip { transform: scaleX(-1); }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 10;
}
.topbar .brand { font-weight: 800; letter-spacing: -.02em; font-size: 16px; display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); }
.topbar .brand .icon { color: var(--gold); }
.topbar .brand small { color: var(--muted); font-weight: 500; margin-left: 2px; }
.topbar .spacer { flex: 1; }

.wrap { max-width: 960px; margin: 0 auto; padding: 28px 20px 90px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--line); background: var(--bg); color: var(--ink);
  padding: 10px 16px; border-radius: var(--radius-sm); font: inherit; font-weight: 700;
  cursor: pointer; min-height: 42px; box-shadow: var(--shadow-1);
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease, border-color .12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); border-color: var(--ink); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn.primary:hover { background: var(--gold-hover); border-color: var(--gold-hover); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn.ghost:hover { background: var(--surface); box-shadow: none; }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: 13px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }

.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow-1);
}
.card h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card h2 .icon { color: var(--gold); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }

input[type=text], input[type=password], select, textarea {
  font: inherit; padding: 10px 12px; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); width: 100%; background: #fff; color: var(--ink);
  transition: border-color .12s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
textarea { resize: vertical; min-height: 64px; }
label.field { display: block; margin-bottom: 10px; }
label.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.sent { background: var(--gold-tint); color: var(--gold-hover); }
.pill.draft { background: var(--surface); color: var(--muted); }
.pill.changes_requested { background: var(--orange-tint); color: var(--orange); }
.pill.approved { background: var(--green-tint); color: var(--green); }

.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 14px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: none; }

.link-chip {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px;
  background: var(--surface); border: 1px dashed var(--line);
  padding: 7px 11px; border-radius: 8px; word-break: break-all;
}
.copy-ok { color: var(--green); font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }

.empty { text-align: center; color: var(--muted); padding: 48px 10px; }
.empty .icon { color: var(--line); width: 2.4em; height: 2.4em; margin-bottom: 10px; }

.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .2s; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(0);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px;
  font-weight: 600; font-size: 14px; box-shadow: var(--shadow-2); z-index: 60;
  display: flex; align-items: center; gap: 8px; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-6px); }
.toast .icon { color: var(--gold); }

/* --- drag & drop upload zone --- */
.dropzone {
  border: 1.5px dashed var(--line); border-radius: var(--radius);
  padding: 22px; text-align: center; cursor: pointer; background: var(--surface);
  transition: border-color .12s ease, background-color .12s ease;
}
.dropzone:hover, .dropzone.drag { border-color: var(--gold); background: var(--gold-tint); }
.dropzone .icon { color: var(--gold); width: 1.8em; height: 1.8em; margin-bottom: 6px; }
.dropzone b { display: block; }
.dropzone input[type=file] { display: none; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15141a; --surface: #1c1b22; --surface-2: #232229; --line: #2c2a33; --ink: #f0eee8;
    --muted: #9b96a8; --gold-tint: #332815; --gold-ink: #15141a;
  }
  .card { background: #1a1920; }
  input[type=text], input[type=password], select, textarea { background: #1a1920; }
}

/* ---------------------------------------------------- custom cursor ---- */
html.cur-on, html.cur-on * { cursor: none !important; }
.cur-dot, .cur-ring { position: fixed; top: 0; left: 0; pointer-events: none; z-index: 9999; will-change: transform; }
.cur-dot {
  width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: var(--gold); transition: opacity .15s ease;
}
.cur-ring {
  width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
  border: 1.5px solid var(--ink); mix-blend-mode: difference;
  transition: width .18s ease, height .18s ease, margin .18s ease, opacity .15s ease, border-color .18s ease;
}
.cur-ring--big { width: 58px; height: 58px; margin: -29px 0 0 -29px; border-color: var(--gold); }
.cur-ring--down { width: 26px; height: 26px; margin: -13px 0 0 -13px; }
@media (max-width: 820px) {
  html.cur-on, html.cur-on * { cursor: auto !important; }
  .cur-dot, .cur-ring { display: none; }
}
