:root {
  --brand: #8B1A2B; --brand-dark: #6d1421; --bg: #f4f5f7; --card: #fff;
  --line: #e3e6ea; --text: #221E1B; --muted: #6b7280; --ok: #1a7f37; --warn: #b45309;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; font-family: -apple-system, "Sarabun", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.5; }
.topbar { background: var(--brand); color: #fff; padding: 14px 16px; font-weight: 700; font-size: 18px;
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; }
.wrap { max-width: 760px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
h3 { margin: 0 0 10px; } h4 { margin: 14px 0 6px; }
label { display: block; font-weight: 600; margin: 12px 0 5px; font-size: 14px; }
label .req { color: var(--brand); }
input, select, textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 9px; font-size: 16px; font-family: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
textarea { min-height: 64px; resize: vertical; }
.btn { display: inline-block; width: 100%; padding: 14px; border: none; border-radius: 10px;
  background: var(--brand); color: #fff; font-size: 17px; font-weight: 700; cursor: pointer; margin-top: 8px; }
.btn:active { background: var(--brand-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
.btn.sm { width: auto; padding: 8px 14px; font-size: 14px; margin: 0; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.pill.open { background: #fde7ea; color: var(--brand); }
.pill.wait { background: #fff3d6; color: var(--warn); }
.pill.done { background: #e3f5e9; color: var(--ok); }
.msg { padding: 12px; border-radius: 9px; margin: 10px 0; font-weight: 600; display: none; }
.msg.show { display: block; }
.msg.ok { background: #e3f5e9; color: var(--ok); }
.msg.err { background: #fde7ea; color: var(--brand); }
.progress { height: 10px; background: #eee; border-radius: 6px; overflow: hidden; margin-top: 10px; display: none; }
.progress.show { display: block; }
.progress > div { height: 100%; width: 0; background: var(--brand); transition: width .2s; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab { padding: 9px 16px; border-radius: 20px; background: #fff; border: 1px solid var(--line);
  cursor: pointer; font-weight: 600; font-size: 14px; }
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
.thumbs img { width: 100%; border-radius: 8px; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--line); }
.center { text-align: center; }
.spinner { width: 22px; height: 22px; border: 3px solid #8B1A2B33; border-top-color: var(--brand);
  border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
