:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #7a8194;
  --accent: #3b5bdb;
  --accent-dark: #2f49b0;
  --border: #e3e7f0;
  --good: #137a3f;
  --good-bg: #e6f6ec;
  --bad: #b42318;
  --bad-bg: #fdeceb;
  --wait: #b8730a;
  --wait-bg: #fff4e0;
  --info: #1f6fb2;
  --info-bg: #e6f1fa;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Noto Sans Thai", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.logo {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.logo small { font-weight: 400; font-size: 0.72rem; color: var(--muted); }

nav { display: flex; align-items: center; gap: 16px; font-size: 0.9rem; }
nav a { color: var(--accent); text-decoration: none; }
nav a:hover { text-decoration: underline; }
nav .who { color: var(--muted); font-weight: 600; }

main { max-width: 880px; margin: 32px auto; padding: 0 24px; }

h1 { margin-top: 0; }
h2 { margin-top: 0; font-size: 1.15rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(20, 30, 60, 0.04);
}

label {
  display: block;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 0.9rem;
}

input, select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  font-size: 1rem;
  font-weight: 400;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
input[type="file"] { padding: 8px; }

button, .btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px 20px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  margin-top: 8px;
}
button:hover, .btn:hover { background: var(--accent-dark); }

.muted { color: var(--muted); font-weight: 400; font-size: 0.9rem; }
.error { color: var(--bad); background: var(--bad-bg); padding: 10px 14px; border-radius: 8px; }

/* Status badge tones */
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 0.85rem;
  font-weight: 600;
}
.badge.wait { background: var(--wait-bg); color: var(--wait); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.bad  { background: var(--bad-bg);  color: var(--bad); }

/* Result banner */
.banner { padding: 16px 18px; border-radius: 10px; font-weight: 600; margin-bottom: 24px; }
.banner.good { background: var(--good-bg); color: var(--good); }
.banner.bad  { background: var(--bad-bg);  color: var(--bad); }

/* Status stepper */
.stepper {
  list-style: none;
  display: flex;
  padding: 0;
  margin: 8px 0 20px;
  counter-reset: step;
}
.stepper li {
  flex: 1;
  text-align: center;
  position: relative;
  font-size: 0.82rem;
  color: var(--muted);
}
.stepper li::before {
  content: "";
  position: absolute;
  top: 15px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.stepper li:first-child::before { display: none; }
.stepper .dot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0 auto 6px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--border);
  font-weight: 700;
  color: var(--muted);
}
.stepper .lbl { display: block; }
.stepper li.done .dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.stepper li.done::before { background: var(--accent); }
.stepper li.current .dot { border-color: var(--accent); color: var(--accent); }
.stepper li.current { color: var(--ink); font-weight: 600; }
.stepper li.current.good .dot { background: var(--good); border-color: var(--good); color: #fff; }
.stepper li.current.bad  .dot { background: var(--bad);  border-color: var(--bad);  color: #fff; }

.docs { padding-left: 18px; }
.docs li { margin-bottom: 6px; }

/* Document checklist (student dashboard) */
.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-list > li {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.doc-head { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; }
.doc-head .num {
  flex: none;
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--info-bg); color: var(--info);
  font-size: 0.82rem; font-weight: 700;
}
.doc-label { line-height: 1.4; }
.doc-status { margin: 8px 0; font-size: 0.88rem; }
.doc-status .ok { color: var(--good); font-weight: 600; margin-right: 8px; }
.doc-input { margin-top: 12px; width: 100%; }

.doc-list.locked > li { background: #fafbfe; }
.doc-list.locked > li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.submit-block { margin-top: 8px; }
button.big { font-size: 1.05rem; padding: 13px 28px; }
button.big:disabled { background: #c4cad8; cursor: not-allowed; }

.doc-cell { font-size: 0.82rem; line-height: 1.7; }
.btn-sm {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 12px;
  background: var(--accent);
  color: #fff;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}
.btn-sm:hover { background: var(--accent-dark); }

table { width: 100%; border-collapse: collapse; padding: 0; }
th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: top;
}
th {
  background: #f8f9fc;
  font-size: 0.78rem;
  color: var(--muted);
}
tbody tr:last-child td { border-bottom: none; }

/* Inline status form in admin table */
form.inline { margin: 0; display: flex; gap: 6px; align-items: center; }
form.inline select { width: auto; margin-top: 0; padding: 6px 8px; font-size: 0.85rem; }
form.inline button { margin-top: 0; padding: 7px 12px; font-size: 0.85rem; }

a { color: var(--accent); }

/* Password field with show/hide eye toggle */
.pw-wrap { position: relative; display: block; margin-top: 6px; }
.pw-wrap input { margin-top: 0; padding-right: 46px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; margin: 0; padding: 6px;
  color: var(--muted); cursor: pointer; line-height: 0;
}
.pw-toggle:hover { background: none; color: var(--ink); }
.pw-toggle .eye-off { display: none; }
.pw-toggle.on .eye { display: none; }
.pw-toggle.on .eye-off { display: inline; }

/* 5-step stepper: tighten labels so they fit on narrow screens */
.stepper li { font-size: 0.76rem; padding: 0 2px; }
@media (max-width: 520px) {
  .stepper .lbl { font-size: 0.68rem; }
}
