@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@400;500;600;700&display=swap');

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: #f2f5fa; color: #1a1a1a;
  font-family: 'IBM Plex Sans Thai', system-ui, -apple-system, sans-serif;
  font-size: 15px; line-height: 1.55;
}
.hide { display: none !important; }

/* ---------- login ---------- */
#login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 20%, #2b5aa0, #14274a 70%); padding: 20px;
}
#login .card {
  background: #fff; width: 100%; max-width: 380px; border-radius: 16px;
  padding: 28px 24px; box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
#login h1 { font-size: 20px; margin: 0 0 4px; color: #14274a; }
#login p.sub { margin: 0 0 20px; color: #777; font-size: 13px; }

/* ---------- shell ---------- */
header {
  background: #1f4788; color: #fff; padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
header h1 { font-size: 16px; margin: 0; font-weight: 600; }
header .who { font-size: 12px; opacity: .85; }
nav {
  display: flex; gap: 6px; padding: 10px 12px; background: #fff;
  overflow-x: auto; position: sticky; top: 51px; z-index: 19;
  border-bottom: 1px solid #e3e8f0;
}
nav button {
  flex: 0 0 auto; border: 1px solid #dde3ec; background: #fff; color: #445;
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-family: inherit; cursor: pointer;
}
nav button.on { background: #1f4788; border-color: #1f4788; color: #fff; font-weight: 600; }
main { padding: 14px 12px 60px; max-width: 760px; margin: 0 auto; }

/* ---------- cards ---------- */
.dept {
  background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 10px;
  border-left: 6px solid #cfd6e2; box-shadow: 0 1px 3px rgba(20,39,74,.07);
}
.dept.red { border-left-color: #d9463e; }
.dept.yellow { border-left-color: #e0a11b; }
.dept.green { border-left-color: #2e9e5b; }
.dept .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dept .name { font-weight: 700; font-size: 16px; }
.tag { font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.tag.red { background: #fdecea; color: #b3271f; }
.tag.yellow { background: #fdf4e0; color: #8a6100; }
.tag.green { background: #e8f6ed; color: #1e7a44; }
.dept ul { margin: 10px 0 0; padding-left: 18px; }
.dept li { font-size: 13.5px; color: #444; margin-bottom: 3px; }
.dept li .days { color: #888; font-size: 12.5px; }

/* ---------- form / table ---------- */
label { display: block; font-size: 13px; color: #55607a; margin: 12px 0 5px; font-weight: 500; }
input, select, textarea, button {
  font-family: inherit; font-size: 15px;
}
input, select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid #d5dce7; border-radius: 10px;
  background: #fff; min-height: 44px;
}
textarea { min-height: 78px; resize: vertical; }
.btn {
  width: 100%; padding: 12px; border: 0; border-radius: 10px; background: #1f4788;
  color: #fff; font-weight: 600; cursor: pointer; margin-top: 16px; min-height: 46px;
}
.btn.ghost { background: #fff; color: #1f4788; border: 1px solid #c3cfe2; }
.btn.danger { background: #d9463e; }
.btn.sm { width: auto; padding: 7px 14px; font-size: 13px; margin: 0; min-height: 0; }
.panel {
  background: #fff; border-radius: 14px; padding: 16px; margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(20,39,74,.07);
}
.panel h2 { font-size: 15px; margin: 0 0 8px; color: #14274a; }
.row2 { display: flex; gap: 10px; }
.row2 > * { flex: 1; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid #eef1f6; vertical-align: top; }
th { color: #7a8598; font-weight: 500; font-size: 12.5px; }

.bar { height: 10px; background: #1f4788; border-radius: 5px; }
.barwrap { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.barwrap .lbl { flex: 0 0 108px; font-size: 13px; }
.barwrap .num { font-size: 13px; color: #666; min-width: 22px; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px;
  background: #14274a; color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 14px; z-index: 99; max-width: 90%; text-align: center;
}
.err { color: #b3271f; font-size: 13px; margin-top: 10px; }
.muted { color: #7a8598; font-size: 13px; }
