:root {
  --bg: #121212;
  --card: #1e1e1e;
  --card-deep: #171917;
  --text: #f5f5f5;
  --muted: #a9ada9;
  --line: #363a36;
  --green: #1ca650;
  --green-bright: #39c66c;
  --danger: #ff6d6d;
  --max: 1180px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", "Thonburi", "Noto Sans Thai", "Leelawadee UI", sans-serif;
  line-height: 1.65;
}
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
.internal-header {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 15px max(24px, calc((100vw - var(--max)) / 2));
  border-bottom: 1px solid rgba(255,255,255,.1);
  background: rgba(9,11,9,.94);
}
.internal-brand { display: flex; align-items: center; gap: 13px; font-size: 1.15rem; font-weight: 900; }
.internal-brand img { width: 50px; height: 50px; object-fit: cover; border: 1px solid #424742; border-radius: 13px; }
.internal-brand small { display: block; margin-top: -3px; color: var(--muted); font-size: .62rem; letter-spacing: .19em; }
.back-link { padding: 9px 15px; border: 1px solid #454945; border-radius: 999px; color: #e9ece9; font-size: .86rem; font-weight: 800; }
.back-link:hover, .back-link:focus-visible { border-color: var(--green); color: var(--green-bright); outline: none; }
.internal-actions { display: flex; align-items: center; gap: 10px; }
.login-link { padding: 10px 18px; border-radius: 999px; background: var(--green); color: #061008; font-size: .86rem; font-weight: 900; }
.login-link:hover, .login-link:focus-visible { background: var(--green-bright); outline: none; }
main { width: min(calc(100% - 48px), var(--max)); margin: 0 auto; padding: clamp(58px, 8vw, 108px) 0 80px; display: grid; grid-template-columns: .82fr 1.18fr; gap: clamp(40px, 7vw, 90px); align-items: start; }
.intro { position: sticky; top: 40px; }
.eyebrow, .form-kicker { margin: 0 0 13px; color: var(--green-bright); font-size: .76rem; font-weight: 900; letter-spacing: .18em; }
h1 { margin: 0; font-size: clamp(2.5rem, 5.6vw, 5rem); line-height: 1.02; letter-spacing: -.055em; }
h1 span { color: var(--green-bright); }
.intro-copy { max-width: 530px; margin: 27px 0 0; color: #d0d3d0; font-size: clamp(1rem, 1.45vw, 1.15rem); }
.security-note { margin-top: 34px; padding: 18px 20px; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 10px; background: var(--card-deep); }
.security-note strong, .security-note span { display: block; }
.security-note strong { color: #fff; }
.security-note span { margin-top: 3px; color: var(--muted); font-size: .87rem; }
.form-card { padding: clamp(24px, 4vw, 46px); border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: 0 28px 75px rgba(0,0,0,.25); }
.form-heading { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 31px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.form-heading h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.35rem); line-height: 1.2; }
.form-kicker { margin-bottom: 6px; }
.required-note { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .77rem; white-space: nowrap; }
.required-note i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.field-grid { display: grid; gap: 18px; }
.two-columns { grid-template-columns: repeat(2, minmax(0,1fr)); }
.field { display: grid; gap: 8px; margin-bottom: 19px; }
.field > span { color: #e9ebe9; font-size: .88rem; font-weight: 800; }
.field b, .consent b { color: var(--green-bright); }
.field input, .field select {
  width: 100%; min-height: 52px; padding: 0 15px;
  border: 1px solid #474b47; border-radius: 9px;
  background: #151715; color: #fff; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.field input::placeholder { color: #717671; }
.field input:hover, .field select:hover { border-color: #626762; }
.field input:focus, .field select:focus { border-color: var(--green); background: #121512; box-shadow: 0 0 0 3px rgba(28,166,80,.16); }
.field input:user-invalid { border-color: var(--danger); }
.field small { color: var(--muted); font-size: .76rem; }
.consent { display: grid; grid-template-columns: 22px 1fr; gap: 11px; align-items: start; margin: 4px 0 25px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; color: #c8cbc8; font-size: .82rem; }
.consent input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--green); }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.form-actions p { margin: 0; color: var(--muted); font-size: .74rem; }
.form-actions strong { color: #d6d9d6; }
.form-actions button {
  flex: 0 0 auto; min-height: 50px; padding: 0 20px;
  border: 0; border-radius: 999px; background: var(--green); color: #061008;
  font-weight: 900; cursor: pointer; box-shadow: 0 10px 30px rgba(28,166,80,.22);
}
.form-actions button:hover, .form-actions button:focus-visible { background: var(--green-bright); transform: translateY(-1px); outline: none; }
.form-actions button:disabled { cursor: wait; opacity: .65; transform: none; }
.form-result { margin-bottom: 20px; padding: 13px 15px; border: 1px solid; border-radius: 9px; font-size: .88rem; font-weight: 700; }
.form-result.is-success { border-color: rgba(57,198,108,.55); background: rgba(28,166,80,.12); color: #88e5aa; }
.form-result.is-error { border-color: rgba(255,109,109,.5); background: rgba(255,109,109,.08); color: #ff9b9b; }
.honeypot { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.auth-shell { min-height: calc(100vh - 83px); display: grid; place-items: center; padding: 48px 24px; }
.auth-card { width: min(100%, 520px); padding: clamp(28px, 5vw, 48px); border: 1px solid var(--line); border-radius: 18px; background: var(--card); box-shadow: 0 28px 75px rgba(0,0,0,.32); }
.auth-card h1 { font-size: clamp(2rem, 5vw, 3.25rem); }
.auth-card .intro-copy { margin: 15px 0 28px; font-size: .95rem; }
.auth-card .form-actions { margin-top: 8px; }
.auth-card .form-actions button { width: 100%; }
.auth-card .form-actions + .text-link, .text-link { display: inline-block; margin-top: 18px; color: var(--green-bright); font-size: .86rem; font-weight: 800; }
.auth-card .form-result { margin-top: 18px; margin-bottom: 0; }
.profile-main { display: block; padding-top: 48px; }
.profile-top { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 28px; }
.profile-top h1 { font-size: clamp(2.2rem, 6vw, 4.8rem); }
.profile-card { display: grid; grid-template-columns: 230px 1fr; gap: clamp(28px, 5vw, 60px); }
.avatar-panel { text-align: center; }
.avatar-preview { width: 180px; height: 180px; display: block; margin: 0 auto 17px; border: 1px solid #4a504a; border-radius: 50%; object-fit: cover; background: #101210; }
.avatar-input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-button { display: inline-flex; min-height: 42px; padding: 0 16px; align-items: center; justify-content: center; border: 1px solid #505650; border-radius: 999px; cursor: pointer; font-size: .82rem; font-weight: 800; }
.avatar-help { margin: 10px 0 0; color: var(--muted); font-size: .72rem; }
.readonly { opacity: .7; }
.logout-button { padding: 9px 15px; border: 1px solid #654040; border-radius: 999px; background: transparent; color: #ffaaaa; cursor: pointer; font-weight: 800; }
.user-chip { color: var(--muted); font-size: .82rem; }
.user-chip strong { display: block; color: #fff; }
.toast { position: fixed; z-index: 20; right: 22px; bottom: 22px; max-width: min(390px, calc(100vw - 44px)); padding: 14px 18px; border: 1px solid rgba(57,198,108,.5); border-radius: 10px; background: #18331f; color: #b8f2cb; box-shadow: 0 18px 50px rgba(0,0,0,.35); font-weight: 800; }
.toast.is-error { border-color: rgba(255,109,109,.5); background: #3a2020; color: #ffc0c0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.admin-main { display: block; padding-top: 46px; }
.admin-heading { display: flex; justify-content: space-between; align-items: end; gap: 28px; margin-bottom: 32px; }
.admin-heading h1 { font-size: clamp(2.45rem, 6vw, 4.8rem); }
.admin-heading .intro-copy { margin-top: 15px; }
.primary-button, .secondary-button, .danger-button, .icon-button, .row-actions button { border: 0; cursor: pointer; font-weight: 900; }
.primary-button { min-height: 47px; padding: 0 20px; border-radius: 999px; background: var(--green); color: #061008; white-space: nowrap; }
.primary-button:hover, .primary-button:focus-visible { background: var(--green-bright); outline: none; }
.admin-stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.admin-stats article { padding: 21px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); }
.admin-stats span { display: block; color: var(--muted); font-size: .78rem; font-weight: 800; }
.admin-stats strong { display: block; margin-top: 4px; color: #fff; font-size: 2rem; line-height: 1.1; }
.admin-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.admin-toolbar { display: flex; gap: 14px; padding: 18px; border-bottom: 1px solid var(--line); }
.search-field { flex: 1; }
.search-field input, .filter-field select { width: 100%; height: 46px; padding: 0 14px; border: 1px solid #474b47; border-radius: 9px; background: #141714; color: #fff; outline: none; }
.search-field input:focus, .filter-field select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(28,166,80,.14); }
.filter-field { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; font-weight: 800; }
.filter-field select { min-width: 150px; }
.table-wrap { overflow-x: auto; }
.member-table { width: 100%; border-collapse: collapse; min-width: 920px; }
.member-table th, .member-table td { padding: 16px 18px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.member-table th { color: var(--muted); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.member-table tbody tr:last-child td { border-bottom: 0; }
.member-table tbody tr:hover { background: rgba(255,255,255,.018); }
.member-table td { color: #d9ddd9; font-size: .84rem; }
.member-table td > strong, .member-table td > small { display: block; }
.member-table td > small, .member-cell small { color: var(--muted); }
.member-cell { display: flex; align-items: center; gap: 11px; }
.member-cell span:last-child, .member-cell strong, .member-cell small { display: block; }
.member-avatar { display: grid; flex: 0 0 40px; width: 40px; height: 40px; place-items: center; border-radius: 50%; background: #173c22; color: var(--green-bright); font-weight: 900; text-transform: uppercase; }
.status-badge { display: inline-flex; padding: 5px 10px; border-radius: 999px; font-size: .7rem; font-weight: 900; }
.status-badge.is-pending { background: rgba(255,184,77,.12); color: #ffc46b; }
.status-badge.is-active { background: rgba(57,198,108,.13); color: #75de9b; }
.status-badge.is-rejected { background: rgba(255,109,109,.1); color: #ff9b9b; }
.actions-heading { text-align: right !important; }
.row-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.row-actions button { padding: 6px 9px; border: 1px solid #475047; border-radius: 7px; background: #151915; color: #dfe5df; font-size: .7rem; }
.row-actions button:hover { border-color: var(--green); color: var(--green-bright); }
.row-actions .reject, .row-actions .delete { border-color: #604040; color: #ffaaaa; }
.empty-row { height: 130px; color: var(--muted) !important; text-align: center !important; }
.error-row { color: #ffaaaa !important; }
.admin-dialog { width: min(680px, calc(100vw - 30px)); max-height: calc(100vh - 40px); overflow-y: auto; padding: clamp(24px,4vw,38px); border: 1px solid #444a44; border-radius: 16px; background: #1e211e; color: var(--text); box-shadow: 0 30px 90px rgba(0,0,0,.65); }
.admin-dialog::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(5px); }
.dialog-heading { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 27px; }
.dialog-heading h2, .confirm-dialog h2 { margin: 0; font-size: 1.8rem; }
.icon-button { width: 38px; height: 38px; border: 1px solid #4d534d; border-radius: 50%; background: transparent; color: #fff; font-size: 1.4rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 15px; }
.secondary-button, .danger-button { min-height: 44px; padding: 0 18px; border-radius: 999px; }
.secondary-button { border: 1px solid #505650; background: transparent; color: #fff; }
.danger-button { background: #a73b3b; color: #fff; }
.confirm-dialog { width: min(480px, calc(100vw - 30px)); }
.confirm-dialog p:not(.eyebrow) { color: var(--muted); }
.dashboard-main { display: block; padding-top: clamp(52px,7vw,88px); }
.dashboard-hero { max-width: 790px; margin-bottom: clamp(36px,6vw,62px); }
.dashboard-hero h1 { font-size: clamp(3rem,8vw,6.6rem); }
.dashboard-links { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.system-card { min-height: 225px; display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: start; padding: clamp(24px,3.5vw,38px); border: 1px solid var(--line); border-radius: 16px; background: var(--card); transition: border-color .2s, transform .2s, background .2s; }
a.system-card:hover, a.system-card:focus-visible { border-color: var(--green); background: #202720; transform: translateY(-3px); outline: none; }
.system-number { color: #657065; font-size: .72rem; font-weight: 900; letter-spacing: .12em; }
.system-card h2 { margin: 14px 0 4px; color: #fff; font-size: clamp(1.35rem,2.3vw,2rem); line-height: 1.18; }
.system-card p { margin: 0; color: var(--muted); }
.system-arrow { color: var(--green-bright); font-size: 1.55rem; line-height: 1; }
.system-badge { display: inline-flex; padding: 5px 10px; border-radius: 999px; background: rgba(255,184,77,.1); color: #ffc46b; font-size: .67rem; font-weight: 900; }
.system-badge.is-live { background: rgba(57,198,108,.13); color: #79df9f; }
.system-card.is-disabled { opacity: .6; cursor: not-allowed; }
.loading-card { grid-template-columns: 1fr; }
.security-warning { display: flex; gap: 16px; align-items: flex-start; margin-top: 30px; padding: 20px 22px; border: 1px solid rgba(255,128,73,.55); border-radius: 13px; background: rgba(150,55,27,.14); color: #ffd3bf; }
.warning-icon { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: #d95d32; color: #fff; font-size: 1.1rem; font-weight: 900; }
.security-warning strong { display: block; color: #ffe6db; }
.security-warning p { margin: 2px 0 0; color: #eab8a3; font-size: .86rem; }
.public-warning { width: min(calc(100% - 48px), var(--max)); margin: 0 auto 28px; }
footer { width: min(calc(100% - 48px), var(--max)); margin: 0 auto; padding: 22px 0 34px; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .77rem; }
@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
  .intro { position: static; }
  .intro-copy { max-width: 680px; }
}
@media (max-width: 620px) {
  .internal-header { min-height: 72px; padding: 11px 18px; }
  .internal-brand img { width: 44px; height: 44px; }
  .internal-brand { font-size: 1rem; }
  .back-link { padding: 8px 11px; font-size: .75rem; }
  .login-link { padding: 8px 12px; font-size: .75rem; }
  .internal-actions { gap: 6px; }
  main { width: min(calc(100% - 30px), var(--max)); padding-top: 42px; }
  .two-columns { grid-template-columns: 1fr; gap: 0; }
  .form-card { border-radius: 13px; }
  .form-heading, .form-actions, footer { align-items: flex-start; flex-direction: column; }
  .form-actions button { width: 100%; }
  footer { width: min(calc(100% - 30px), var(--max)); }
  .profile-card { grid-template-columns: 1fr; }
  .profile-top { align-items: flex-start; flex-direction: column; }
  .admin-heading, .admin-toolbar { align-items: stretch; flex-direction: column; }
  .admin-heading .primary-button { width: 100%; }
  .admin-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .filter-field { align-items: stretch; flex-direction: column; gap: 5px; }
  .filter-field select { min-width: 0; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions button { width: 100%; }
  .dashboard-links { grid-template-columns: 1fr; }
  .system-card { min-height: 190px; gap: 13px; }
  .security-warning { padding: 17px; }
  .public-warning { width: min(calc(100% - 30px), var(--max)); }
}
