/* SynkBoom Hire — mobile-first app shell. Rose accent on rose-tinted neutrals; bottom tab bar on phone, sidebar ≥900px. */
@import url('/fonts/kanit/500.css');
@import url('/fonts/kanit/600.css');
@import url('/fonts/plex/400.css');
@import url('/fonts/plex/500.css');
@import url('/fonts/plex/600.css');

:root {
  --bg: #FBF8F9; --surface: #FFFFFF; --sunk: #F4EEF1; --ink: #1D1720; --muted: #675C6B; --line: #ECE2E7;
  --accent: #C92B52; --accent-ink: #FFFFFF; --accent-soft: #FCE6EC;
  --ok: #17875C; --ok-soft: #E2F4EC; --warn: #9A5B07; --warn-soft: #FBF0DC; --bad: #BD2E27; --bad-soft: #FBE4E2;
  --info: #2C5FAD; --info-soft: #E5EDFA;
  --shadow: 0 1px 2px rgba(40, 10, 30, .06), 0 6px 20px -10px rgba(40, 10, 30, .18);
  --f-display: "Kanit", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --f-body: "IBM Plex Sans Thai", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 14px;
  --tab-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141016; --surface: #1D171F; --sunk: #261E29; --ink: #F3ECF0; --muted: #AC9DAA; --line: #342A37;
    --accent: #FF5C80; --accent-ink: #1A0D12; --accent-soft: #3B1B26;
    --ok: #42C795; --ok-soft: #173327; --warn: #EDA846; --warn-soft: #3A2A12; --bad: #F06A61; --bad-soft: #3D1A18;
    --info: #7FA8EE; --info-soft: #1A2840;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; line-height: 1.25; margin: 0; text-wrap: balance; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 17px; }
p { margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.ic { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 16px; height: 16px; }
.ic.lg { width: 24px; height: 24px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- layout ---------- */
#app { min-height: 100%; }
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.side { display: none; }
.main { flex: 1; min-width: 0; padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 24px); }
.page { max-width: 760px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 18px; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-in { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 10px; min-height: 44px; }
.topbar-in h1 { font-size: 22px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iconbtn {
  text-decoration: none;
  width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--ink); flex: none;
}
.iconbtn:hover { background: var(--sunk); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font: 600 15px var(--f-display); flex: none;
}

/* bottom tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--line);
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
}
.tab {
  display: grid; justify-items: center; gap: 2px; padding: 6px 0; min-height: 50px; color: var(--muted); text-decoration: none;
  font-size: 11.5px; font-weight: 500; border-radius: 12px;
}
.tab.on { color: var(--accent); }
.tab.plus .bubble {
  width: 46px; height: 46px; border-radius: 15px; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent);
}
.tab.plus { padding: 0; }

@media (min-width: 900px) {
  .tabbar { display: none; }
  .main { padding-bottom: 40px; }
  .side {
    display: flex; flex-direction: column; gap: 4px; width: 248px; flex: none; position: sticky; top: 0; height: 100vh;
    padding: 20px 14px; border-right: 1px solid var(--line); background: var(--surface);
  }
  .side .brand { display: flex; gap: 10px; align-items: center; padding: 6px 10px 18px; font: 600 18px var(--f-display); }
  .side a {
    display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 500;
  }
  .side a:hover { background: var(--sunk); }
  .side a.on { background: var(--accent-soft); color: var(--accent); }
  .side .cta { background: var(--accent); color: var(--accent-ink); margin: 6px 0 12px; justify-content: center; }
  .side .cta:hover { background: var(--accent); filter: brightness(1.05); }
  .side .grow { flex: 1; }
  .page, .topbar-in { max-width: 860px; }
}
.mark { width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 700 16px var(--f-display); }

/* grid children must be allowed to shrink, or one long nowrap line pushes the page wider than the phone */
.page > *, .list > *, .stack > *, .card > * { min-width: 0; }
.ic { display: inline-block; vertical-align: middle; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 10px; min-width: 0; }
.card.tap { cursor: pointer; transition: border-color .15s; }
.card.tap:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 10px; }
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 6px; }
.section-h h2 { font-size: 18px; }
.list { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.li { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-top: 1px solid var(--line); min-height: 56px; text-decoration: none; color: inherit; cursor: pointer; }
.li:first-child { border-top: 0; }
.li:hover { background: var(--sunk); }
.li .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .s { font-size: 13.5px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; min-width: 0; }
.kpi b { display: block; font: 600 26px/1.1 var(--f-display); font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12.5px; color: var(--muted); }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); display: grid; gap: 10px; justify-items: center; }
.empty .ic { width: 32px; height: 32px; opacity: .6; }

/* tags & chips */
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: var(--sunk); color: var(--muted); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.acc { background: var(--accent-soft); color: var(--accent); }
.tag.info { background: var(--info-soft); color: var(--info); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 500;
  cursor: pointer; min-height: 36px; display: inline-flex; align-items: center; gap: 6px;
}
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg { display: flex; background: var(--sunk); border-radius: 12px; padding: 3px; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 10px; padding: 9px 12px; font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap; min-height: 40px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 12px 18px;
  min-height: 48px; font-weight: 600; font-size: 16px; cursor: pointer; text-decoration: none; background: var(--accent); color: var(--accent-ink);
  transition: transform .08s, filter .15s;
}
.btn:active { transform: scale(.98); }
.btn:hover { filter: brightness(1.05); }
.btn.ghost { background: var(--sunk); color: var(--ink); }
.btn.line { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.small { min-height: 38px; padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .45; pointer-events: none; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-row.three { grid-template-columns: repeat(3, 1fr); }
.linkbtn { border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; padding: 8px 4px; min-height: 40px; }

/* forms */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 14px; font-weight: 600; }
.field .hint { font-size: 13px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 14px; font-size: 16px; min-height: 48px;
}
textarea.input { min-height: 220px; line-height: 1.6; resize: vertical; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; gap: 12px; align-items: center; min-height: 48px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.err { color: var(--bad); font-size: 14px; }

/* select cards (wizard) */
.pick { display: grid; gap: 8px; }
.pick-item {
  display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--r);
  padding: 14px; cursor: pointer; min-width: 0;
}
.pick-item.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.pick-item.off { opacity: .5; cursor: not-allowed; }
.pick-item .box { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line); display: grid; place-items: center; flex: none; margin-top: 1px; color: transparent; }
.pick-item.on .box { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pick-item .body { min-width: 0; flex: 1; display: grid; gap: 4px; }
.pick-item .pre { font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.steps span { height: 4px; border-radius: 2px; background: var(--line); }
.steps span.on { background: var(--accent); }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pos-card { border: 1.5px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 16px; cursor: pointer; display: grid; gap: 6px; text-align: left; }
.pos-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.pos-card b { font: 600 18px var(--f-display); }
.wizard-foot {
  position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); z-index: 10; background: linear-gradient(to top, var(--bg) 70%, transparent);
  padding: 16px 0 8px; display: grid; grid-template-columns: auto 1fr; gap: 8px;
}
@media (min-width: 900px) { .wizard-foot { bottom: 0; } }

/* images */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 4/5; border-radius: 12px; overflow: hidden; background: var(--sunk); cursor: pointer; border: 2px solid transparent; max-width: 100%; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.on { border-color: var(--accent); }
.thumb .ck { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: none; place-items: center; }
.thumb.on .ck { display: grid; }
.thumb .lb { position: absolute; left: 6px; right: 6px; bottom: 6px; font-size: 11.5px; font-weight: 600; color: #fff; background: rgba(0,0,0,.45); padding: 2px 7px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb.banned img { filter: grayscale(1) opacity(.45); }
.thumb.banned .lb { background: var(--bad); }
.thumb.add { display: grid; place-items: center; color: var(--muted); border: 2px dashed var(--line); background: transparent; }

/* runner */
.run-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.run-card .gname { font: 600 21px/1.3 var(--f-display); }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.preview { background: var(--sunk); border-radius: 12px; padding: 12px 14px; font-size: 14.5px; white-space: pre-wrap; max-height: 180px; overflow: auto; overflow-wrap: anywhere; }
.preview.open { max-height: none; }
.run-img { display: flex; gap: 12px; align-items: center; }
.run-img img { width: 64px; height: 80px; object-fit: cover; border-radius: 10px; flex: none; }
.countdown { font: 600 15px var(--f-display); font-variant-numeric: tabular-nums; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--line); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.q { background: var(--line); } .dot.skip { background: var(--muted); }

/* sheet (modal) */
.scrim { position: fixed; inset: 0; background: rgba(15, 5, 12, .45); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--bg); width: 100%; max-width: 640px; max-height: 92vh; max-height: 92dvh; overflow: auto; border-radius: 22px 22px 0 0;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: grid; gap: 14px; align-content: start;
}
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); justify-self: center; margin-bottom: 4px; }
.sheet-h { display: flex; align-items: center; gap: 10px; }
.sheet-h h2 { flex: 1; }
@media (min-width: 700px) { .scrim { align-items: center; } .sheet { border-radius: 22px; max-height: 86vh; } }
@media (prefers-reduced-motion: no-preference) {
  .scrim { animation: fade .18s ease-out; }
  .sheet { animation: rise .24s cubic-bezier(.2, .8, .2, 1); }
  @keyframes fade { from { opacity: 0; } }
  @keyframes rise { from { transform: translateY(40px); opacity: .6; } }
}

/* toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 16px); z-index: 80;
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 500; box-shadow: var(--shadow); max-width: calc(100% - 32px);
  display: flex; gap: 8px; align-items: center;
}
@media (min-width: 900px) { .toast { bottom: 24px; } }

/* auth */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.auth-box { width: 100%; max-width: 400px; display: grid; gap: 18px; }
.auth-brand { display: grid; gap: 10px; justify-items: start; }
.auth-brand .mark { width: 48px; height: 48px; border-radius: 14px; font-size: 22px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#gbtn { min-height: 44px; display: flex; justify-content: center; }

.report { white-space: pre-wrap; font-size: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; max-height: 420px; overflow: auto; overflow-wrap: anywhere; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
