:root {
  --bg: #0f1216;
  --panel: #161a22;
  --border: #232a36;
  --text: #e6e8ec;
  --muted: #8b94a3;
  --accent: #4f8cff;
  --green: #3fb27f;
  --red: #e26d6d;
  --yellow: #d6b656;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Noto Sans Thai", sans-serif; background: var(--bg); color: var(--text); }
header { padding: 14px 24px 0; border-bottom: 1px solid var(--border); }
header h1 { margin: 0 0 10px; font-size: 22px; }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav button { background: transparent; color: var(--muted); border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; cursor: pointer; font-size: 14px; }
nav button.active { color: var(--text); border-bottom-color: var(--accent); }
main { padding: 22px 24px 60px; max-width: 1200px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }
h2 { margin: 0 0 16px; font-size: 20px; }
h3 { margin: 22px 0 8px; font-size: 16px; color: var(--muted); }
form { display: flex; flex-direction: column; gap: 10px; max-width: 720px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label small { color: var(--muted); font-size: 11px; }
input, select, textarea { background: var(--panel); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 8px 10px; font-size: 14px; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button { background: var(--accent); color: white; border: 0; padding: 9px 14px; border-radius: 6px; cursor: pointer; font-size: 14px; }
button:hover { filter: brightness(1.1); }
button[type="button"] { background: var(--panel); border: 1px solid var(--border); }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; font-size: 13px; }
th { color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.card .lbl { color: var(--muted); font-size: 12px; }
.card .val { font-size: 20px; font-variant-numeric: tabular-nums; margin-top: 4px; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.warn { color: var(--yellow); }
.out { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; white-space: pre-wrap; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--panel); border: 1px solid var(--border); padding: 10px 14px; border-radius: 6px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.err { border-color: var(--red); }
.toast.ok { border-color: var(--green); }
.search-results { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; max-height: 280px; overflow-y: auto; }
.search-hit { padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13px; }
.search-hit:hover { background: var(--border); }
.search-hit:last-child { border-bottom: 0; }
.muted { color: var(--muted); }
.factsheet-hint { background: var(--panel); border: 1px solid var(--accent); border-radius: 6px; padding: 8px 12px; font-size: 12px; color: var(--text); }
.factsheet-hint button { padding: 4px 8px; font-size: 12px; margin-left: 4px; }
.badge { background: var(--yellow); color: #000; padding: 2px 6px; border-radius: 4px; font-size: 11px; }
