:root {
  --bg: #f5f6f8;
  --card: #fff;
  --ink: #1d2430;
  --muted: #6b7280;
  --line: #e4e7ec;
  --brand: #1c4e80;
  --brand-dark: #143a60;
  --accent: #0f766e;
  --ok: #12805c;
  --warn: #b45309;
  --danger: #b91c1c;
  --info: #1d4ed8;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.06);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    "IBM Plex Sans Thai",
    "Sarabun",
    "Noto Sans Thai",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  font-size: 15px;
  line-height: 1.65;
}
a {
  color: var(--brand);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
header.topbar {
  background: var(--brand);
  color: #fff;
  padding: 0;
}
.topbar-inner {
  max-width: 1300px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 18px;
  color: #fff;
}
.brand small {
  display: block;
  font-weight: 400;
  font-size: 12px;
  opacity: 0.8;
}
nav.main a {
  color: #dbe6f2;
  margin-right: 18px;
  font-size: 14.5px;
}
nav.main a.active,
nav.main a:hover {
  color: #fff;
  text-decoration: none;
  border-bottom: 2px solid #fff;
  padding-bottom: 3px;
}
.who {
  margin-left: auto;
  font-size: 13px;
  color: #cfe0f0;
  text-align: right;
}
main {
  max-width: 1300px;
  margin: 22px auto 60px;
  padding: 0 20px;
}
h1 {
  font-size: 23px;
  margin: 0 0 4px;
}
h2 {
  font-size: 18px;
  margin: 26px 0 12px;
}
h3 {
  font-size: 15.5px;
  margin: 16px 0 8px;
}
.sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 18px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.grid {
  display: grid;
  gap: 16px;
}
.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.kpi .n {
  font-size: 27px;
  font-weight: 700;
  color: var(--brand);
}
.kpi .l {
  font-size: 13px;
  color: var(--muted);
}
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-ok {
  background: #e7f6ef;
  color: var(--ok);
}
.badge-warn {
  background: #fef3e2;
  color: var(--warn);
}
.badge-danger {
  background: #fdecec;
  color: var(--danger);
}
.badge-info {
  background: #eaf0fd;
  color: var(--info);
}
.badge-closed {
  background: #eef0f3;
  color: #6b7280;
}
.badge-cat {
  background: #eef4fa;
  color: var(--brand);
}
.match {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.match.top {
  border-left: 4px solid var(--ok);
}
.match-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.match-head .title {
  flex: 1;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.45;
}
.match-head .title .funder {
  display: block;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
}
.scorebox {
  text-align: center;
  min-width: 92px;
}
.scorebox .v {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}
.scorebox .k {
  font-size: 11.5px;
  color: var(--muted);
}
.meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
}
.meta b {
  color: var(--ink);
  font-weight: 600;
}
.bars {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}
.bar-row {
  display: grid;
  grid-template-columns: 150px 1fr 54px;
  gap: 10px;
  align-items: center;
  font-size: 12.5px;
}
.bar {
  background: #eef0f3;
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 99px;
}
.terms {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.term {
  background: #eef4fa;
  color: var(--brand-dark);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
}
.advice {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}
.adv {
  font-size: 13.5px;
  padding: 8px 11px;
  border-radius: 7px;
  border-left: 3px solid;
}
.adv-good {
  background: #f0f9f4;
  border-color: var(--ok);
}
.adv-warn {
  background: #fffaf0;
  border-color: var(--warn);
}
.adv-urgent {
  background: #fff5f5;
  border-color: var(--danger);
}
.adv-block {
  background: #f6f7f8;
  border-color: #9aa3af;
}
.adv-info {
  background: #f2f6fd;
  border-color: var(--info);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: #fff;
}
th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
th {
  background: #f8fafc;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
tr:hover td {
  background: #fbfcfe;
}
.form-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}
label {
  font-size: 14px;
  color: var(--muted);
}
input[type="text"],
input[type="email"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  background: #fff;
}
textarea {
  min-height: 110px;
  resize: vertical;
}
.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 7px;
  padding: 9px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover {
  background: var(--brand-dark);
  text-decoration: none;
  color: #fff;
}
.btn-ghost {
  background: #fff;
  color: var(--brand);
  border: 1px solid var(--brand);
}
.btn-ghost:hover {
  background: #eef4fa;
  color: var(--brand-dark);
}
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.filters select,
.filters input {
  width: auto;
  min-width: 160px;
}
.notice {
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 14px;
}
.notice-ok {
  background: #e7f6ef;
  color: #0d5c44;
}
.notice-err {
  background: #fdecec;
  color: #8d1c1c;
}
.section-list {
  counter-reset: s;
}
.section-list li {
  margin-bottom: 14px;
}
.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}
.checklist li {
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}
.checklist .mark {
  display: inline-block;
  width: 18px;
  color: var(--ok);
  font-weight: 700;
}
.checklist .todo .mark {
  color: #c8ccd2;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
}
footer {
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding: 18px 20px;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}
@media (max-width: 720px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  .bar-row {
    grid-template-columns: 110px 1fr 44px;
  }
}

/* ---------- หน้าเข้าสู่ระบบ ---------- */
body.auth-page {
  background: linear-gradient(135deg, #12324f 0%, #1c4e80 55%, #2a6ea8 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 18px;
}
.auth-wrap {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 0;
  max-width: 940px;
  width: 100%;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(8, 20, 35, 0.32);
}
.auth-brand {
  background: linear-gradient(160deg, #173f63, #1c4e80);
  color: #fff;
  padding: 38px 34px;
}
.auth-logo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 18px;
}
.auth-brand h1 {
  font-size: 21px;
  margin: 0 0 4px;
  line-height: 1.4;
}
.auth-brand p {
  margin: 0 0 22px;
  font-size: 13px;
  opacity: 0.72;
  letter-spacing: 0.3px;
}
.auth-brand ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.9;
  opacity: 0.92;
}
.auth-brand li {
  margin-bottom: 2px;
}
.auth-card {
  padding: 38px 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.auth-card h2 {
  margin: 0 0 4px;
  font-size: 20px;
}
.auth-card .field {
  margin: 16px 0;
}
.auth-card label {
  display: block;
  font-size: 13.5px;
  margin-bottom: 5px;
  color: var(--muted);
  font-weight: 600;
}
.auth-card input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}
.auth-card input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(28, 78, 128, 0.12);
}
.btn-block {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  margin-top: 6px;
}
.auth-foot {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  line-height: 1.7;
}
.logout-form {
  display: inline;
  margin: 0;
}
.link-btn {
  background: none;
  border: 0;
  color: #cfe0f0;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  padding: 2px 0;
  text-decoration: underline;
}
.link-btn:hover {
  color: #fff;
}
@media (max-width: 760px) {
  .auth-wrap {
    grid-template-columns: 1fr;
  }
  .auth-brand {
    padding: 28px 24px;
  }
  .auth-card {
    padding: 28px 24px;
  }
}
