:root {
  --fg: #1a1a1a;
  --muted: #5c5c5c;
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #d6d9de;
  --accent: #0b5cad;
  --accent-fg: #ffffff;
  --ok: #1e6b35;
  --err: #b3261e;
  --focus: #ffbf47;
  color-scheme: light;
}
* { box-sizing: border-box; }
/* layout "fill": iframe = พื้นที่ทั้งหมดใต้ header ของ shell → เอกสารสูงเต็ม iframe และเลื่อนภายในแอปเอง (ไม่ไหลต่อไปหน้า shell) */
html { height: 100%; overscroll-behavior-y: contain; }
body { min-height: 100%; }
body {
  margin: 0;
  font-family: "Sarabun", "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
}
main { max-width: 720px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
.tag { font-size: .75rem; vertical-align: middle; padding: 2px 8px; border-radius: 999px; background: #e8eef7; color: var(--accent); }
.top { margin-bottom: 12px; }
.status { margin: 4px 0; color: var(--muted); }
.status[data-kind="ok"] { color: var(--ok); }
.status[data-kind="error"] { color: var(--err); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; flex: 1; min-width: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
label { font-weight: 600; }
.optional { font-weight: 400; color: var(--muted); }
input, select, textarea, button {
  font: inherit;
  min-height: 44px;
  border-radius: 8px;
}
input, select, textarea { border: 1px solid #8a9099; padding: 8px 10px; background: #fff; color: var(--fg); width: 100%; }
textarea { resize: vertical; }
button {
  min-width: 44px;
  padding: 8px 16px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
}
button.secondary { background: #fff; color: var(--accent); }
button:disabled { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.hint { color: var(--muted); font-size: .9rem; min-height: 1em; }
.error { color: var(--err); font-size: .9rem; margin: 0; min-height: 1em; }
[aria-invalid="true"] { border-color: var(--err); }
.leaves { list-style: none; margin: 0; padding: 0; }
.leaves li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); }
.leaves li:first-child { border-top: 0; }
.leaves .empty { color: var(--muted); justify-content: flex-start; }
.leave-main { min-width: 0; }
.leave-title { font-weight: 600; }
.leave-meta { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.badge { display: inline-block; font-size: .8rem; padding: 1px 8px; border-radius: 999px; margin-left: 6px; }
.badge[data-status="pending"] { background: #fff4d6; color: #6b4e00; }
.badge[data-status="cancelled"] { background: #eceff3; color: #4a4f57; }
.note { color: var(--muted); font-size: .85rem; }
@media (prefers-reduced-motion: no-preference) { button { transition: background-color .15s; } }
