@font-face { font-family: "Plex Thai"; src: url(fonts/IBMPlexSansThai-Regular.ttf); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Thai"; src: url(fonts/IBMPlexSansThai-SemiBold.ttf); font-weight: 600; font-display: swap; }
@font-face { font-family: "Plex Thai"; src: url(fonts/IBMPlexSansThai-Bold.ttf); font-weight: 700; font-display: swap; }

:root {
  --bg: #f3f2ef; --card: #ffffff; --ink: #1a1a1a; --muted: #6d6a64; --line: #e3e0da; --soft: #f7f6f3;
  --bar: #0f0f0f; --accent: #1a1a1a; --danger: #a8322a;
  --ok-bg: #e5f2e8; --ok: #1d6a36; --warn-bg: #fdf0d5; --warn: #855700; --info-bg: #e3edf9; --info: #1f4f8a;
  --mute-bg: #ecebe8; --hide-bg: #f4e4e2;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 "Plex Thai", -apple-system, "Thonburi", sans-serif; }
a { color: inherit; }
img { display: block; max-width: 100%; }
h1 { font-size: 22px; margin: 0; font-weight: 700; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 700; }
small, .muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* top bar */
.bar { background: var(--bar); color: #fff; position: sticky; top: 0; z-index: 20; }
.bar-in { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 22px; padding: 10px 20px; }
.bar .brand img { height: 34px; width: auto; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; padding: 7px 12px; border-radius: 8px; color: #bdbab3; white-space: nowrap; font-weight: 600; font-size: 14px; }
.nav a:hover { color: #fff; }
.nav a.on { color: #fff; background: #2a2a2a; }
.nav .add { background: #fff; color: #111; margin-left: 6px; }
.nav .add:hover { color: #111; background: #e9e7e2; }
.bar .switch { color: #bdbab3; text-decoration: none; font-size: 13px; font-weight: 600; border: 1px solid #3a3a3a; border-radius: 999px; padding: 4px 11px; white-space: nowrap; }
.bar .switch:hover { color: #fff; border-color: #666; }
.bar .brand-text { font-weight: 700; font-size: 17px; padding: 6px 0; }
.p-shemise .bar { background: #2b2b2b; }
.p-shemise .nav a.on { background: #444; }

main { max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head .sub { color: var(--muted); margin-top: 2px; }
.crumb { font-size: 13px; color: var(--muted); text-decoration: none; display: inline-block; margin-bottom: 4px; }

/* flash */
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 600; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--hide-bg); color: var(--danger); }

/* cards & grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 16px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cols-side { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.stack > * + * { margin-top: 16px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; display: block; }
.kpi .label { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi .value { font-size: 28px; font-weight: 700; line-height: 1.2; margin-top: 2px; }
.kpi .note { font-size: 13px; color: var(--muted); }
a.kpi:hover { border-color: #c9c5bd; }

/* chips */
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.chip.available, .chip.shipped { background: var(--ok-bg); color: var(--ok); }
.chip.auction, .chip.unpaid { background: var(--warn-bg); color: var(--warn); }
.chip.paid { background: var(--info-bg); color: var(--info); }
.chip.sold, .chip.cancelled, .chip.closed { background: var(--mute-bg); color: #4a4843; }
.chip.hidden { background: var(--hide-bg); color: var(--danger); }
.chip.open { background: var(--warn-bg); color: var(--warn); }

/* tabs / filters */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs a { text-decoration: none; padding: 6px 13px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.tabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tabs a .n { color: var(--muted); font-weight: 400; margin-left: 4px; }
.tabs a.on .n { color: #bbb; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters input { width: auto; }
.filters .q { flex: 1 1 220px; }
.filters .chest { width: 88px; }

/* shirt grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; display: block; position: relative; }
.tile:hover { border-color: #c9c5bd; }
.tile .img { aspect-ratio: 1; background: #222; }
.tile .img img { width: 100%; height: 100%; object-fit: cover; }
.tile .img.dim img { opacity: .45; }
.tile .meta { padding: 9px 11px 11px; }
.tile .code { font-weight: 700; }
.tile .brand { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .size { font-size: 13px; }
.tile .chip { position: absolute; top: 8px; right: 8px; }
.tile .pending { position: absolute; inset: 0; display: grid; place-items: center; color: #ddd; font-size: 13px; }
.tile label.pick { position: absolute; inset: 0; cursor: pointer; }
.tile input.pick { position: absolute; top: 10px; left: 10px; width: 22px; height: 22px; accent-color: #111; z-index: 2; }
.tile.picked { outline: 3px solid var(--ink); outline-offset: -3px; }

.stars { color: #b07d10; letter-spacing: 1px; font-weight: 700; }
.tile .est { font-size: 13px; color: var(--muted); }
.filters .sort { width: auto; flex: 0 1 auto; }

/* shop order */
.olist { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.orow { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--card); transition: background .4s; }
.orow:last-child { border-bottom: 0; }
.orow .handle { cursor: grab; touch-action: none; user-select: none; font-size: 22px; color: #9b968d; padding: 6px 4px; line-height: 1; }
.orow .pos { width: 58px; flex: none; text-align: center; padding: 6px 4px; font-weight: 700; }
.orow .grow { flex: 1; min-width: 0; }
.orow .reason { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orow.dragging { background: #fff8e6; box-shadow: 0 6px 18px rgba(0,0,0,.15); position: relative; z-index: 2; }
.orow.dragging .handle { cursor: grabbing; }
.orow.moved { background: #fff3cf; }

/* tables / lists */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
.row-link { text-decoration: none; font-weight: 600; }
.thumb { width: 52px; height: 52px; max-width: none; flex: none; border-radius: 8px; object-fit: cover; background: #222; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.empty { color: var(--muted); padding: 22px 0; text-align: center; }

/* forms */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; color: inherit; background: #fff; border: 1px solid #d6d2ca; border-radius: 9px; padding: 9px 11px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #1a1a1a22; border-color: #8d887f; }
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: 12px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 700; font-size: 14px;
  padding: 9px 16px; border-radius: 9px; border: 1px solid var(--ink); background: var(--ink); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #333; }
.btn.ghost { background: #fff; color: var(--ink); border-color: #cfcac1; }
.btn.ghost:hover { background: var(--soft); }
.btn.danger { background: #fff; color: var(--danger); border-color: #e2bdb9; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.wide { width: 100%; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
form.inline { display: inline; }

/* page picker */
.pages { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.pagecard { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.pagecard:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.12); }
.pc-top { height: 190px; display: grid; place-items: center; background-size: cover; background-position: center; }
.pc-logo { max-height: 120px; max-width: 80%; width: auto; }
.pc-logo.pc-cas { max-height: 90px; }
.pc-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.pc-name { font-size: 20px; font-weight: 700; }
.pc-ep { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pc-epname { font-weight: 700; font-size: 17px; }
.pc-ep small { flex-basis: 100%; }
.pc-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.pc-stats span { background: var(--soft); border-radius: 10px; padding: 8px 6px; text-align: center; font-size: 12px; color: var(--muted); line-height: 1.3; }
.pc-stats b { display: block; font-size: 20px; color: var(--ink); }
.pc-stats .hot { background: var(--warn-bg); color: var(--warn); }
.pc-stats .hot b { color: var(--warn); }
.pc-go { margin-top: auto; font-weight: 700; }

/* EP list */
.eps { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.epcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; display: flex; flex-direction: column; }
.epcard:hover { border-color: #c9c5bd; }
.ep-covers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; background: #222; }
.ep-covers img, .ep-covers span { aspect-ratio: 1; width: 100%; object-fit: cover; background: #2a2a2a; }
.ep-body { padding: 12px 14px 14px; }
.ep-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ep-name { font-size: 20px; font-weight: 700; }
.ep-when { display: block; margin-top: 2px; }
.ep-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 14px; color: var(--muted); }
.ep-stats b { color: var(--ink); }

/* EP page */
.seg { display: inline-flex; background: #e6e3dd; border-radius: 11px; padding: 3px; margin-bottom: 14px; gap: 2px; }
.seg button { font: inherit; font-weight: 700; font-size: 14px; border: 0; background: none; padding: 8px 16px; border-radius: 9px; cursor: pointer; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.epfilters { justify-content: space-between; }
.tile .bid { font-size: 17px; font-weight: 700; color: var(--ok); line-height: 1.3; margin-top: 1px; }
.tile .bid small { font-size: 12px; font-weight: 600; color: var(--muted); }
.tile .bid.none { font-size: 13px; font-weight: 600; color: var(--muted); }
.tile .bid.won { color: var(--ink); }
.tile .bid.closed { color: #b4541a; font-size: 15px; }
.chip.fbclosed { background: #ffe1cc; color: #a3430f; }
.kpi.alert { border-color: #f0b48a; background: #fff6ef; }
.kpi.alert .note { color: #a3430f; font-weight: 700; }
.close-row.is-closed td { background: #fff6ef; }
.seg .badge { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: #d4621f; color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
.live { display: inline-flex; align-items: center; gap: 7px; margin-top: 6px; font-size: 13px; color: var(--ok); background: var(--ok-bg); border-radius: 999px; padding: 3px 11px 3px 9px; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: #2e9a52; animation: pulse 2s infinite; }
.live.off { color: var(--muted); background: var(--mute-bg); }
.live.off .dot { background: #9b968d; animation: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.ep-stats .hot, .ep-stats .hot b { color: #a3430f; }
.tile[hidden] { display: none; }
.bidbox { display: flex; justify-content: space-between; align-items: end; gap: 10px; background: var(--ok-bg); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.bidbox .bid { font-size: 22px; font-weight: 700; color: var(--ok); }
.bidbox .bid small { font-size: 12px; color: var(--muted); }
.bidbox .bid.none { font-size: 15px; color: var(--muted); }
.fbposts .thumb { width: 64px; height: 64px; }

/* settings: Facebook */
.fbcard summary { cursor: pointer; font-weight: 700; margin-bottom: 8px; }
.steps { margin: 6px 0 14px; padding-left: 22px; }
.steps li { margin-bottom: 6px; }
.steps code { background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 13px; }
.fbcard .fields { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }

/* shirt page */
.cover-big { border-radius: var(--radius); overflow: hidden; background: #222; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 10px; }
.photos img { aspect-ratio: 3/4; object-fit: cover; width: 100%; border-radius: 8px; cursor: zoom-in; background: #ddd; }
.photos .sz { position: relative; }
.photos .sz::after { content: "ไซส์"; position: absolute; left: 6px; bottom: 6px; background: #111; color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.caption { font-family: inherit; white-space: pre-wrap; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 14px; margin: 0 0 10px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; font-weight: 600; }
.pager { display: flex; gap: 8px; }

/* new shirt picker */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin: 10px 0 14px; }
.pick-grid .ph { border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: var(--soft); }
.pick-grid .ph img { aspect-ratio: 3/4; object-fit: cover; width: 100%; }
.pick-grid .ph.front { border-color: #111; }
.pick-grid .ph.back { border-color: #8d887f; }
.pick-grid .ph .tags { display: flex; gap: 4px; padding: 6px; flex-wrap: wrap; }
.pick-grid .ph button { flex: 1; font: inherit; font-size: 12px; font-weight: 700; padding: 4px 0; border-radius: 6px; border: 1px solid #cfcac1; background: #fff; cursor: pointer; }
.pick-grid .ph button.on { background: #111; color: #fff; border-color: #111; }

/* lightbox */
.lb { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 50; display: none; align-items: center; justify-content: center; }
.lb.on { display: flex; }
.lb img { max-width: 94vw; max-height: 90vh; object-fit: contain; }
.lb button { position: absolute; background: none; border: 0; color: #fff; font-size: 34px; cursor: pointer; padding: 16px; }
.lb .x { top: 4px; right: 8px; }
.lb .prev { left: 4px; } .lb .next { right: 4px; }

/* round close sheet */
.close-row td { padding: 8px 6px; }
.close-row input { padding: 7px 9px; }
.close-row .w { min-width: 150px; }
.close-row .p { width: 96px; }

/* shipping */
.ship-canvas { width: 100%; max-width: 600px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }

.foot { color: var(--muted); font-size: 13px; text-align: center; padding: 26px 0 0; }
.phone { font-weight: 700; color: var(--ink); }

/* อัพ EP ใหม่ */
.btn.big { font-size: 16px; padding: 12px 22px; border-radius: 11px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.chip.draft { background: var(--info-bg); color: var(--info); }
.fields-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) auto; align-items: end; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 130px; border: 2px dashed #cfcac1;
  border-radius: 14px; background: var(--soft); cursor: pointer; text-align: center; padding: 16px; margin: 0; color: var(--ink); }
.drop.over { border-color: var(--ink); background: #fff8e6; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-big { font-size: 18px; font-weight: 700; }
.picked { margin-top: 10px; }
.gobar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.gobar > div { flex: 1 1 260px; }
.gobar .goal-bar { flex-basis: 100%; order: 3; }
#msg.bad { color: var(--danger); font-weight: 600; }
.pgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); max-height: 640px; overflow-y: auto; padding: 2px; }
.tile .chip.auction { left: auto; }

.stepper { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.stepper li { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.stepper .dotnum { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--mute-bg); }
.stepper li.done { color: var(--ink); }
.stepper li.done .dotnum { background: var(--ok-bg); color: var(--ok); }
.stepper li.now { color: var(--ink); }
.stepper li.now .dotnum { background: var(--ink); color: #fff; animation: pulse 1.6s infinite; }
.stepper li.bad .dotnum { background: var(--danger); animation: none; }
.stepper small { display: block; }

.checklist .orow { flex-direction: column; align-items: stretch; gap: 0; }
.orow-main { display: flex; align-items: center; gap: 10px; }
.posn { width: 30px; text-align: center; font-weight: 700; color: var(--muted); flex: none; }
.thumb.big { width: 76px; height: 76px; }
.pending-thumb { display: grid; place-items: center; color: #ddd; font-size: 11px; text-align: center; }
.checklist .reason { color: #5b4a1e; display: inline; white-space: normal; }
.flaw { color: #a3430f; }
.flaw::before { content: "สภาพ: "; font-weight: 700; }
.orow-edit { padding: 12px 0 4px 40px; }
.orow-edit .fields { gap: 0 10px; }
.strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 4px 0 12px; }
.strip .ph img { aspect-ratio: 3/4; object-fit: cover; width: 100%; border-radius: 8px; cursor: zoom-in; background: #ddd; }
.strip .ph form { margin-top: 4px; }
.strip .ph .btn { width: 100%; padding: 3px 4px; font-size: 12px; }
details.card summary { cursor: pointer; }

/* posting / goals / money */
.postbox { margin-bottom: 16px; border-color: #f0d28a; background: #fffaf0; }
.goal { margin-top: 10px; }
.goal-bar { height: 10px; border-radius: 99px; background: var(--mute-bg); overflow: hidden; display: flex; margin: 6px 0 4px; }
.goal-bar span { display: block; height: 100%; background: #2e9a52; transition: width .4s; }
.goal-bar span.wait { background: #e8c26b; }
.ep-profit { display: block; margin-top: 4px; }
.neg { color: var(--danger) !important; }
.in { color: var(--ok); }
.out { color: var(--danger); }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.monthnav { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.monthnav b { min-width: 150px; text-align: center; }
tr.on td { background: var(--soft); }
.nowrap { white-space: nowrap; }
.segopt { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 7px 14px; border-radius: 9px; cursor: pointer; font-size: 14px; color: var(--muted); }
.segopt input { width: auto; }
.segopt:has(input:checked) { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.moneycard { display: flex; align-items: center; gap: 16px 24px; flex-wrap: wrap; margin-top: 18px; text-decoration: none; }
.moneycard:hover { border-color: #c9c5bd; }
.mc-nums { display: flex; gap: 8px 22px; flex-wrap: wrap; flex: 1; color: var(--muted); }
.mc-nums b { color: var(--ink); font-size: 19px; margin-left: 4px; }
.moneycard .pc-go { margin-top: 0; }
.bar a.brand-text { color: #fff; text-decoration: none; }

/* login / people */
.bar .who { color: #bdbab3; text-decoration: none; font-size: 13px; font-weight: 600; white-space: nowrap; margin-left: auto; }
.bar .who:hover { color: #fff; }
.linkbox { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; word-break: break-all; }
.pwbox { position: relative; }
.pwbox summary { list-style: none; }
.pwbox summary::-webkit-details-marker { display: none; }
.pwbox[open] .inline-form { position: absolute; right: 0; top: 36px; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; gap: 6px; width: 290px; box-shadow: 0 6px 18px rgba(0,0,0,.12); }

@media (max-width: 900px) {
  .cols, .cols-side { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .fields-3, .fields-4 { grid-template-columns: minmax(0, 1fr); }
  .kpis-3 { grid-template-columns: minmax(0, 1fr); }
  .orow-edit { padding-left: 0; }
  .thumb.big { width: 62px; height: 62px; }
  .gobar .btn.big { width: 100%; }
  .bar-in { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px 8px; }
  .bar .brand { display: flex; justify-content: center; }
  .bar .brand img { height: 28px; }
  .bar .switch { position: absolute; right: 12px; top: 12px; }
  .bar .who { position: absolute; left: 12px; top: 14px; font-size: 12px; max-width: 30%; overflow: hidden; text-overflow: ellipsis; }
  .bar-in { position: relative; }
  .pc-top { height: 150px; }
  .eps { grid-template-columns: minmax(0, 1fr); }
  .tile .bid { font-size: 16px; }
  .head .actions .btn { font-size: 13px; padding: 7px 11px; }
  main { padding: 16px 12px 50px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 14px; }
  .kpi .value { font-size: 24px; }
  .hide-sm { display: none; }
  .filters .q { flex-basis: 100%; }
  .filters .chest { flex: 1 1 0; width: auto; }
  .close-row td { padding: 8px 3px; }
  .close-row .thumb { width: 44px; height: 44px; }
  .close-row .w { min-width: 0; }
  .close-row .p { width: 72px; }
  .filters .sort { flex-basis: 100%; }
  .orow { gap: 7px; padding: 8px; }
  .orow .pos { width: 48px; }
  .orow .thumb { width: 46px; height: 46px; }
  table.stack-sm thead { display: none; }
  table.stack-sm td { display: block; border: 0; padding: 4px 0; }
  table.stack-sm tr { display: block; border-bottom: 1px solid var(--line); padding: 10px 0; }
}

/* bids: totals, the page answering bids, back to the last shirt */
.kpi.hero { background: #161616; border-color: #161616; color: #fff; }
.kpi.hero .label { color: #cfcac1; }
.kpi.hero .label small { color: #8f8a82; font-weight: 400; }
.kpi.hero .value { font-size: 32px; color: #9be3b0; }
.kpi.hero .note { color: #bdb8af; }
.kpi .value small { font-size: 15px; color: var(--muted); font-weight: 600; }
.sumline { min-height: 22px; margin: -6px 0 12px; font-size: 14px; color: var(--muted); }
.sumline b { color: var(--ink); }
.engage { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; background: var(--card); }
.engage.on { border-color: #b9dcc3; background: #f3faf5; }
.engage .eg-text { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; flex: 1 1 320px; }
.engage .eg-text small { flex-basis: 100%; }
.engage .eg-err { color: var(--danger); font-weight: 600; }
.pricenote { margin: -4px 0 12px; font-size: 14px; background: var(--soft); border: 1px dashed #cfcac1; border-radius: 10px; padding: 8px 12px; }
.tile .bid { font-size: 18px; }
.tile.flashme { animation: flashme 1.8s ease-out; }
@keyframes flashme { 0%, 30% { box-shadow: 0 0 0 4px #f0b84a; } 100% { box-shadow: 0 0 0 0 rgba(240, 184, 74, 0); } }
.pager { align-items: center; flex-wrap: wrap; }
.pager-pos { display: inline-flex; flex-direction: column; align-items: center; font-weight: 700; font-size: 14px; line-height: 1.2; padding: 0 4px; }
.pager-pos small { font-weight: 600; font-size: 11px; }
.ep-total b { color: var(--ok); }
.bidstrip { display: flex; align-items: center; justify-content: space-between; gap: 10px 24px; flex-wrap: wrap; background: #161616; color: #fff;
  border-radius: 16px; padding: 16px 20px; margin-bottom: 18px; }
.bidstrip .label { display: block; color: #cfcac1; font-size: 13px; font-weight: 600; }
.bidstrip > div > b { font-size: 30px; color: #9be3b0; line-height: 1.2; }
.bs-pages { display: flex; flex-direction: column; gap: 2px; font-size: 14px; color: #e6e2da; }
.bs-pages small { color: #8f8a82; }
.pc-bids { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; background: #f3faf5; border: 1px solid #b9dcc3; border-radius: 10px; padding: 8px 12px; }
.pc-bids span { font-size: 13px; color: var(--muted); font-weight: 600; }
.pc-bids b { font-size: 22px; color: var(--ok); }
.pc-bids small { margin-left: auto; }
@media (max-width: 900px) { .kpi.hero { grid-column: 1 / -1; } }
@media (max-width: 640px) {
  .bar .brand-text { text-align: center; }
  .bar .who.end { left: auto; right: 12px; max-width: 40%; }
  .ep-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .ep-kpis .kpi:not(.hero) { padding: 10px; }
  .ep-kpis .kpi:not(.hero) .label { font-size: 12px; line-height: 1.3; }
  .ep-kpis .kpi:not(.hero) .value { font-size: 21px; }
  .ep-kpis .kpi:not(.hero) .note { font-size: 11px; line-height: 1.35; }
  .engage { padding: 10px 12px; }
}
.autoclose { display: flex; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 12px 16px; margin-bottom: 16px; }
.autoclose.set { border-color: #b9cdea; background: #f4f8fd; }
.autoclose.running { border-color: #f0d28a; background: #fffaf0; }
.autoclose.done { border-color: #b9dcc3; background: #f3faf5; }
.autoclose.bad { border-color: #e9b9b4; background: #fdf4f3; }
.ac-pic { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; flex: none; cursor: zoom-in; }
.ac-body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.ac-body > div { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.ac-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.ac-form input { width: auto; flex: 0 1 220px; }
@media (max-width: 640px) { .autoclose { align-items: flex-start; } .ac-pic { width: 60px; height: 60px; } }

/* winners · messages to buyers */
.wins { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.wins .card + .card { margin-top: 0; }
.wincard.asked { border-color: #b9dcc3; background: #f7fcf8; }
.wc-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.wc-head > div { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.wc-name { font-size: 18px; }
.wc-total { font-size: 20px; color: var(--ok); }
.wc-items { list-style: none; margin: 0 0 10px; padding: 0; }
.wc-items li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.wc-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.winlink { display: inline-block; margin-top: 2px; font-size: 13px; font-weight: 700; color: var(--info); }
.fbname { display: block; margin-top: 3px; font-size: 12px; font-weight: 600; color: var(--ok); }
@media (max-width: 640px) { .wins { grid-template-columns: minmax(0, 1fr); } }
.notekeys { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
details.later { margin-top: 12px; }
details.later summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.postbar { margin-top: 12px; padding: 12px; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); }
.postbar label { font-weight: 700; font-size: 14px; }
.postbar .eg-err { color: var(--danger); font-weight: 600; }
.subhead { font-size: 15px; margin: 14px 0 6px; font-weight: 700; }
details.tgbox > summary { cursor: pointer; }
.mailform { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 10px; align-items: end; }
.mailform .field { margin-bottom: 8px; }
.mailform .btn { margin-bottom: 8px; justify-self: start; }

/* the live line under the top bar: what the back office is doing right now */
.now { border-top: 1px solid rgba(255,255,255,.08); font-size: 12.5px; color: #a9a59d; }
.now-in { max-width: 1240px; margin: 0 auto; padding: 5px 20px 6px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; min-height: 30px; }
.now .idle { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0 2px; min-width: 0; }
.now .idle .dot { width: 7px; height: 7px; border-radius: 50%; background: #3fb866; margin-right: 7px; flex: none; animation: pulse 3s infinite; }
.now .nx { color: #d8d4cc; }
.now .feed { margin-left: auto; color: #d8d4cc; text-decoration: none; font-weight: 600; white-space: nowrap; }
.now .feed:hover { color: #fff; }
.now .job { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2px 8px; color: #fff; text-decoration: none; min-width: 0; flex: 1 1 320px; }
.now .job b { font-weight: 600; }
.now .jt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now .jbar { grid-column: 2; height: 4px; border-radius: 9px; background: rgba(255,255,255,.14); overflow: hidden; max-width: 420px; }
.now .jbar span { display: block; height: 100%; background: #3fb866; transition: width .5s; }
.now .spin { width: 11px; height: 11px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); border-top-color: #ffc95c; animation: spin .9s linear infinite; }
.now.busy { background: rgba(255, 201, 92, .07); }
.now .prob { color: #ffb4a8; font-weight: 600; }
.now.lost .idle .dot { background: #8a857c; animation: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* the กิจกรรม page */
.actfil { display: grid; gap: 8px; margin-bottom: 10px; }
.actfil .chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.actfil .chips::-webkit-scrollbar { display: none; }
.fchip { white-space: nowrap; text-decoration: none; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--muted); }
.fchip:hover { color: var(--ink); }
.fchip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.fchip .cnt { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 2px; border-radius: 999px; background: var(--mute-bg); color: var(--ink); font-size: 11.5px; line-height: 17px; text-align: center; }
.fchip.on .cnt { background: rgba(255,255,255,.22); color: #fff; }
.fchip.badf.on { background: var(--danger); border-color: var(--danger); }
.fsep { flex: none; width: 1px; background: var(--line); margin: 2px 4px; }
.actday { font-size: 15px; margin: 20px 0 8px; }
.acts { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.act { display: grid; grid-template-columns: 62px 24px minmax(0, 1fr); gap: 10px; align-items: start; padding: 9px 14px; border-top: 1px solid var(--line); }
.act:first-child { border-top: 0; }
.act time { color: var(--muted); font-size: 13px; padding-top: 1px; }
.act .ic { text-align: center; }
.act .tx { overflow-wrap: anywhere; }
.act .meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.act .tag { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); color: var(--muted); text-decoration: none; white-space: nowrap; }
.act a.tag:hover { color: var(--ink); }
.act .tag.who { background: var(--info-bg); border-color: transparent; color: var(--info); }
.act .times { display: inline-block; font-size: 12px; font-weight: 700; padding: 0 7px; border-radius: 999px; background: var(--mute-bg); color: #4a4843; }
.act.lv-ok { background: #f7fcf8; }
.act.lv-warn { background: #fffaf0; }
.act.lv-warn .tx > div:first-child { color: var(--warn); }
.act.lv-error { background: #fdf3f2; }
.act.lv-error .tx > div:first-child { color: var(--danger); font-weight: 600; }
.act.fresh { animation: fresh 2.5s ease-out; }
@keyframes fresh { 0%, 40% { background: #fff1c9; } }
@media (max-width: 640px) {
  .now-in { padding: 5px 12px 6px; }
  .now .idle .sep:has(+ .nx) { display: none; }
  .now .idle .nx { display: block; width: 100%; padding-left: 14px; }
  .act { grid-template-columns: 52px 20px minmax(0, 1fr); gap: 8px; padding: 9px 10px; }
  .act time { font-size: 12px; }
}
