/* ส่วนขยายของระบบออกแบบ — หน้าเนื้อหา, สมาชิก และฟอร์ม */

/* ================= หน้าเนื้อหาภายใน ================= */
.page-head{
  position:relative;color:#fff;padding:64px 0 56px;text-align:center;
  background:radial-gradient(90% 80% at 50% 20%, rgba(45,75,110,.5), rgba(22,40,60,0) 70%),linear-gradient(180deg,#17293E,#12233A);
}
.page-head::after{content:"";position:absolute;left:0;right:0;bottom:0;height:1px;background:linear-gradient(90deg,transparent,var(--gold),transparent)}
.page-head h1{font-size:clamp(29px,3.6vw,41px);color:#fff}
.page-head .eyebrow{justify-content:center;color:var(--gold-lt);margin-bottom:10px}
.page-head .eyebrow::after,.page-head .eyebrow::before{background:var(--gold-lt)}
.page-head p{color:#B9C5CF;margin-top:12px;font-size:16.5px}
.crumbs{margin-top:14px;font-size:14.5px;color:#8E9BA6}
.crumbs a{text-decoration:none;color:#B9C5CF}
.crumbs a:hover{color:var(--gold-2)}

.prose{max-width:74ch;color:var(--text)}
.prose p{margin-bottom:16px;color:#37424E}
.prose h3{font-size:21px;margin:28px 0 10px}
.prose ul{padding-left:20px;color:#37424E}
.prose .lead{font-size:18px;color:var(--ink-2)}

.panel{background:#fff;border:1px solid var(--line);border-radius:var(--r);padding:30px}
.panel + .panel{margin-top:22px}
.panel h2{font-size:22px;margin-bottom:6px}
.panel h3{font-size:18px}
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:24px}
.grid-3{display:grid;grid-template-columns:repeat(3,1fr);gap:24px}
.grid-side{display:grid;grid-template-columns:1fr 340px;gap:34px;align-items:start}
@media(max-width:900px){.grid-2,.grid-3,.grid-side{grid-template-columns:1fr}}

/* ตารางข้อมูลทะเบียน */
.reg-table{width:100%;border-collapse:collapse;font-size:15.5px}
.reg-table th,.reg-table td{text-align:left;padding:12px 0;border-bottom:1px solid var(--line);vertical-align:top}
.reg-table th{color:var(--muted);font-weight:400;width:56%}
.reg-table td{color:var(--ink);font-variant-numeric:tabular-nums}
.reg-table tr:last-child th,.reg-table tr:last-child td{border-bottom:none}

/* เส้นเวลาประวัติ */
.timeline{list-style:none;margin:22px 0 0;padding:0;border-left:1px solid var(--line)}
.timeline li{padding:0 0 18px 22px;position:relative;font-size:16px}
.timeline li::before{content:"";position:absolute;left:-4.5px;top:11px;width:8px;height:8px;border-radius:50%;background:var(--gold)}
.timeline .yr{font-variant-numeric:tabular-nums;color:var(--gold-3);margin-right:10px;font-weight:500}

/* ================= ข้อความแจ้งเตือน ================= */
.alert{padding:13px 17px;border-radius:6px;margin-bottom:16px;font-size:15.5px;border:1px solid}
.alert-ok{background:#EFF9F2;border-color:#B7E2C8;color:#1D6B3C}
.alert-error{background:#FDF1F1;border-color:#F0C2C2;color:#9B2C2C}
.alert-warn{background:#FDF8EC;border-color:#EBD9A8;color:#7A5E13}

/* ================= ฟอร์มพื้นสว่าง ================= */
.form-light{display:grid;gap:16px}
.form-light label{color:var(--muted);font-size:14.5px;display:block;margin-bottom:6px}
.form-light input,.form-light select,.form-light textarea{
  width:100%;font:inherit;font-size:16px;padding:12px 14px;border:1px solid var(--line);
  border-radius:6px;background:#fff;color:var(--text)
}
.form-light textarea{min-height:120px;resize:vertical}
.form-light input:focus,.form-light select:focus,.form-light textarea:focus{border-color:var(--gold);outline:none}
.btn-submit{
  background:linear-gradient(180deg,var(--gold-2),var(--gold));color:#2A1F06;border:none;padding:14px 24px;
  border-radius:6px;font:inherit;font-weight:600;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:9px
}
.btn-submit:hover{filter:brightness(1.06)}
.btn-submit svg{width:16px;height:16px;stroke-width:2}
.btn-ghost{
  display:inline-flex;align-items:center;gap:9px;padding:12px 22px;border:1px solid var(--line);
  border-radius:6px;text-decoration:none;font-size:15.5px;background:#fff;cursor:pointer;font-family:inherit;color:var(--text)
}
.btn-ghost:hover{border-color:var(--gold);color:var(--gold-3)}
.btn-ghost svg{width:15px;height:15px}
.btn-danger{border-color:#E5B4B4;color:#9B2C2C;background:#fff}
.btn-danger:hover{background:#FDF1F1;border-color:#D98A8A;color:#9B2C2C}
.form-actions{display:flex;gap:12px;flex-wrap:wrap;align-items:center}
.hint{font-size:13.5px;color:var(--muted);margin-top:5px}
.req{color:#A33}

/* ================= เข้าสู่ระบบ / สมัครสมาชิก ================= */
.auth-wrap{max-width:470px;margin:0 auto}
.auth-card{background:#fff;border:1px solid var(--line);border-radius:var(--r);padding:34px;box-shadow:0 16px 40px rgba(22,40,60,.08)}
.auth-card h1{font-size:24px;text-align:center}
.auth-card .sub{text-align:center;color:var(--muted);font-size:15.5px;margin:8px 0 24px}
.auth-alt{text-align:center;margin-top:20px;font-size:15px;color:var(--muted)}
.auth-alt a{color:var(--ink);border-bottom:1px solid var(--gold);text-decoration:none}

/* ================= พื้นที่สมาชิก ================= */
.member-layout{display:grid;grid-template-columns:252px 1fr;gap:32px;align-items:start}
.side-nav{background:#fff;border:1px solid var(--line);border-radius:var(--r);padding:12px;position:sticky;top:96px}
.side-nav a{display:flex;align-items:center;gap:11px;padding:11px 14px;border-radius:6px;text-decoration:none;font-size:15.5px;color:var(--text)}
.side-nav a:hover{background:var(--paper-2)}
.side-nav a.on{background:var(--ink);color:#fff}
.side-nav a.on svg{color:var(--gold-2)}
.side-nav svg{width:18px;height:18px;color:var(--muted);flex:none}
.side-nav .sep{height:1px;background:var(--line);margin:10px 6px}
.user-chip{padding:12px 14px 14px;border-bottom:1px solid var(--line);margin-bottom:8px}
.user-chip strong{display:block;font-size:16px}
.user-chip span{font-size:13.5px;color:var(--muted)}
@media(max-width:900px){.member-layout{grid-template-columns:1fr}.side-nav{position:static}}

/* สถิติ */
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:18px;margin-bottom:26px}
.stat{background:#fff;border:1px solid var(--line);border-radius:var(--r);padding:20px}
.stat .n{font-family:Trirong,serif;font-size:30px;color:var(--ink);line-height:1.25}
.stat .l{font-size:14.5px;color:var(--muted)}
@media(max-width:900px){.stats{grid-template-columns:1fr 1fr}}

/* ตารางรายการ */
.table{width:100%;border-collapse:collapse;background:#fff;font-size:15.5px}
.table th{text-align:left;background:var(--paper-2);padding:13px 16px;font-weight:500;color:var(--muted);font-size:14.5px;border-bottom:1px solid var(--line)}
.table td{padding:14px 16px;border-bottom:1px solid var(--line);vertical-align:top}
.table tr:last-child td{border-bottom:none}
.table a{color:var(--ink)}
.table-wrap{overflow-x:auto;border:1px solid var(--line);border-radius:var(--r)}
.empty{padding:44px 20px;text-align:center;color:var(--muted);background:#fff;border:1px dashed var(--line);border-radius:var(--r)}

/* ป้ายสถานะ */
.st{display:inline-block;font-size:13px;padding:3px 11px;border-radius:99px;white-space:nowrap}
.st-new{background:#E8F0F7;color:#1F4D75}
.st-progress{background:#FDF3E0;color:#8A6314}
.st-answered{background:#E9F7EE;color:#1D6B3C}
.st-closed{background:#EEEFF1;color:#5A6570}

/* กล่องสนทนา */
.thread{display:grid;gap:16px}
.msg{border:1px solid var(--line);border-radius:var(--r);padding:18px 20px;background:#fff}
.msg.staff{background:#FBF8F0;border-color:rgba(200,162,76,.4)}
.msg .who{font-size:14px;color:var(--muted);margin-bottom:8px;display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.msg .who b{color:var(--ink);font-weight:500}
.msg .body{white-space:pre-wrap;font-size:16px;color:#37424E}

/* เส้นเวลาคดี */
.case-timeline{list-style:none;padding:0;margin:0;border-left:2px solid var(--line)}
.case-timeline li{position:relative;padding:0 0 26px 26px}
.case-timeline li::before{content:"";position:absolute;left:-7px;top:6px;width:12px;height:12px;border-radius:50%;background:var(--gold);border:2px solid #fff}
.case-timeline .when{font-size:14px;color:var(--gold-3);font-variant-numeric:tabular-nums}
.case-timeline h4{font-family:Trirong,serif;font-size:17.5px;margin:2px 0 5px}
.case-timeline p{font-size:15.5px;color:var(--muted);white-space:pre-wrap}

/* รายการบทความแบบแถว */
.article-list{display:grid;gap:18px}
.article-row{display:grid;grid-template-columns:210px 1fr;gap:0;background:#fff;border:1px solid var(--line);border-radius:var(--r);overflow:hidden;text-decoration:none;transition:.2s}
.article-row:hover{box-shadow:0 14px 34px rgba(12,26,40,.09)}
.article-row .thumb{min-height:160px;background:var(--ink) center/cover no-repeat;display:grid;place-items:center;color:rgba(255,255,255,.5)}
.article-row .thumb svg{width:44px;height:44px;stroke-width:1}
.article-row .thumb img{width:100%;height:100%;object-fit:cover}
.article-row .rbody{padding:22px}
.article-row h3{font-size:20px;margin-bottom:8px;line-height:1.45}
.article-row p{color:var(--muted);font-size:15.5px}
.lock{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:var(--gold-3);border:1px solid var(--gold);border-radius:99px;padding:2px 10px}
.lock svg{width:12px;height:12px}
@media(max-width:700px){.article-row{grid-template-columns:1fr}}

/* แบ่งหน้า */
.pager{display:flex;gap:8px;justify-content:center;margin-top:34px;flex-wrap:wrap}
.pager a,.pager span{padding:9px 15px;border:1px solid var(--line);border-radius:6px;text-decoration:none;font-size:15px;background:#fff}
.pager .on{background:var(--ink);color:#fff;border-color:var(--ink)}


/* การ์ดบุคลากรแบบเต็มหน้า */
.person{display:grid;grid-template-columns:230px 1fr;gap:30px;background:#fff;border:1px solid var(--line);border-radius:var(--r);padding:26px}
.person .pic{border-radius:6px;overflow:hidden;border:1px solid var(--line);aspect-ratio:4/5;background:var(--paper-2)}
.person .pic img{width:100%;height:100%;object-fit:cover;object-position:center top}
.person .pic.empty{display:grid;place-items:center;color:#A9B2BB;border-style:dashed}
.person .pic.empty svg{width:56px;height:56px;stroke-width:1}
.person h2{font-size:23px}
.person .role{color:var(--gold-3);font-size:15.5px;margin-top:3px}
.person .bio{color:var(--muted);margin-top:14px;font-size:16px}
@media(max-width:700px){.person{grid-template-columns:1fr}.person .pic{max-width:220px}}

/* แผนที่ */
.map-embed{border:1px solid var(--line);border-radius:var(--r);overflow:hidden;height:340px;background:var(--paper-2)}
.map-embed iframe{width:100%;height:100%;border:0;display:block}

/* ================= แก้การล้นแนวนอนบนจอเล็ก ================= */
html,body{overflow-x:hidden}
.hero,.contact,.page-head,.about-visual{overflow:hidden}

@media(max-width:1240px){
  .head-in{gap:12px}
  .brand{min-width:0;flex:1}
  .brand > span{min-width:0;overflow:hidden}
  .brand-th{font-size:16px;overflow:hidden;text-overflow:ellipsis}
  .burger{flex:none;margin-left:auto}
}
@media(max-width:520px){
  .brand-mark{width:32px;height:36px}
  .brand-th{font-size:14.5px;line-height:1.25}
  .brand-en{font-size:8.5px;letter-spacing:.2em}
}
@media(max-width:980px){
  .hero-scales{right:auto;left:50%;transform:translate(-50%,-50%);width:78vw;max-width:340px;opacity:.12}
  .hero-tag{letter-spacing:.16em;font-size:12px}
  .hero h1{font-size:clamp(28px,8vw,40px)}
  .hero-quote{font-size:17.5px}
  .svc-more a{white-space:normal}
}
@media(max-width:700px){
  section{padding:58px 0}
  .wrap{padding:0 18px}
  .about-body{padding:48px 18px}
  .panel{padding:22px}
  .page-head{padding:48px 0 42px}
  .form-card{padding:22px}
  .info{gap:20px}
  .person{padding:20px}
  .table th,.table td{padding:11px 12px}
}

/* ช่องกรอกต้องย่อได้ในกริด ไม่งั้นดันหน้าเว็บกว้างเกินจอ */
input,select,textarea{min-width:0;max-width:100%}
.row2 > *,.grid-2 > *,.grid-3 > *,.grid-side > *,.svc-grid > *,.news-grid > *,.team-grid > *,.foot-grid > *,.hero-grid > *,.about-body > *{min-width:0}
@media(max-width:700px){
  .row2{grid-template-columns:1fr}
}

/* บนจอเล็ก .hero เป็น flex container — ต้องเรียงเป็นแนวตั้งไม่งั้นสโลแกนไปอยู่ข้างเนื้อหา */
@media(max-width:980px){
  .hero{flex-direction:column;align-items:stretch;justify-content:flex-start}
  .hero .hero-tag{position:static;text-align:left;margin:0 0 40px;padding:0 24px}
  .hero .hero-grid{padding-bottom:34px}
}
@media(max-width:700px){
  .hero .hero-tag{padding:0 18px}
}

/* ================= ปรับการอ่านบนมือถือ ================= */
@media(max-width:700px){
  /* ตารางข้อมูลทะเบียน: วางบนล่างแทนซ้ายขวา */
  .reg-table,.reg-table tbody,.reg-table tr,.reg-table th,.reg-table td{display:block;width:100%}
  .reg-table th{border:none;padding:12px 0 2px;font-size:13.5px}
  .reg-table td{padding:0 0 12px;border-bottom:1px solid var(--line);text-align:left}

  /* ตารางรายการของสมาชิก: แสดงเป็นการ์ดทีละรายการ */
  .table-wrap{border:none;background:transparent;overflow:visible}
  .table,.table tbody,.table tr,.table td{display:block;width:100%}
  .table thead{display:none}
  .table tr{
    background:#fff;border:1px solid var(--line);border-radius:var(--r);
    padding:6px 16px 12px;margin-bottom:14px
  }
  .table td{border:none;padding:9px 0 0;display:flex;gap:14px;align-items:flex-start;justify-content:space-between}
  .table td[data-label]::before{
    content:attr(data-label);color:var(--muted);font-size:13.5px;flex:none;max-width:44%
  }
  .table td:not([data-label]){
    justify-content:flex-end;border-top:1px solid var(--line);margin-top:10px;padding-top:12px
  }
  .table td:not([data-label]) a{
    display:inline-flex;align-items:center;gap:7px;color:var(--gold-dk);
    border-bottom:1px solid var(--gold);padding-bottom:2px
  }
  .table td .hint{margin-top:2px}
}
