/* ThaiQR - owner dashboard, admin, sign-in and landing page.
   Same language as the guest menu (tokens.css): white paper, ink, chili red, sign yellow. Plain CSS, no build step.
   The old variable names stay as aliases because a few templates still use them inline. */

:root {
	--bg: var(--paper);
	--surface: var(--paper);
	--surface-2: var(--stone);
	--muted: var(--ink-3);
	--brand: var(--red);
	--brand-strong: var(--red-deep);
	--brand-soft: var(--red-soft);
	--brand-ink: #ffffff;
	--accent-soft: var(--sun-soft);
	--gold: var(--sun-deep);
	--gold-soft: var(--sun-soft);
	--ok: var(--leaf);
	--ok-soft: var(--leaf-soft);
	--warn: #8a5300;
	--warn-soft: #fff0cf;
	--err: var(--red-deep);
	--err-soft: var(--red-soft);
	--info: var(--sea);
	--info-soft: var(--sea-soft);
	--radius: 12px;
	--radius-sm: 8px;
	--shadow-lg: 0 14px 44px rgba(26, 22, 19, .22);
	--awn: var(--red);
}

body { font-size: .96rem; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
h1, h2, h3, h4 { margin-bottom: .5em; letter-spacing: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
code, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; background: var(--stone); padding: .1em .35em; border-radius: 5px; }
a:hover { text-decoration: underline; }
.muted { color: var(--ink-3); }
.small { font-size: .86rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; } .mt1 { margin-top: 8px; } .mt2 { margin-top: 16px; } .mt3 { margin-top: 28px; }
.mb0 { margin-bottom: 0; } .mb1 { margin-bottom: 8px; } .mb2 { margin-bottom: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.row.nowrap > .field { flex: 1 1 0; min-width: 0; }
.row.nowrap > .input { flex: 1 1 0; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.row.end { justify-content: flex-end; }
.row.top { align-items: flex-start; }
.stack > * + * { margin-top: 12px; }
.grow { flex: 1 1 0; min-width: 0; }
.hidden { display: none !important; }
[x-cloak] { display: none !important; }

/* ---------- the stall awning (sign-in card, landing) ---------- */
.awning { height: 30px; background: repeating-linear-gradient(90deg, var(--awn) 0 24px, color-mix(in oklab, var(--awn) 74%, #000) 24px 48px);
	-webkit-mask: linear-gradient(#000 0 0) top / 100% 18px no-repeat, radial-gradient(circle at 12px 18px, #000 11.5px, #0000 12px) 0 0 / 24px 30px repeat-x;
	mask: linear-gradient(#000 0 0) top / 100% 18px no-repeat, radial-gradient(circle at 12px 18px, #000 11.5px, #0000 12px) 0 0 / 24px 30px repeat-x; }

/* ---------- shell ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--ink); color: #fff; border-bottom: 6px solid var(--red);
	border-image: repeating-linear-gradient(90deg, var(--red) 0 18px, var(--red-deep) 18px 36px) 1; }
.topbar-in { max-width: 1180px; margin: 0 auto; padding: 8px var(--gutter); min-height: 56px; display: flex; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: #fff; letter-spacing: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 7px; background: var(--sun); color: #1a1613; display: grid; place-items: center;
	-webkit-mask: radial-gradient(circle 4px at left center, #0000 3.5px, #000 4px) left / 51% 100% no-repeat, radial-gradient(circle 4px at right center, #0000 3.5px, #000 4px) right / 51% 100% no-repeat;
	mask: radial-gradient(circle 4px at left center, #0000 3.5px, #000 4px) left / 51% 100% no-repeat, radial-gradient(circle 4px at right center, #0000 3.5px, #000 4px) right / 51% 100% no-repeat; }
.brand-mark .i { width: 19px; height: 19px; stroke-width: 2.2; }
.brand em { font-style: normal; color: var(--sun); }
.spacer { flex: 1; }
.langsw { display: inline-flex; gap: 2px; }
.langsw a { padding: 4px 10px; border-radius: 6px; font-size: .8rem; font-weight: 600; color: rgba(255, 255, 255, .7); }
.langsw a.on { background: #fff; color: var(--ink); }
.langsw a:hover { text-decoration: none; color: #fff; }
.langsw a.on:hover { color: var(--ink); }
@media (max-width: 520px) {
	.topbar-in { gap: 8px; }
	.topbar-in > .badge { display: none; }
	.topbar-in > .btn.ghost { display: none; }
	.langsw a { padding: 4px 7px; }
	.brand { font-size: 1.1rem; gap: 8px; }
	.userbox summary { padding-right: 8px; }
	.userbox summary > .small { display: none; }
}
.userbox { position: relative; }
.userbox summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1.5px solid rgba(255, 255, 255, .45); color: #fff; min-height: 40px; }
.userbox summary::-webkit-details-marker { display: none; }
.userbox summary:focus-visible { outline-color: var(--sun); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--sun); color: #1a1613; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: .9rem; }
.userbox .pop { position: absolute; right: 0; top: calc(100% + 10px); min-width: 220px; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; }
.userbox .pop a, .userbox .pop button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; min-height: 44px; border-radius: 8px; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; }
.userbox .pop a:hover, .userbox .pop button:hover { background: var(--stone); text-decoration: none; }
.badge.beta { background: var(--sun); color: #1a1613; }

.tabs { max-width: 1180px; margin: 0 auto; padding: 0 calc(var(--gutter) - 6px); display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 0 14px; min-height: 48px; color: rgba(255, 255, 255, .72); font-family: var(--font-display); font-size: .95rem; white-space: nowrap; border-bottom: 5px solid transparent; display: inline-flex; gap: 8px; align-items: center; }
.tabs a:hover { text-decoration: none; color: #fff; }
.tabs a.on { color: #fff; border-color: var(--sun); }
.tabs a .i { color: rgba(255, 255, 255, .55); }
.tabs a.on .i { color: var(--sun); }
.tabs .pill { background: var(--red); color: #fff; border-radius: 999px; font-size: .72rem; padding: 1px 8px; font-weight: 700; font-family: var(--font-text); }
.page { max-width: 1180px; margin: 0 auto; padding: 24px var(--gutter) 90px; }
.page.narrow { max-width: 780px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.crumbs { font-size: .86rem; color: var(--ink-3); margin-bottom: 4px; }
.crumbs a { color: var(--ink-3); }

/* ---------- elements ---------- */
.card { background: var(--paper); border: 1.5px solid var(--line-strong); border-radius: var(--radius); padding: 18px; }
.card.flat { border-color: var(--line); }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .split > .card + .card, .split > section + section { margin-top: 0; }
.card-title { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 1.08rem; }
.card-title .i { color: var(--red); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); align-items: start; }
@media (max-width: 860px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
	.g2, .g3, .g4 { grid-template-columns: 1fr; }
	.grid:has(> .stat) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.stat { padding: 12px 14px; }
	.stat b { font-size: 1.8rem; }
}

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 18px; border-radius: 10px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; transition: background var(--t-fast), color var(--t-fast), scale var(--t-fast); min-height: 44px; }
.btn:hover { background: var(--stone); text-decoration: none; }
.btn:active { scale: .97; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-deep); border-color: var(--red-deep); }
.btn.accent { background: var(--sun); border-color: var(--ink); color: #1a1613; }
.btn.accent:hover { background: #ffd23d; }
.btn.danger { color: var(--red-deep); border-color: var(--red); }
.btn.danger:hover { background: var(--red-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--stone); }
.btn.sm { padding: 4px 13px; min-height: 36px; font-size: .88rem; border-radius: 9px; border-width: 1.5px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .45; pointer-events: none; }
.htmx-request .btn.primary, .btn.htmx-request { opacity: .75; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--stone); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--leaf-soft); color: var(--leaf); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--red-soft); color: var(--red-deep); }
.badge.info { background: var(--sea-soft); color: var(--sea); }
.badge.brand { background: var(--red-soft); color: var(--red-deep); }
.badge.gold { background: var(--sun-soft); color: #6b4a00; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

.alert { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--sea-soft); color: #14346a; border-left: 5px solid var(--sea); margin-bottom: 16px; align-items: flex-start; }
.alert.ok { background: var(--leaf-soft); color: #0f4d2e; border-left-color: var(--leaf); }
.alert.warn { background: var(--warn-soft); color: #5e3700; border-left-color: var(--sun-deep); }
.alert.err { background: var(--red-soft); color: #7a1914; border-left-color: var(--red); }
.alert .i { margin-top: 2px; }
.alert > div { flex: 1; min-width: 0; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* forms */
.field { margin-bottom: 14px; }
.field > label, .label { display: block; font-weight: 600; margin-bottom: 5px; font-size: .92rem; }
.hint { color: var(--ink-3); font-size: .84rem; margin-top: 4px; }
.input, select, textarea { width: 100%; padding: 9px 12px; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--paper); font: inherit; color: var(--ink); min-height: 44px; }
textarea { min-height: 88px; resize: vertical; }
.input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
.input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: 3px solid color-mix(in srgb, var(--sea) 40%, transparent); outline-offset: 0; }
.input.err { border-color: var(--red); }
.input[aria-invalid="true"] { border-color: var(--red); }
.input-group { display: flex; }
.input-group .pre { display: grid; place-items: center; padding: 0 12px; border: 1.5px solid var(--line-strong); border-right: 0; border-radius: 10px 0 0 10px; background: var(--stone); color: var(--ink-3); font-size: .9rem; white-space: nowrap; }
.input-group .input { border-radius: 0 10px 10px 0; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--red); flex: none; }
.check-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; background: var(--paper); }
.check-card:has(input:checked) { border-color: var(--ink); background: var(--sun-soft); }
.check-card:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.check-card input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--red); }
.check-card b { display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; min-height: 40px; border: 1.5px solid var(--line-strong); border-radius: 999px; background: var(--paper); cursor: pointer; font-size: .92rem; user-select: none; }
.chip:has(input:checked), .chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.hours th { text-align: left; font-size: .8rem; color: var(--ink-3); font-weight: 600; }
.hours input[type=time] { width: 124px; }
@media (max-width: 560px) {
	.hours, .hours tbody, .hours td { display: block; }
	.hours thead { display: none; }
	.hours tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
	.hours td { padding: 0; border: 0; }
	.hours td:nth-child(1), .hours td:nth-child(2) { grid-column: 1 / -1; }
	.hours td[data-label]::before { content: attr(data-label); display: block; font-size: .78rem; color: var(--ink-3); margin-bottom: 2px; }
	.hours input[type=time] { width: 100%; }
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:has(input:focus-visible) { outline: 3px solid var(--sea); outline-offset: 2px; }
.tagicon { display: inline-flex; align-items: center; font-weight: 700; font-size: .78rem; }
.tagicon .i { width: 1.1em; height: 1.1em; }

/* tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .82rem; color: var(--ink-3); font-weight: 600; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--stone); }
.table-wrap { overflow-x: auto; }
/* the moderator's decision stays within reach while they read a long menu */
@media (min-width: 861px) { .decision-card { position: sticky; bottom: 12px; box-shadow: var(--shadow-lg); } }
/* on a phone every row becomes a small card: the cell's data-label names it */
@media (max-width: 640px) {
	.table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; }
	.table.stack thead { display: none; }
	.table.stack tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
	.table.stack tr:last-child { border-bottom: 0; }
	.table.stack td { padding: 4px 0; border: 0; display: flex; gap: 12px; justify-content: space-between; align-items: center; text-align: right; }
	.table.stack td:first-child { display: block; text-align: left; padding-bottom: 6px; }
	.table.stack td[data-label]::before { content: attr(data-label); color: var(--ink-3); font-size: .8rem; text-align: left; flex: none; }
	.table.stack td:last-child { justify-content: flex-end; padding-top: 8px; }
	.table.stack tbody tr:hover td { background: none; }
}

/* stats */
.stat { padding: 16px 18px; background: var(--paper); border: 1.5px solid var(--line-strong); border-radius: var(--radius); }
.stat b { display: block; font-family: var(--font-text); font-size: 2.2rem; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--ink-3); font-size: .88rem; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 130px; }
.bars i { flex: 1; background: var(--red); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars i:hover { background: var(--red-deep); }
.progress { height: 10px; border-radius: 999px; background: var(--stone-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--leaf); border-radius: 999px; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-bottom: 1px dashed var(--line-strong); }
.checklist li:last-child { border-bottom: 0; }
.checklist .ico { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--stone-2); color: var(--ink-3); }
.checklist li.done .ico { background: var(--leaf); color: #fff; }
.checklist li.warn .ico { background: var(--sun); color: #1a1613; }
.checklist li.err .ico { background: var(--red); color: #fff; }
.checklist .ico .i { width: 13px; height: 13px; stroke-width: 2.8; }

/* ---------- menu editor ---------- */
.cat { background: var(--paper); border: 1.5px solid var(--line-strong); border-radius: var(--radius); margin-bottom: 14px; }
.cat-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 2px solid var(--ink); }
.cat-head h3 { margin: 0; font-size: 1.12rem; }
.cat-head .count { color: var(--ink-3); font-size: .86rem; }
.handle { cursor: grab; color: var(--ink-3); padding: 6px; border-radius: 6px; display: inline-flex; touch-action: none; }
.handle:hover { background: var(--stone); }
.sortable-ghost { opacity: .35; }
.dish { display: grid; grid-template-columns: auto 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--paper); }
.dish:last-child { border-bottom: 0; }
.dish.sold { background: repeating-linear-gradient(135deg, var(--paper), var(--paper) 10px, var(--stone) 10px, var(--stone) 20px); }
.dish-photo { width: 64px; height: 64px; border-radius: 10px; background: var(--stone); display: grid; place-items: center; color: var(--ink-3); overflow: hidden; }
.dish-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* the dish number is the sign-yellow ticket from the guest menu */
.num { display: inline-grid; place-items: center; min-width: 38px; height: 30px; padding: 0 9px; border-radius: 5px; background: var(--sun); color: #1a1613; font-family: var(--font-display); font-weight: 700; font-size: .98rem; font-variant-numeric: tabular-nums;
	-webkit-mask: radial-gradient(circle 3.5px at left center, #0000 3px, #000 3.5px) left / 51% 100% no-repeat, radial-gradient(circle 3.5px at right center, #0000 3px, #000 3.5px) right / 51% 100% no-repeat;
	mask: radial-gradient(circle 3.5px at left center, #0000 3px, #000 3.5px) left / 51% 100% no-repeat, radial-gradient(circle 3.5px at right center, #0000 3px, #000 3.5px) right / 51% 100% no-repeat; }
.dish-name { font-weight: 600; }
.dish-sub { color: var(--ink-3); font-size: .86rem; }
.dish-ops { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.price-input { width: 96px; text-align: right; padding: 6px 9px; min-height: 40px; font-variant-numeric: tabular-nums; }
.switch { position: relative; display: inline-block; width: 46px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line-strong); border-radius: 999px; transition: background var(--t-med); cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform var(--t-med) var(--ease); box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.switch input:checked + span { background: var(--leaf); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid var(--sea); outline-offset: 2px; }
.live-tag { font-size: .74rem; color: var(--leaf); font-weight: 700; display: inline-flex; gap: 4px; align-items: center; }
.reorder { display: none; gap: 4px; }
.mv { width: 40px; height: 40px; display: grid; place-items: center; border: 1.5px solid var(--line-strong); border-radius: 8px; background: var(--paper); color: var(--ink-2); cursor: pointer; padding: 0; }
.mv:hover { background: var(--stone); }
.mv:active { scale: .94; }
/* touch screens and phones: arrows instead of drag handles */
@media (max-width: 640px), (pointer: coarse) {
	.handle { display: none; }
	.reorder { display: inline-flex; }
	.dish .reorder { flex-direction: column; }
}
@media (max-width: 640px) {
	.dish { grid-template-columns: auto 64px minmax(0, 1fr); }
	.dish-ops { grid-column: 1 / -1; justify-content: space-between; }
	.cat-head { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px 8px; align-items: center; }
	.cat-head h3 { grid-column: 1 / 4; grid-row: 1; }
	.cat-head .count { grid-column: 4; grid-row: 1; justify-self: end; }
	.cat-head .reorder { grid-column: 1; grid-row: 2; }
	.cat-head > .btn:not(.ghost) { grid-column: 2; grid-row: 2; }
	.cat-head > .btn.ghost { grid-row: 2; }
}

dialog { border: 0; border-radius: 18px; padding: 0; width: min(760px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); box-shadow: var(--shadow-lg); color: var(--ink); background: var(--paper); }
dialog::backdrop { background: rgba(26, 22, 19, .55); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 2px solid var(--ink); position: sticky; top: 0; background: var(--paper); z-index: 2; border-radius: 18px 18px 0 0; }
.modal-head h2 { margin: 0; font-size: 1.15rem; }
#modal { overflow: hidden; }
.modal-body { padding: 18px; overflow-y: auto; max-height: calc(100dvh - 176px); }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; position: sticky; bottom: 0; background: var(--paper); border-radius: 0 0 18px 18px; }
.langtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.langtabs button { border: 1.5px solid var(--line-strong); background: var(--paper); border-radius: 999px; padding: 6px 14px; min-height: 38px; font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; }
.langtabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.langtabs .dotmark { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-left: 6px; background: var(--leaf); }
.langtabs .dotmark.empty { background: var(--line-strong); }
.photo-drop { border: 2px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 14px; display: flex; gap: 14px; align-items: center; background: var(--stone); }
.photo-drop img { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; background: #fff; }
.file-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-btn { position: relative; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.file-btn:has(input:focus-visible) { outline: 3px solid var(--sea); outline-offset: 2px; }
.file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.ai-tag { font-size: .72rem; background: var(--sun-soft); color: #6b4a00; border-radius: 6px; padding: 1px 7px; font-weight: 700; margin-left: 6px; }

/* ---------- moderation ---------- */
.diff-block { border: 1.5px solid var(--line-strong); border-radius: var(--radius); margin-bottom: 14px; background: var(--paper); overflow: hidden; }
.diff-head { padding: 10px 14px; background: var(--stone); display: flex; gap: 10px; align-items: center; font-weight: 600; border-bottom: 2px solid var(--ink); }
.diff-row { display: grid; grid-template-columns: 160px minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 9px 14px; border-top: 1px solid var(--line); align-items: start; }
.diff-row .f { color: var(--ink-3); font-size: .86rem; }
.diff-row .old { background: var(--red-soft); border-radius: 6px; padding: 4px 8px; text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--red) 55%, transparent); }
.diff-row .new { background: var(--leaf-soft); border-radius: 6px; padding: 4px 8px; }
.diff-row .none { color: var(--ink-3); font-style: italic; }
.diff-row img { max-height: 72px; border-radius: 8px; display: block; }
.diff-item { padding: 12px 14px; border-top: 1px solid var(--line); }
.diff-item .row { align-items: flex-start; }
.remark { margin-top: 8px; }
@media (max-width: 760px) { .diff-row { grid-template-columns: 1fr; gap: 4px; } }
.sev-ERROR { color: var(--red-deep); } .sev-WARN { color: var(--warn); } .sev-INFO { color: var(--sea); }

/* ---------- sign-in ---------- */
.auth { min-height: calc(100dvh - 62px); display: grid; align-content: start; justify-items: center; padding: clamp(20px, 9vh, 88px) var(--gutter) 40px; background: var(--stone); }
.auth-card { width: min(440px, 100%); padding: 0; overflow: hidden; border: 2px solid var(--ink); background: var(--paper); }
.auth-card::before { content: ""; display: block; height: 30px; background: repeating-linear-gradient(90deg, var(--red) 0 24px, var(--red-deep) 24px 48px); }
.auth-card > * { margin-left: 26px; margin-right: 26px; }
.auth-card > :first-child { margin-top: 24px; }
.auth-card h1 { font-size: 1.6rem; }
.auth-card > :last-child { margin-bottom: 26px; }
.auth-card hr { margin: 18px 26px; }
/* the browser check: one quiet line above the button */
.pow-status { margin: 12px 0 0; min-height: 1.4em; display: flex; align-items: center; gap: 8px; }
.pow-status:empty { display: none; }
.pow-status::before { content: ""; width: 12px; height: 12px; flex: none; border-radius: 50%; background: var(--sun); box-shadow: 0 0 0 2px var(--ink); animation: pow-pulse 1s ease-in-out infinite; }
.pow-status.done::before { background: var(--leaf); animation: none; }
.pow-status.err { color: var(--err); font-weight: 600; }
.pow-status.err::before { background: var(--red); animation: none; }
@keyframes pow-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .pow-status::before { animation: none; } }

/* ---------- landing ---------- */
.land { --awn: var(--red); }
.l-hero { background: var(--sun); border-bottom: 2px solid var(--ink); }
.l-hero-in { max-width: 1180px; margin: 0 auto; padding: 44px var(--gutter) 56px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 40px; align-items: center; }
.l-kicker { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 14px; }
.l-hero h1 { font-size: clamp(2.3rem, 6.4vw, 4.4rem); line-height: 1.25; margin-bottom: 14px; text-wrap: balance; }
:lang(th) .l-hero h1 { line-height: 1.5; }
.l-hero p.lead { font-size: 1.15rem; max-width: 34em; color: #2f2a24; }
.l-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.l-hero .btn.primary { box-shadow: 0 4px 0 var(--red-deep); }
.l-hero .btn.primary:active { box-shadow: 0 1px 0 var(--red-deep); translate: 0 3px; scale: 1; }
.l-langs { margin-top: 26px; }
.l-langs-lbl { font-size: .86rem; font-weight: 600; margin-bottom: 8px; }
.l-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.l-chip { border: 2px solid var(--ink); background: var(--paper); border-radius: 999px; padding: 4px 14px; min-height: 40px; font: inherit; font-weight: 600; cursor: pointer; }
.l-chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.l-demo { display: grid; place-items: center; }
.l-phone { width: min(330px, 100%); border-radius: 38px; background: var(--ink); padding: 11px; box-shadow: 10px 10px 0 var(--red-deep); }
.l-phone iframe { display: block; width: 100%; height: 640px; border: 0; border-radius: 28px; background: #fff; }
.l-section { max-width: 1180px; margin: 0 auto; padding: 56px var(--gutter) 8px; }
.l-section h2 { font-size: clamp(1.7rem, 4vw, 2.5rem); margin-bottom: 24px; max-width: 18em; }
.l-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; list-style: none; margin: 0; padding: 0; counter-reset: step; }
.l-steps li { position: relative; padding-top: 6px; }
.l-steps .tk { display: inline-grid; place-items: center; min-width: 54px; height: 54px; padding: 0 10px; margin-bottom: 12px; background: var(--sun); font-family: var(--font-display); font-weight: 700; font-size: 1.7rem; border-radius: 8px;
	-webkit-mask: radial-gradient(circle 6px at left center, #0000 5.5px, #000 6px) left / 51% 100% no-repeat, radial-gradient(circle 6px at right center, #0000 5.5px, #000 6px) right / 51% 100% no-repeat;
	mask: radial-gradient(circle 6px at left center, #0000 5.5px, #000 6px) left / 51% 100% no-repeat, radial-gradient(circle 6px at right center, #0000 5.5px, #000 6px) right / 51% 100% no-repeat; }
.l-steps h3 { font-size: 1.25rem; }
.l-steps p { color: var(--ink-2); max-width: 26em; }
.l-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; }
.l-item { display: grid; grid-template-columns: 44px 1fr; gap: 14px; padding: 18px 0; border-top: 2px solid var(--ink); }
.l-item .ico { color: var(--red); }
.l-item .ico .i { width: 30px; height: 30px; stroke-width: 1.6; }
.l-item h3 { font-size: 1.15rem; margin-bottom: 4px; }
.l-item p { margin: 0; color: var(--ink-2); }
.l-wall { display: flex; flex-wrap: wrap; gap: 6px 26px; align-items: baseline; font-family: var(--font-display); font-size: clamp(1.8rem, 5vw, 3rem); line-height: 1.6; }
.l-wall span:nth-child(3n) { color: var(--red); } .l-wall span:nth-child(3n+1) { color: var(--ink); } .l-wall span:nth-child(3n+2) { color: var(--ink-3); }
.l-cta { margin-top: 64px; background: var(--ink); color: #fff; }
.l-cta .awning { --awn: var(--red); background-color: transparent; }
.l-cta-in { max-width: 1180px; margin: 0 auto; padding: 36px var(--gutter) 52px; display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; }
.l-cta h2 { color: #fff; margin: 0; font-size: clamp(1.6rem, 4vw, 2.4rem); max-width: 16em; }
.footer { padding: 22px var(--gutter); color: var(--ink-3); font-size: .88rem; text-align: center; border-top: 1px solid var(--line); }
.footer a { color: var(--ink-3); margin: 0 8px; }
@media (max-width: 860px) {
	.l-hero-in { grid-template-columns: 1fr; padding-top: 28px; }
	.l-steps, .l-list { grid-template-columns: 1fr; }
	.l-phone iframe { height: 560px; }
}

/* ---------- QR studio ---------- */
.qr-preview { background: #fff; border: 2px solid var(--ink); border-radius: var(--radius); padding: 16px; display: grid; place-items: center; }
.qr-preview svg { width: 100%; max-width: 260px; height: auto; }
.qr-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.qr-tile { border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px; background: var(--paper); text-align: center; }
.qr-tile .qr-img svg { width: 100%; height: auto; display: block; }
.qr-pick { display: flex; align-items: center; min-height: 28px; margin: 0 0 4px; cursor: pointer; }
.qr-pick input { width: 20px; height: 20px; accent-color: var(--red); cursor: pointer; }
.qr-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.qr-bar .check { padding: 0; }
.qr-more { margin-top: 8px; text-align: left; }
.qr-more summary { cursor: pointer; font-size: .84rem; color: var(--ink-3); text-align: center; padding: 6px 0; list-style: none; min-height: 32px; }
.qr-more summary::-webkit-details-marker { display: none; }
.qr-more summary:hover { color: var(--ink); text-decoration: underline; }
.qr-more[open] summary { color: var(--ink); }
.qr-more form { display: flex; gap: 6px; margin-top: 6px; }
.qr-more form .input { min-width: 0; padding: 6px 9px; min-height: 38px; }
.qr-more form .btn { flex: none; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatches label { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--line-strong); cursor: pointer; display: block; position: relative; }
.swatches input { position: absolute; opacity: 0; }
.swatches label:has(input:checked) { box-shadow: 0 0 0 3px var(--ink); }
.swatches label:has(input:focus-visible) { outline: 3px solid var(--sea); outline-offset: 3px; }
.seg { display: inline-flex; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; background: var(--paper); }
.seg label, .seg a { padding: 8px 15px; min-height: 40px; display: inline-flex; align-items: center; cursor: pointer; font-weight: 600; font-size: .92rem; border-right: 1.5px solid var(--line-strong); color: var(--ink); }
.seg label:last-child, .seg a:last-child { border-right: 0; }
.seg a:hover { text-decoration: none; background: var(--stone); }
.seg a.on, .seg a.on:hover { background: var(--ink); color: #fff; }
.seg input { position: absolute; opacity: 0; }
.seg label:has(input:checked) { background: var(--ink); color: #fff; }
.seg label:has(input:focus-visible) { outline: 3px solid var(--sea); outline-offset: -3px; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 100; font-weight: 600; }
.toast.err { background: var(--red-deep); }
.htmx-indicator { opacity: 0; transition: opacity var(--t-fast); }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.spinner { width: 16px; height: 16px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 44px 16px; color: var(--ink-3); }
.empty .i { width: 44px; height: 44px; stroke-width: 1.4; margin-bottom: 8px; color: var(--red); }
.empty h2 { color: var(--ink); }
.preview-banner { background: var(--ink); color: #fff; padding: 8px var(--gutter); font-size: .88rem; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; position: sticky; top: 0; z-index: 60; }
.preview-banner a { color: var(--sun); }

/* one-time code input */
.code-input { font: 700 1.8rem/1.2 var(--font-display); letter-spacing: .45em; text-align: center; padding-left: .45em; font-variant-numeric: tabular-nums; }
.verify-banner { background: var(--sun-soft); color: #4a3300; border-bottom: 1px solid var(--sun-deep); padding: 8px var(--gutter); font-size: .9rem; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
.verify-banner a { font-weight: 700; color: inherit; text-decoration: underline; }
.mail-preview { width: 100%; height: 420px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); background: #faf8f4; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
code.copy { user-select: all; word-break: break-all; font-size: .82rem; background: var(--stone); padding: 2px 6px; border-radius: 6px; }
