/* DWR Water Project — public form & tracking (self-contained) */

.dwr-fe {
    --w-primary: #1a5276;
    --w-primary-dark: #154360;
    --w-accent: #2980b9;
    --w-text: #1f2937;
    --w-muted: #6b7280;
    --w-border: #e5e7eb;
    --w-bg-soft: #f3f4f6;
    max-width: 880px;
    margin: 0 auto;
    padding: 0 16px 48px;
    font-family: 'IBM Plex Sans Thai', 'Prompt', 'Sarabun', Tahoma, sans-serif;
    color: var(--w-text);
    line-height: 1.6;
}

.dwr-fe * { box-sizing: border-box; }

/* hero */
.dwr-fe-hero {
    color: #fff;
    padding: 40px 28px;
    border-radius: 14px;
    margin: 24px 0;
    text-align: center;
}
.dwr-fe-hero h1 { margin: 0 0 6px; font-size: 26px; color: #fff; }
.dwr-fe-hero p { margin: 0; opacity: .9; }

/* cards */
.dwr-fe-card {
    background: #fff;
    border: 1px solid var(--w-border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.dwr-fe-section {
    font-size: 16px;
    margin: 18px 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--w-bg-soft);
    color: var(--w-primary);
}
.dwr-fe-section:first-child { margin-top: 0; }

/* form grid */
.dwr-fe-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 640px) { .dwr-fe-grid { grid-template-columns: 1fr; } }

.dwr-fe-field { display: flex; flex-direction: column; margin-bottom: 14px; }
.dwr-fe-field label { font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.dwr-fe-req { color: #d63638; }

.dwr-fe-field input[type="text"],
.dwr-fe-field input[type="email"],
.dwr-fe-field input[type="tel"],
.dwr-fe-field input[type="number"],
.dwr-fe-field select,
.dwr-fe-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--w-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
}
.dwr-fe-field input:focus,
.dwr-fe-field select:focus,
.dwr-fe-field textarea:focus {
    outline: none;
    border-color: var(--w-accent);
    box-shadow: 0 0 0 3px rgba(41,128,185,.15);
}

.dwr-fe-file-list { margin-top: 8px; }
.dwr-fe-file-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--w-muted); padding: 2px 0; }
.dwr-fe-file-remove {
    flex: 0 0 auto; width: 22px; height: 22px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid #d6dee8; border-radius: 6px; background: #fff;
    color: #b32d2e; font-size: 15px; line-height: 1; cursor: pointer;
}
.dwr-fe-file-remove:hover { background: #b32d2e; border-color: #b32d2e; color: #fff; }

/* buttons */
.dwr-fe-btn {
    display: inline-block;
    padding: 11px 22px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: background .15s, box-shadow .15s;
}
.dwr-fe-btn-lg { padding: 14px 32px; font-size: 16px; }
.dwr-fe-btn-primary { background: var(--w-primary); color: #fff; }
.dwr-fe-btn-primary:hover { background: var(--w-primary-dark); color: #fff; }
.dwr-fe-btn-secondary { background: #fff; color: var(--w-primary); border-color: var(--w-border); }
.dwr-fe-btn-secondary:hover { background: var(--w-bg-soft); }
.dwr-fe-btn-thaid { background: #0d6efd; color: #fff; }
.dwr-fe-btn-thaid:hover { background: #0b5ed7; color: #fff; }

.dwr-fe-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }

/* alerts */
.dwr-fe-alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.dwr-fe-alert-error { background: #fcf0f1; border: 1px solid #f5c0c0; color: #a62224; }
.dwr-fe-alert-success { background: #edfaef; border: 1px solid #b8e6c1; color: #1a7e34; }

/* success */
.dwr-fe-success { text-align: center; }
.dwr-fe-success-icon {
    width: 64px; height: 64px; line-height: 64px; margin: 0 auto 12px;
    border-radius: 50%; background: #edfaef; color: #1a7e34; font-size: 34px;
}
.dwr-fe-reqno {
    font-size: 26px; font-weight: 700; letter-spacing: 1px;
    color: var(--w-primary); background: var(--w-bg-soft);
    padding: 12px 20px; border-radius: 10px; display: inline-block; margin: 8px 0 16px;
}

/* หน้าส่งคำร้องสำเร็จ ตามดีไซน์ (WD-449) */
.dwr-fe-success-sub { color: var(--w-muted); margin: 0 0 20px; }
.dwr-fe-success-note {
    display: flex; align-items: center; gap: 14px; text-align: left;
    background: var(--w-bg-soft); border-radius: 12px;
    padding: 16px 20px; margin: 0 auto 22px; max-width: 560px;
}
.dwr-fe-success-note-icon {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border-radius: 50%;
    background: #fff; color: var(--w-primary);
}
.dwr-fe-success-note-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dwr-fe-success-note-text strong { color: var(--w-primary); font-size: 15px; }
.dwr-fe-success-note-text em { font-style: normal; color: var(--w-muted); font-size: 13px; }
.dwr-fe-success-label { margin: 0; color: var(--w-muted); font-size: 14px; }
/* เตือนให้เก็บเลขที่คำขอ — ใช้แดงชุดเดียวกับดอกจันช่องบังคับกรอก (WD-498) */
.dwr-fe-success-hint { margin: 0 0 20px; color: #d63638; font-size: 13px; font-weight: 500; }
.dwr-fe-success-actions {
    display: flex; justify-content: center; flex-wrap: wrap; gap: 12px;
}
.dwr-fe-success-actions .dwr-app-btn {
    display: inline-flex; align-items: center; gap: 8px;
}
@media (max-width: 560px) {
    .dwr-fe-success-actions { flex-direction: column; }
    .dwr-fe-success-actions .dwr-app-btn { width: 100%; justify-content: center; }
}

/* tracking */
.dwr-fe-track-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.dwr-fe-track-reqno { font-size: 20px; font-weight: 700; color: var(--w-primary); }
.dwr-fe-muted { color: var(--w-muted); font-size: 13px; }

.dwr-fe-info { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.dwr-fe-info th, .dwr-fe-info td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--w-bg-soft); vertical-align: top; }
.dwr-fe-info th { width: 38%; color: var(--w-muted); font-weight: 600; }

/* badges */
.dwr-fe-badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.dwr-fe-badge-primary { background: #e7f1fb; color: #1a5276; }
.dwr-fe-badge-purple  { background: #f3e8ff; color: #6b21a8; }
.dwr-fe-badge-warning { background: #fffbea; color: #92660a; }
.dwr-fe-badge-success { background: #edfaef; color: #1a7e34; }
.dwr-fe-badge-danger  { background: #fcf0f1; color: #a62224; }
.dwr-fe-badge-neutral { background: #eef0f2; color: #50575e; }

/* ═══════════════════════════════════════════════
   Landing / เข้าสู่ระบบ (ThaID)
   ═══════════════════════════════════════════════ */
/* ส่วนเต็มความกว้าง พื้นสะอาด (เบรกออกจาก container ของธีม + ทับพื้นใต้น้ำ) */
.dwr-landing-screen {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    background: #eef3f8;
    padding: 52px 16px 72px;
    box-sizing: border-box;
}
.dwr-fe-landing { max-width: 1080px; padding: 0; }

.dwr-landing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #fff;
    border: 1px solid var(--w-border);
    border-radius: 18px;
    box-shadow: 0 10px 40px rgba(15, 42, 71, .10);
    overflow: hidden;
}
@media (max-width: 880px) { .dwr-landing-grid { grid-template-columns: 1fr; } }

/* ── ซ้าย: การ์ดน้ำเงินเข้ม ── */
.dwr-landing-intro {
    background: linear-gradient(160deg, #163a63 0%, #0e2746 100%);
    color: #fff;
    padding: 48px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}
.dwr-landing-intro::after {
    content: "";
    position: absolute;
    right: -60px; top: -60px;
    width: 220px; height: 220px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .04);
}
.dwr-landing-emblem {
    width: 104px; height: 104px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .10);
    border: 1px solid rgba(255, 255, 255, .18);
    display: flex; align-items: center; justify-content: center;
    color: #cfe0f3;
    margin-bottom: 22px;
}
.dwr-landing-emblem img { width: 72px; height: 72px; object-fit: contain; }
/* เมื่อมีโลโก้จริง: แสดงตราตรง ๆ ไม่มีวงกลมครอบ (ตามดีไซน์) */
.dwr-landing-emblem.has-logo {
    width: auto; height: auto;
    background: none; border: none; border-radius: 0;
    margin-bottom: 18px;
}
.dwr-landing-emblem.has-logo img {
    width: auto; height: 120px; max-width: 150px;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .28));
}
.dwr-landing-intro-title { color: #fff; font-size: 21px; line-height: 1.45; margin: 0 0 14px; font-weight: 700; }
.dwr-landing-divider {
    display: block;
    width: 54px; height: 1px;
    background: rgba(255, 255, 255, .28);
    margin: 0 auto 14px;
}
.dwr-landing-intro-sub { color: rgba(255, 255, 255, .72); margin: 0 0 30px; font-size: 15px; }

.dwr-landing-features { list-style: none; margin: 8px 0 0; padding: 0; width: 100%; text-align: left; }
.dwr-landing-features li { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.dwr-landing-check {
    flex: 0 0 auto;
    width: 26px; height: 26px; border-radius: 50%;
    background: rgba(78, 160, 230, .22);
    color: #7cc0f5;
    display: flex; align-items: center; justify-content: center;
    margin-top: 2px;
}
.dwr-landing-feature-text { display: flex; flex-direction: column; gap: 2px; }
.dwr-landing-feature-text strong { font-size: 15px; font-weight: 600; color: #fff; }
.dwr-landing-feature-text span { font-size: 13px; color: rgba(255, 255, 255, .66); }

/* ── ขวา: เข้าสู่ระบบ ── */
.dwr-landing-login {
    padding: 56px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}
.dwr-landing-login-title { font-size: 28px; font-weight: 700; color: var(--w-text); margin: 0 0 6px; }
.dwr-landing-login-sub { color: var(--w-muted); margin: 0 0 28px; font-size: 15px; }

.dwr-landing-note {
    display: flex; align-items: flex-start; gap: 12px; text-align: left;
    background: #eef5fc;
    border: 1px solid #d6e6f6;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 22px;
}
.dwr-landing-note-icon { flex: 0 0 auto; color: #2f72c4; margin-top: 1px; }
.dwr-landing-note-text { display: flex; flex-direction: column; gap: 3px; }
.dwr-landing-note-text strong { font-size: 14px; font-weight: 600; color: #1c3b5e; }
.dwr-landing-note-text span { font-size: 13px; color: #4a6a8e; }

.dwr-landing-thaid-btn {
    display: flex; align-items: center; gap: 14px;
    background: linear-gradient(135deg, #14223f 0%, #1d3461 100%);
    color: #fff;
    border-radius: 12px;
    padding: 16px 20px;
    text-decoration: none;
    box-shadow: 0 8px 22px rgba(20, 34, 63, .28);
    transition: transform .15s, box-shadow .15s;
}
.dwr-landing-thaid-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(20, 34, 63, .36); color: #fff; }
.dwr-landing-thaid-logo {
    flex: 0 0 auto;
    background: #fff; color: #14223f;
    font-weight: 800; font-size: 14px; letter-spacing: .3px;
    padding: 8px 12px; border-radius: 8px;
}
/* โลโก้ ThaID ตัวจริง (WD-424) — วงกลม พื้นขาวรองไว้ให้เห็นชัดบนปุ่มสีกรมท่า */
.dwr-landing-thaid-logo-img {
    flex: 0 0 auto;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #fff;
    object-fit: contain;
    display: block;
}
.dwr-landing-thaid-label { flex: 1 1 auto; text-align: center; font-size: 16px; font-weight: 600; }
.dwr-landing-arrow { flex: 0 0 auto; font-size: 18px; opacity: .85; }

.dwr-landing-howto-title { color: var(--w-muted); font-size: 14px; margin: 28px 0 12px; }

/* ทางเข้าโดยไม่ต้อง login (WD-291) */
.dwr-landing-or {
    display: flex; align-items: center; gap: 14px;
    color: var(--w-muted); font-size: 13px; margin: 18px 0 14px;
}
.dwr-landing-or::before, .dwr-landing-or::after {
    content: ""; flex: 1 1 auto; border-top: 1px solid #e1ebf6;
}
.dwr-landing-quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* จอแคบ: เรียงลงเป็นแถวเดียว จะได้ไม่เบียดจนข้อความตกบรรทัด */
@media (max-width: 700px) { .dwr-landing-quick-grid { grid-template-columns: 1fr; } }
.dwr-landing-quick {
    display: flex; align-items: center; gap: 10px;
    border-radius: 10px; padding: 12px 14px;
    text-decoration: none; color: #fff;
    transition: filter .15s, transform .15s;
}
.dwr-landing-quick:hover { color: #fff; filter: brightness(1.08); transform: translateY(-1px); }
.dwr-landing-quick.is-blue { background: #2154bd; }
.dwr-landing-quick.is-green { background: #22a052; }
.dwr-landing-quick-icon {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 8px; background: rgba(255, 255, 255, .16);
}
.dwr-landing-quick-icon svg { width: 18px; height: 18px; }
.dwr-landing-quick-text { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
/* หัวเรื่องต้องอยู่บรรทัดเดียวตาม design — กันเบราว์เซอร์ตัดคำไทยกลางวลี */
.dwr-landing-quick-text strong { font-size: 13px; font-weight: 700; line-height: 1.3; white-space: nowrap; }
.dwr-landing-quick-text span {
    font-size: 11px; opacity: .85; line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dwr-landing-quick .dwr-landing-arrow { color: #fff; flex: 0 0 auto; }

/* ปุ่มใช้พิกัดปัจจุบัน — outline เล็กตาม design (WD-292) */
.dwr-geo-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: #f4f8fd; color: #2f72c4;
    border: 1px solid #bfd7f0; border-radius: 20px;
    padding: 8px 18px; font-size: 13.5px; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: background .15s, border-color .15s;
}
.dwr-geo-btn:hover { background: #eaf2fb; border-color: #9fc2e8; }
.dwr-geo-btn[disabled] { opacity: .6; cursor: default; }

/* การ์ดกรอกเลขบัตรก่อนติดตามสถานะ (WD-291 — guest gate) */
.dwr-track-gate {
    background: #fff; border-radius: 14px; padding: 28px 30px;
    box-shadow: 0 2px 10px rgba(16, 42, 90, .06);
}
.dwr-track-gate-label { font-weight: 700; color: var(--w-text, #1d2939); margin: 0 0 4px; }
.dwr-track-gate-hint { color: var(--w-muted, #6b7280); font-size: 13px; margin: 0 0 12px; }
.dwr-track-gate-row { display: flex; gap: 12px; flex-wrap: wrap; }
.dwr-track-gate-row input {
    flex: 1 1 320px; padding: 12px 16px; border: 1px solid #d8dee6; border-radius: 9px;
    font-size: 14px; font-family: inherit; background: #f8fafc; box-sizing: border-box;
}
.dwr-track-gate-btn {
    background: #1d3461; color: #fff; border: 0; border-radius: 9px;
    padding: 12px 60px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.dwr-track-gate-btn:hover { background: #16285a; }
.dwr-track-gate-captcha { display: flex; justify-content: center; margin-top: 20px; }

.dwr-landing-manual {
    display: flex; align-items: center; gap: 14px;
    background: #f4f8fd;
    border: 1px solid #e1ebf6;
    border-radius: 12px;
    padding: 16px 20px;
    text-decoration: none;
    color: var(--w-text);
    transition: background .15s, border-color .15s;
}
.dwr-landing-manual:hover { background: #eaf2fb; border-color: #cfe0f3; color: var(--w-text); }
.dwr-landing-manual-icon { flex: 0 0 auto; color: #2f72c4; }
.dwr-landing-manual-label { flex: 1 1 auto; text-align: center; font-size: 15px; font-weight: 600; }

@media (max-width: 880px) {
    .dwr-landing-login { padding: 40px 28px; }
    .dwr-landing-intro { padding: 40px 28px; }
}

/* ═══════════════════════════════════════════════
   App form (แจ้งขอโครงการ) — ดีไซน์ใหม่
   ═══════════════════════════════════════════════ */
.dwr-fe-app { max-width: 1180px; }

.dwr-app-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .06);
}

/* tabs */
.dwr-app-tabs { display: grid; grid-template-columns: 1fr 1fr; }
.dwr-app-tab {
    font-family: inherit;
    text-align: center;
    padding: 14px 10px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s;
}
.dwr-app-tab.is-active { background: #14223f; color: #fff; }
.dwr-app-tab:not(.is-active) { background: #dbe9f7; color: #1d3461; }
.dwr-app-tab:not(.is-active):hover { background: #cfe0f3; }

.dwr-app-body { padding: 28px 30px 32px; }

/* heading */
.dwr-form-heading {
    font-size: 16px; font-weight: 700; color: #14223f;
    margin: 0 0 20px; display: flex; align-items: center; gap: 8px;
}
.dwr-info-dot {
    display: inline-flex; align-items: center; justify-content: center;
    width: 17px; height: 17px; border-radius: 50%;
    background: #9ca3af; color: #fff; font-size: 11px; font-style: italic; font-weight: 700;
}
.dwr-fe-muted { color: #9ca3af; font-weight: 400; font-size: 12px; }

/* grid */
.dwr-fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 22px; }
.dwr-fgrid-4 { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.dwr-col-full { grid-column: 1 / -1; }
.dwr-fsep { grid-column: 1 / -1; border-top: 1px solid #e3eaf2; margin: 8px 0 2px; }
@media (max-width: 720px) {
    .dwr-fgrid { grid-template-columns: 1fr; }
    .dwr-fgrid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 460px) { .dwr-fgrid-4 { grid-template-columns: 1fr; } }

/* fields */
.dwr-ffield { display: flex; flex-direction: column; }
.dwr-ffield label { font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.dwr-fe-app input[type="text"],
.dwr-fe-app input[type="email"],
.dwr-fe-app select,
.dwr-fe-app textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid #d8dee6;
    border-radius: 9px;
    font-size: 14px;
    font-family: inherit;
    background: #fbfcfd;
    color: #1f2937;
    box-sizing: border-box;
}
.dwr-fe-app textarea { resize: vertical; min-height: 120px; }
.dwr-fe-app input:focus,
.dwr-fe-app select:focus,
.dwr-fe-app textarea:focus {
    outline: none; border-color: #2f72c4; box-shadow: 0 0 0 3px rgba(47, 114, 196, .15); background: #fff;
}
.dwr-fe-app input[readonly] { background: #eef1f4; color: #4b5563; cursor: not-allowed; }
.dwr-fe-app select { appearance: auto; }

/* dropzone */
.dwr-dropzone {
    border: 1.6px dashed #c3cdd9;
    border-radius: 11px;
    background: #fbfcfd;
    padding: 26px 20px;
    text-align: center;
    transition: border-color .15s, background .15s;
}
.dwr-dropzone.is-drag { border-color: #1d3461; background: #eef4fc; }
.dwr-dropzone input[type="file"] { display: none; }
.dwr-dz-main { margin: 0; font-size: 14px; color: #4b5563; }
.dwr-dz-or { margin: 6px 0 10px; font-size: 13px; color: #9ca3af; }

/* consent */
.dwr-app-consent {
    display: flex; gap: 10px; align-items: flex-start;
    margin: 22px 0 18px; font-size: 13px; color: #374151; line-height: 1.65;
}
.dwr-app-consent input { margin-top: 3px; flex: 0 0 auto; width: 16px; height: 16px; }

/* recaptcha + actions */
.dwr-app-recaptcha { display: flex; justify-content: center; margin: 12px 0 22px; padding-top: 10px; border-top: 1px solid #f0f0f1; }
.dwr-app-actions { display: flex; gap: 14px; justify-content: center; }

/* buttons */
.dwr-app-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 30px; border-radius: 10px;
    font-size: 15px; font-weight: 600; font-family: inherit;
    cursor: pointer; border: 1px solid transparent; text-decoration: none;
    transition: background .15s, box-shadow .15s, transform .1s;
}
.dwr-app-btn-primary { background: #14223f; color: #fff; }
.dwr-app-btn-primary:hover { background: #0d1830; color: #fff; box-shadow: 0 4px 14px rgba(20, 34, 63, .28); }
.dwr-app-btn-secondary { background: #9ca3af; color: #fff; }
.dwr-app-btn-secondary:hover { background: #6b7280; color: #fff; }
.dwr-app-btn-thaid { background: #0d1b3e; color: #fff; padding: 9px 18px; font-size: 13px; }
.dwr-app-btn-thaid:hover { background: #16285a; color: #fff; }
.dwr-app-btn-file { background: #1d3461; color: #fff; padding: 9px 24px; font-size: 14px; }
.dwr-app-btn-file:hover { background: #16285a; color: #fff; }

/* ═══════════════════════════════════════════════
   Modal: ขั้นตอนการขอรับการสนับสนุน
   ═══════════════════════════════════════════════ */
.dwr-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 30, 55, .55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    z-index: 99999;
    padding: 4vh 16px;
    overflow-y: auto;
}
.dwr-modal-overlay.is-open { display: flex; align-items: flex-start; justify-content: center; }

.dwr-modal-box {
    background: #fff;
    width: 100%;
    max-width: 640px;
    margin: auto;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
    display: flex;
    flex-direction: column;
    max-height: 92vh;
    font-family: 'IBM Plex Sans Thai', 'Prompt', 'Sarabun', Tahoma, sans-serif;
    color: #1f2937;
    overflow: hidden;
    animation: dwr-modal-pop .18s ease-out;
}
@keyframes dwr-modal-pop { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.dwr-modal-head {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px 56px;
    border-bottom: 1px solid #eef0f2;
}
.dwr-modal-head h2 { margin: 0; font-size: 18px; font-weight: 700; color: #14223f; text-align: center; line-height: 1.4; }
.dwr-modal-x {
    position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
    background: transparent; border: 0; cursor: pointer;
    width: 34px; height: 34px; border-radius: 50%;
    color: #6b7280; display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
}
.dwr-modal-x:hover { background: #f0f2f5; color: #1f2937; }

.dwr-modal-content { padding: 24px 28px; overflow-y: auto; }

/* steps */
.dwr-step-badge {
    display: inline-block;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 5px 16px;
    border-radius: 999px;
    margin-bottom: 10px;
}
.dwr-step-badge-blue   { background: #1d3461; }
.dwr-step-badge-green  { background: #16a34a; }
.dwr-step-badge-orange { background: #d98324; }

.dwr-step-title { margin: 0 0 4px; font-size: 16px; font-weight: 700; color: #14223f; }
.dwr-step-sub { margin: 0 0 14px; font-size: 14px; color: #6b7280; line-height: 1.6; }

.dwr-step-bullets {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 24px;
}
.dwr-step-bullets li { position: relative; padding-left: 18px; font-size: 14px; color: #374151; }
.dwr-step-bullets li::before {
    content: ""; position: absolute; left: 0; top: 7px;
    width: 8px; height: 8px; border-radius: 50%; background: #1d3461;
}
@media (max-width: 560px) { .dwr-step-bullets { grid-template-columns: 1fr; } }

.dwr-step-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.6;
}
.dwr-step-note-icon { flex: 0 0 auto; margin-top: 1px; }
.dwr-step-note-blue  { background: #eef4fc; color: #2a4a73; }
.dwr-step-note-blue  .dwr-step-note-icon { color: #2f72c4; }
.dwr-step-note-green { background: #e9f7ee; color: #2c6b43; }
.dwr-step-note-green .dwr-step-note-icon { color: #16a34a; }

.dwr-step-connector {
    height: 26px;
    margin-left: 11px;
    border-left: 2px dotted #cbd5e1;
}

/* footer */
.dwr-modal-foot {
    padding: 16px 28px 24px;
    display: flex;
    justify-content: center;
}
.dwr-modal-back {
    background: #9ca3af;
    color: #fff;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    padding: 11px 40px;
    border-radius: 999px;
    transition: background .15s;
}
.dwr-modal-back:hover { background: #6b7280; }

/* ปุ่มคู่มือ (รองรับเป็น <button>) */
button.dwr-landing-manual { width: 100%; font-family: inherit; cursor: pointer; }

/* timeline */
.dwr-fe-timeline { list-style: none; margin: 0; padding: 0; }
.dwr-fe-timeline li { position: relative; padding: 0 0 20px 26px; }
.dwr-fe-timeline li:before {
    content: ""; position: absolute; left: 5px; top: 14px; bottom: -2px; width: 2px; background: var(--w-border);
}
.dwr-fe-timeline li:last-child:before { display: none; }
.dwr-fe-tl-dot {
    position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%;
    background: var(--w-accent); border: 2px solid #fff; box-shadow: 0 0 0 2px #e7f1fb;
}
.dwr-fe-tl-msg { font-weight: 600; }
.dwr-fe-tl-files { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 10px; }
.dwr-fe-tl-files a { font-size: 13px; color: var(--w-accent); text-decoration: none; }
.dwr-fe-tl-time { font-size: 12px; color: var(--w-muted); margin-top: 3px; }

/* ═══════════════════════════════════════════════
   App header (แถบเมนู + แถบหัวข้อ)
   ═══════════════════════════════════════════════ */
.dwr-apphead { background: #fff; }
.dwr-apphead-bar { background: #fff; border-bottom: 1px solid #eef0f2; }
.dwr-apphead-inner { max-width: 1200px; margin: 0 auto; padding: 13px 24px; display: flex; align-items: center; gap: 18px; }
.dwr-apphead-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.dwr-apphead-brand img { height: 44px; width: auto; }
.dwr-apphead-brandtext { display: flex; flex-direction: column; line-height: 1.25; }
.dwr-apphead-brandtext strong { font-size: 15px; color: #14223f; }
.dwr-apphead-brandtext small { font-size: 11px; color: #6b7280; }
.dwr-apphead-nav { display: flex; gap: 6px; margin-left: 22px; }
.dwr-apphead-nav a { font-size: 14px; font-weight: 600; color: #374151; text-decoration: none; padding: 8px 14px; border-radius: 8px; transition: background .15s, color .15s; }
.dwr-apphead-nav a:hover { background: #f1f5f9; color: #14223f; }
.dwr-apphead-nav a.is-active { color: #1d3461; background: #eaf1fb; }
.dwr-apphead-logout { margin-left: auto; background: #1d3461; color: #fff; text-decoration: none; font-size: 13px; font-weight: 600; padding: 9px 22px; border-radius: 999px; transition: background .15s; }
.dwr-apphead-logout:hover { background: #16285a; color: #fff; }
.dwr-apphead-titleband { background: linear-gradient(180deg, #14223f, #1b2f54); color: #fff; text-align: center; padding: 26px 20px; }
.dwr-apphead-titleband .dwr-apphead-inner { display: block; padding: 0 24px; }
.dwr-apphead-titleband h1 { margin: 0 0 4px; font-size: 22px; font-weight: 700; color: #fff; }
.dwr-apphead-titleband p { margin: 0; font-size: 13px; color: rgba(255, 255, 255, .8); }

/* ═══════════════════════════════════════════════
   Tracking (ติดตามสถานะ)
   ═══════════════════════════════════════════════ */
.dwr-fe-track { max-width: 1180px; }
.dwr-app-tabs-bar { border-radius: 10px; overflow: hidden; margin-bottom: 22px; box-shadow: 0 1px 4px rgba(0, 0, 0, .05); }

.dwr-track-heading { font-size: 18px; font-weight: 700; color: #14223f; margin: 0 0 16px; }

.dwr-track-filter { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.dwr-track-search { position: relative; flex: 1 1 280px; }
.dwr-track-search input { width: 100%; padding: 11px 40px 11px 14px; border: 1px solid #d8dee6; border-radius: 9px; font-size: 14px; background: #fff; font-family: inherit; box-sizing: border-box; }
.dwr-track-search-ic { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: #9ca3af; }
.dwr-track-filter select { padding: 11px 14px; border: 1px solid #d8dee6; border-radius: 9px; font-size: 14px; background: #fff; font-family: inherit; min-width: 180px; }
/* ปุ่มค้นหา + ล้างตัวกรอง — บังคับขนาดเท่ากันทั้ง <button> และ <a> */
.dwr-track-btn {
    padding: 11px 26px;
    min-width: 150px;
    line-height: 1.5;
    box-sizing: border-box;
}

.dwr-track-kpi { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 22px; }
@media (max-width: 1100px) { .dwr-track-kpi { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  { .dwr-track-kpi { grid-template-columns: repeat(2, 1fr); } }
.dwr-tkpi { background: #fff; border: 1px solid #e5e7eb; border-left: 4px solid #9ca3af; border-radius: 10px; padding: 13px 16px; }
.dwr-tkpi-top { font-size: 12px; color: #6b7280; font-weight: 500; margin-bottom: 8px; }
.dwr-tkpi-row { display: flex; align-items: baseline; justify-content: space-between; }
.dwr-tkpi-value { font-size: 23px; font-weight: 700; color: #1f2937; line-height: 1.1; }
.dwr-tkpi-pct { font-size: 13px; font-weight: 600; }
.dwr-tkpi-total { border-left-color: #2f72c4; }
.dwr-tkpi-new { border-left-color: #f0a020; } .dwr-tkpi-new .dwr-tkpi-value, .dwr-tkpi-new .dwr-tkpi-pct { color: #c97a00; }
.dwr-tkpi-ack { border-left-color: #7a4f1d; } .dwr-tkpi-ack .dwr-tkpi-value, .dwr-tkpi-ack .dwr-tkpi-pct { color: #7a4f1d; }
.dwr-tkpi-collecting { border-left-color: #7c3aed; } .dwr-tkpi-collecting .dwr-tkpi-value, .dwr-tkpi-collecting .dwr-tkpi-pct { color: #6d28d9; }
.dwr-tkpi-budget { border-left-color: #16a34a; } .dwr-tkpi-budget .dwr-tkpi-value, .dwr-tkpi-budget .dwr-tkpi-pct { color: #15803d; }
.dwr-tkpi-rejected { border-left-color: #dc2626; } .dwr-tkpi-rejected .dwr-tkpi-value, .dwr-tkpi-rejected .dwr-tkpi-pct { color: #b91c1c; }

.dwr-track-tablewrap { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; overflow: hidden; overflow-x: auto; }
.dwr-track-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dwr-track-table thead th { background: #f6f8fb; color: #475569; font-weight: 600; text-align: left; padding: 12px 14px; white-space: nowrap; border-bottom: 1px solid #e5e7eb; }
.dwr-track-table tbody td { padding: 12px 14px; border-bottom: 1px solid #f0f0f1; vertical-align: middle; color: #374151; }
.dwr-track-table tbody tr:last-child td { border-bottom: none; }
.dwr-track-table tbody tr:hover { background: #f9fbfd; }
.dwr-tt-no { font-weight: 600; color: #1d3461; white-space: nowrap; }
.dwr-status-dot { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.dwr-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dwr-tt-detail { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 30px; border-radius: 8px; background: #1d3461; color: #fff; text-decoration: none; }
.dwr-tt-detail:hover { background: #16285a; color: #fff; }
.dwr-track-foot { padding: 14px; font-size: 13px; color: #6b7280; }
.dwr-track-empty { padding: 48px 20px; text-align: center; color: #6b7280; font-size: 14px; }

/* tracking — single detail */
.dwr-track-panel { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 24px 26px; }
.dwr-track-back { display: inline-block; color: #1d3461; text-decoration: none; font-size: 14px; margin-bottom: 14px; }
.dwr-track-back:hover { text-decoration: underline; }
.dwr-track-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.dwr-track-reqno { font-size: 20px; font-weight: 700; color: #1d3461; }
.dwr-status-pill { display: inline-flex; align-items: center; gap: 7px; background: #f1f5f9; border: 1px solid #e2e8f0; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: #334155; }
.dwr-track-info { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.dwr-track-info th, .dwr-track-info td { text-align: left; padding: 8px; border-bottom: 1px solid #f0f0f1; vertical-align: top; font-size: 14px; }
.dwr-track-info th { width: 40%; color: #6b7280; font-weight: 600; }
.dwr-track-section { font-size: 15px; font-weight: 700; color: #14223f; margin: 18px 0 12px; }

@media (max-width: 720px) {
    .dwr-apphead-inner { flex-wrap: wrap; gap: 10px; }
    .dwr-apphead-nav { margin-left: 0; order: 3; width: 100%; }
    .dwr-apphead-logout { margin-left: auto; }
}

/* ═══════════════════════════════════════════════
   Tracking — รายละเอียดคำขอ (detail view)
   ═══════════════════════════════════════════════ */
.dwr-track-detailwrap { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 22px 26px 28px; }
.dwr-track-back { display: inline-block; color: #1d3461; text-decoration: none; font-size: 14px; margin-bottom: 14px; }
.dwr-track-back:hover { text-decoration: underline; }

.dwr-detail-topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.dwr-detail-reqno { font-size: 15px; color: #374151; }
.dwr-detail-reqno strong { color: #14223f; }
.dwr-detail-curstatus { font-size: 14px; color: #374151; display: flex; align-items: center; gap: 8px; }
.dwr-cur-badge { padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; }

/* แถบหัวข้อสีน้ำเงิน */
.dwr-secbar {
    background: #214e8e;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    padding: 11px 18px;
    border-radius: 8px;
    margin: 22px 0 16px;
}

/* grid ข้อมูลผู้ยื่น */
.dwr-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 40px; padding: 0 4px; }
@media (max-width: 640px) { .dwr-detail-grid { grid-template-columns: 1fr; gap: 14px; } }
.dwr-dinfo { display: flex; flex-direction: column; gap: 3px; }
.dwr-dinfo span { font-size: 12px; color: #9ca3af; }
.dwr-dinfo strong { font-size: 14px; color: #1f2937; font-weight: 600; word-break: break-word; }

.dwr-detail-text { font-size: 14px; line-height: 1.8; color: #374151; padding: 0 4px; white-space: pre-wrap; }
.dwr-detail-files-label { font-size: 13px; color: #6b7280; margin: 16px 0 8px; padding: 0 4px; }
.dwr-detail-files { display: flex; flex-wrap: wrap; gap: 10px; padding: 0 4px; }
.dwr-file-chip {
    display: inline-flex; align-items: center; gap: 7px;
    background: #fff; border: 1px solid #d8dee6; border-radius: 8px;
    padding: 9px 14px; font-size: 13px; color: #374151; text-decoration: none;
}
.dwr-file-chip:hover { border-color: #214e8e; color: #214e8e; background: #f4f8fd; }
.dwr-file-chip svg { color: #6b7280; }
.dwr-file-chip:hover svg { color: #214e8e; }

/* กล่องการดำเนินงาน */
.dwr-work-box { border: 1px solid #eef0f2; border-radius: 12px; padding: 20px 22px; }
.dwr-work-line { font-size: 14px; color: #374151; margin-bottom: 8px; }
.dwr-work-line span { color: #1d3461; font-weight: 600; }
.dwr-work-empty {
    border: 1.5px dashed #d8dee6; border-radius: 10px;
    background: #fafbfc; color: #9ca3af; text-align: center;
    padding: 26px 16px; font-size: 13px; margin: 12px 0 4px;
}

/* ผู้รับผิดชอบปัจจุบัน — กล่อง 2 คอลัมน์ตาม design (Figma 8108-6585) */
.dwr-assignee-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 14px 24px; margin: 4px 0 18px;
}
.dwr-assignee-field { display: flex; flex-direction: column; gap: 6px; }
.dwr-assignee-field span { font-size: 12.5px; color: #6b7280; }
.dwr-assignee-field strong {
    font-size: 14px; color: #1f2937; font-weight: 500;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
    padding: 10px 14px; word-break: break-word;
}
.dwr-assignee-field--full { grid-column: 1 / -1; }
@media (max-width: 640px) {
    .dwr-assignee-grid { grid-template-columns: 1fr; }
}
.dwr-work-title { font-size: 15px; font-weight: 700; color: #14223f; margin: 22px 0 16px; }

/* timeline (ปรับให้เข้ากับ detail) */
.dwr-work-timeline .dwr-work-tl-head { display: flex; align-items: center; gap: 10px; }
.dwr-work-tl-title { font-weight: 600; color: #1f2937; font-size: 14px; }
.dwr-cur-mini { background: #fff1d6; color: #b9740a; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.dwr-work-tl-msg {
    background: #eef4fc; color: #2a4a73; font-size: 13px; line-height: 1.6;
    padding: 10px 14px; border-radius: 8px; margin-top: 8px;
}
.dwr-tl-faint .dwr-dot-faint { background: #d1d5db !important; box-shadow: 0 0 0 3px #e5e7eb !important; }
.dwr-muted2 { color: #b3b9c2; font-size: 13px; }

/* timeline: รายการที่ผ่านมาแล้ว — กล่องรายละเอียดเป็นสีเทา (สีคงเฉพาะสถานะล่าสุด) */
.dwr-fe-tl--past .dwr-work-tl-msg { background: #f0f1f3; color: #4b5563; }
