/* GYG Hub — one stylesheet. Dense by default: this is a list of 90 tours that
   someone scans, not a page they read. Chrome stays quiet so the numbers carry
   the page. */

:root {
  --bg: #f7f8f9;
  --surface: #ffffff;
  --surface-2: #f2f4f6;
  --line: #e6e9ed;
  --line-soft: #eef1f4;
  --text: #14181f;
  --muted: #66707e;
  --faint: #98a2b0;
  --accent: #2f5fe0;
  --accent-soft: #eaf0fe;
  --net: #0b7a55;
  --good: #17794a;
  --good-soft: #e3f3ea;
  --warn: #a35a06;
  --warn-soft: #fbeed9;
  --bad: #b91c3c;
  --bad-soft: #fce8ec;
  --r: 10px;
  --font: "IBM Plex Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --nav-h: 52px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #161a21;
    --surface-2: #1d222b;
    --line: #262c36;
    --line-soft: #1f242d;
    --text: #e8ecf1;
    --muted: #9aa5b3;
    --faint: #6f7b8a;
    --accent: #6d97ff;
    --accent-soft: #1a2540;
    --net: #4ed3a0;
    --good: #4ecf8c;
    --good-soft: #142c1f;
    --warn: #e8ab5a;
    --warn-soft: #2f2410;
    --bad: #ff8298;
    --bad-soft: #351520;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0 0 .6em; }
.ic { flex: none; }
.tnum { font-variant-numeric: tabular-nums; }
.mut { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--nav-h);
  padding: 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.logo-dot {
  width: 18px; height: 18px; border-radius: 6px; flex: none;
  background: linear-gradient(140deg, var(--accent), #7b5cf0);
}

/* Whose data is on screen, and the way out of it, in one control. */
.cotag {
  display: flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 11px;
  margin-right: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cc, var(--accent));
  border-radius: 8px;
  font-size: 13.5px; font-weight: 600;
  white-space: nowrap;
  max-width: 46vw; overflow: hidden; text-overflow: ellipsis;
}
.cotag:hover { background: var(--surface-2); }
.cotag .ic { color: var(--muted); }

.topnav { display: flex; gap: 2px; }
.topnav a {
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
}
.topnav a:hover { background: var(--surface-2); color: var(--text); }
.topnav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.who {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px; font-weight: 500;
}
.who:hover { background: var(--surface-2); color: var(--text); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

main {
  max-width: 1120px;
  padding: 14px 12px calc(64px + env(safe-area-inset-bottom));
}
/* Detail and form pages read better in a column than stretched across a desk. */
main.narrow { max-width: 780px; }
/* No bottom tab bar on the personal tools, so no room reserved for one. */
main.notabs { padding-bottom: 40px; }

/* ---------- bottom tabs (phones) ---------- */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 2px 8px;
  color: var(--faint);
  font-size: 10.5px; font-weight: 500;
}
.tab.on { color: var(--accent); }

@media (min-width: 760px) {
  main { padding: 20px 20px 44px; }
  .tabbar, .only-phone { display: none !important; }
}
@media (max-width: 759px) {
  .only-wide { display: none !important; }
  .topnav { display: none; }
}

/* ---------- page head ---------- */

.phead {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.phead h1 { font-size: 17px; }
.phead .sum {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  font-size: 12.5px; color: var(--muted);
}
.phead .sum b { color: var(--text); font-weight: 600; }
.phead .rt { margin-left: auto; }

/* ---------- filters ---------- */

/* Four stacked selects would fill a phone screen before a single tour showed,
   so the filters pair up and only the search box gets a full row. */
.bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.bar .search { grid-column: 1 / -1; }
@media (min-width: 760px) {
  .bar { grid-template-columns: minmax(190px, 1fr) repeat(4, minmax(0, 145px)); }
  .bar .search { grid-column: auto; }
}

.search { position: relative; }
.search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { padding-left: 34px; }

input, select, textarea {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: 14px;
}
textarea { height: auto; min-height: 80px; padding: 8px 10px; line-height: 1.55; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
label.fld { display: block; margin-bottom: 11px; }
label.fld > span {
  display: block; margin-bottom: 4px;
  font-size: 12px; font-weight: 600; color: var(--muted);
}
.hint { font-size: 12.5px; color: var(--faint); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-sm { height: 31px; padding: 0 11px; font-size: 13px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }

/* ---------- the list ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  /* `clip` and not `hidden`: hidden makes the panel a scroll container, which
     silently breaks the sticky table header inside it. */
  overflow: clip;
}
.panel + .panel { margin-top: 14px; }
.panel-head {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px; font-weight: 600;
}
.panel-head .rt { margin-left: auto; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.panel-body { padding: 14px; }

table.list { width: 100%; border-collapse: collapse; }

table.list th {
  position: sticky;
  top: var(--nav-h);
  z-index: 10;
  padding: 7px 12px;
  text-align: left;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  color: var(--faint); text-transform: uppercase;
  white-space: nowrap;
}
table.list td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr:hover { background: var(--surface-2); }
table.list .num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }

.c-dest { color: var(--muted); font-size: 13px; white-space: nowrap; width: 1%; }
.c-dest.same { color: transparent; }
.c-title { font-weight: 500; line-height: 1.35; }
.c-title a { display: block; }
.c-title .sub {
  display: none;
  margin-top: 2px;
  font-size: 11.5px; font-weight: 400; color: var(--faint);
}
.c-opt { color: var(--muted); font-size: 13px; width: 1%; }
.c-gross { font-weight: 600; width: 1%; white-space: nowrap; }
.c-net { color: var(--net); font-weight: 700; width: 1%; white-space: nowrap; }
.c-status { width: 1%; }

/* Secondary line under a title: only worth the room where columns had to go. */
.c-title .sub-always { display: block; }

@media (max-width: 759px) {
  table.list th.h-dest, table.list th.h-opt, table.list th.h-status,
  table.list .hide-sm,
  .c-dest, .c-opt, .c-status { display: none; }
  table.list th, table.list td { padding: 9px 10px; }
  .c-title .sub { display: block; }
  .c-title a { font-size: 13.5px; }
  .c-gross, .c-net { font-size: 13.5px; }
}

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--surface-2); color: var(--muted);
  white-space: nowrap;
}
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad  { background: var(--bad-soft);  color: var(--bad); }
.badge-mute { background: var(--surface-2); color: var(--faint); }

.dot {
  display: inline-block;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--faint);
  vertical-align: 1px;
}
.dot-good { background: var(--good); }
.dot-warn { background: var(--warn); }
.dot-bad  { background: var(--bad); }

.empty { padding: 40px 16px; text-align: center; color: var(--faint); }

/* ---------- detail ---------- */

.back {
  display: inline-flex; align-items: center; gap: 5px;
  margin-bottom: 10px;
  font-size: 13px; color: var(--muted);
}
.back:hover { color: var(--text); }

.detail-title { font-size: 18px; line-height: 1.35; margin-bottom: 6px; }
.detail-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px 12px;
  font-size: 12.5px; color: var(--muted);
  margin-bottom: 14px;
}

/* Sized to the numbers, not to the page: three thirds of a wide screen leaves
   the figures marooned at opposite ends. */
.kpi { display: grid; grid-template-columns: repeat(3, minmax(0, 170px)) 1fr; gap: 1px;
       background: var(--line); border-bottom: 1px solid var(--line); }
.kpi > div { background: var(--surface); padding: 11px 14px; }
.kpi::after { content: ''; background: var(--surface); }
.kpi .k { font-size: 11px; font-weight: 600; color: var(--faint); letter-spacing: .02em; }
.kpi .v { font-size: 19px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .v.net { color: var(--net); }

/* ---------- calculator ---------- */

.calc-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  height: 31px; padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.crow {
  display: grid;
  grid-template-columns: 1fr 16px minmax(110px, 150px) 32px;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.crow:last-of-type { border-bottom: 0; }
.crow .arr { color: var(--faint); display: flex; justify-content: center; }
.cout {
  text-align: right;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  user-select: none;
}
.cout b { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.cout.copied b { color: var(--net); }
.cout small { color: var(--faint); margin-left: 3px; }

/* ---------- misc ---------- */

.flash {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 13px; margin-bottom: 12px;
  border-radius: 8px;
  font-size: 13.5px; font-weight: 500;
  background: var(--good-soft); color: var(--good);
}
.flash-bad { background: var(--bad-soft); color: var(--bad); }

.grid2 { display: grid; gap: 14px; }
@media (min-width: 760px) { .grid2 { grid-template-columns: 1fr 1fr; align-items: start; } }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rt { margin-left: auto; }

pre.code {
  margin: 0;
  padding: 12px 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
  font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  font-size: 11.5px; line-height: 1.6;
  white-space: pre;
}
code.kbd {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .88em;
}
.steps { counter-reset: s; display: grid; gap: 12px; }
.step { display: grid; grid-template-columns: 22px 1fr; gap: 10px; font-size: 13.5px; }
.step::before {
  counter-increment: s;
  content: counter(s);
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- login ---------- */

.authwrap {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}
.authcard {
  width: 100%; max-width: 350px;
  padding: 24px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.authlogo {
  display: flex; align-items: center; gap: 9px;
  margin-bottom: 3px;
  font-size: 17px; font-weight: 700; letter-spacing: -.02em;
}


/* ---------- company picker ---------- */

.pickwrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 14px calc(22px + env(safe-area-inset-bottom));
}
.pick { width: 100%; max-width: 720px; }

.pick-head {
  display: flex; align-items: center; gap: 11px;
  margin-bottom: 16px;
}
.pick-head h1 { font-size: 18px; }
.pick-head .icon-btn { margin-left: auto; }

.pick-cards { display: grid; gap: 12px; }
@media (min-width: 660px) { .pick-cards { grid-template-columns: 1fr 1fr; } }

.ccard {
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: clip;
  transition: border-color .12s ease, transform .12s ease;
}
.ccard:hover {
  border-color: var(--cc);
  transform: translateY(-1px);
}
.ccard-bar { width: 4px; background: var(--cc); flex: none; }
.ccard-body { flex: 1; min-width: 0; padding: 14px 4px 14px 15px; }
.ccard-name { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
.ccard-sub { margin-top: 2px; font-size: 12px; color: var(--faint); }

.ccard-stats {
  display: grid;
  grid-template-columns: repeat(4, auto);
  justify-content: start;
  gap: 0 20px;
  margin-top: 13px;
}
.ccard-stats .n {
  display: block;
  font-size: 19px; font-weight: 700; line-height: 1.15;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.ccard-stats .l { display: block; font-size: 11px; color: var(--faint); }

.ccard-go {
  display: flex; align-items: center;
  padding: 0 12px 0 4px;
  color: var(--faint);
}
.ccard:hover .ccard-go { color: var(--cc); }

.pick-tools {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
