/* 3dp.thaimaas.com — ธีมสว่าง · เมนูซ้ายสีน้ำเงินเข้ม · Bootstrap 5.3 + ส่วนเสริมนี้ */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #0d9488;          /* teal */
  --accent-dark: #0f766e;
  --accent-soft: rgba(13, 148, 136, .1);
  --sb-bg: #0f172a;
  --sb-text: rgba(255, 255, 255, .62);
  --sb-hover: rgba(255, 255, 255, .07);
  --sb-active-bg: rgba(45, 212, 191, .16);
  --sb-active: #5eead4;
  --sb-w: 264px;
  --bs-body-font-family: 'Noto Sans Thai', 'Sarabun', system-ui, sans-serif;
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--ink);
  --bs-link-color: var(--accent-dark);
  --bs-link-hover-color: var(--accent);
}
body { background: var(--bg); color: var(--ink); font-family: var(--bs-body-font-family); }
a { text-decoration: none; }
.btn-accent { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-color: #fff; --bs-btn-hover-bg: var(--accent-dark); --bs-btn-hover-border-color: var(--accent-dark); --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--accent-dark); --bs-btn-active-border-color: var(--accent-dark); --bs-btn-active-color: #fff; --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent); }
.btn-outline-accent { --bs-btn-color: var(--accent-dark); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent); --bs-btn-hover-border-color: var(--accent); --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--accent-dark); --bs-btn-active-color: #fff; }
.text-accent { color: var(--accent-dark) !important; }
.card { border-color: var(--line); border-radius: 14px; }
.card-header { background: transparent; border-bottom-color: var(--line); font-weight: 600; }
.form-label { font-weight: 500; font-size: .9rem; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 .2rem var(--accent-soft); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.table > :not(caption) > * > * { padding: .7rem .85rem; }
.table thead th { font-size: .78rem; text-transform: none; color: var(--muted); font-weight: 600; border-bottom-color: var(--line); background: #f8fafc; white-space: nowrap; }
.table-hover tbody tr[data-href] { cursor: pointer; }
.badge { font-weight: 500; }

/* ─── โครงหลังล็อกอิน: เมนูซ้าย + เนื้อหา ─────────────────────────────────────────────── */
.app-sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sb-w); background: var(--sb-bg); color: var(--sb-text); display: flex; flex-direction: column; z-index: 1040; transition: transform .2s ease; }
.sb-brand { display: flex; align-items: center; gap: .65rem; padding: 1.1rem 1.15rem; color: #fff; font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.sb-brand .logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #14b8a6, #0ea5e9); display: grid; place-items: center; font-size: 1.1rem; color: #fff; }
.sb-brand small { display: block; font-weight: 400; font-size: .7rem; color: var(--sb-text); letter-spacing: 0; }
.sb-scroll { flex: 1; overflow-y: auto; padding: .8rem .7rem; }
.sb-group { font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .34); padding: .9rem .6rem .35rem; }
.sb-link { display: flex; align-items: center; gap: .75rem; padding: .62rem .8rem; border-radius: 10px; color: var(--sb-text); font-size: .93rem; margin-bottom: 2px; }
.sb-link i { font-size: 1.1rem; width: 1.25rem; text-align: center; }
.sb-link:hover { background: var(--sb-hover); color: #fff; }
.sb-link.active { background: var(--sb-active-bg); color: var(--sb-active); font-weight: 600; }
.sb-link .badge { margin-left: auto; }
.sb-user { border-top: 1px solid rgba(255, 255, 255, .07); padding: .85rem 1rem; display: flex; align-items: center; gap: .65rem; }
.sb-user img, .sb-user .ph { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: rgba(255, 255, 255, .12); display: grid; place-items: center; color: #fff; }
.sb-user .nm { color: #fff; font-size: .86rem; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
.sb-user .rl { font-size: .72rem; color: var(--sb-text); }
.sb-user form { margin-left: auto; }
.sb-user button { background: none; border: 0; color: var(--sb-text); font-size: 1.15rem; padding: .3rem; border-radius: 8px; }
.sb-user button:hover { background: var(--sb-hover); color: #fff; }
.app-main { margin-left: var(--sb-w); min-height: 100vh; }
.app-topbar { display: none; position: sticky; top: 0; z-index: 1030; background: var(--sb-bg); color: #fff; align-items: center; gap: .75rem; padding: .6rem .9rem; }
.app-topbar button { background: none; border: 0; color: #fff; font-size: 1.6rem; line-height: 1; padding: 0 .2rem; }
.app-content { padding: 1.6rem 1.8rem 3rem; max-width: 1180px; }
.sb-backdrop { display: none; }
@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); }
  body.sb-open .app-sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  body.sb-open .sb-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 1035; }
  .app-main { margin-left: 0; }
  .app-topbar { display: flex; }
  .app-content { padding: 1.1rem 1rem 2.5rem; }
}

/* ─── หัวหน้า / การ์ดสถิติ / แถบขั้นตอน ──────────────────────────────────────────────── */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.45rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); font-size: .9rem; }
.stat { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.15rem; color: inherit; height: 100%; }
a.stat:hover { border-color: var(--accent); box-shadow: 0 4px 18px rgba(13, 148, 136, .1); }
.stat .lbl { color: var(--muted); font-size: .82rem; }
.stat .val { font-size: 1.7rem; font-weight: 700; line-height: 1.15; margin-top: .15rem; }
.stat .val.sm { font-size: 1.35rem; }
.stat.alert-stat { border-color: #fbbf24; background: #fffbeb; }
.status-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.status-tabs a { padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--muted); font-size: .85rem; }
.status-tabs a:hover { border-color: var(--accent); color: var(--accent-dark); }
.status-tabs a.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.status-tabs a .n { opacity: .75; margin-left: .25rem; font-size: .78rem; }
.steps { display: flex; gap: .25rem; margin: .4rem 0 1.2rem; }
.steps .st { flex: 1; text-align: center; font-size: .72rem; color: var(--muted); position: relative; padding-top: 1.55rem; }
.steps .st::before { content: ''; position: absolute; top: .45rem; left: 0; right: 0; height: 4px; background: var(--line); border-radius: 4px; }
.steps .st::after { content: ''; position: absolute; top: 0; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #fff; border: 3px solid var(--line); }
.steps .st.done::before { background: var(--accent); }
.steps .st.done::after { background: var(--accent); border-color: var(--accent); }
.steps .st.now { color: var(--accent-dark); font-weight: 700; }
.steps .st.now::after { border-color: var(--accent); }
.kv { display: grid; grid-template-columns: 9.5rem 1fr; gap: .45rem 1rem; margin: 0; font-size: .93rem; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; word-break: break-word; }
@media (max-width: 575.98px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dt { margin-top: .5rem; font-size: .8rem; } }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 .9rem 1.4rem; border-left: 2px solid var(--line); margin-left: .4rem; font-size: .88rem; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: .2rem; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline .t { color: var(--muted); font-size: .78rem; }
.file-row { display: flex; align-items: center; gap: .65rem; padding: .55rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-bottom: .45rem; }
.file-row i { font-size: 1.3rem; color: var(--accent-dark); }
.file-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.dropzone { border: 2px dashed #cbd5e1; border-radius: 14px; padding: 1.6rem 1rem; text-align: center; background: #fff; color: var(--muted); cursor: pointer; transition: .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); }
.dropzone i { font-size: 2rem; display: block; }
.sel-files { list-style: none; padding: 0; margin: .6rem 0 0; font-size: .85rem; }
.sel-files li { display: flex; justify-content: space-between; gap: .75rem; padding: .3rem .1rem; border-bottom: 1px dashed var(--line); }
.empty { text-align: center; color: var(--muted); padding: 2.6rem 1rem; }
.empty i { font-size: 2.4rem; display: block; opacity: .5; }
.money-input { max-width: 11rem; }

/* ─── หน้าสาธารณะ (แลนดิ้ง / ล็อกอิน) ──────────────────────────────────────────────── */
.pub-nav { background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1030; }
.pub-nav .brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--ink); }
.pub-nav .brand .logo { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, #14b8a6, #0ea5e9); display: grid; place-items: center; color: #fff; }
.pub-nav .nav-link { color: var(--muted); font-size: .93rem; }
.pub-nav .nav-link:hover { color: var(--accent-dark); }
.hero { position: relative; overflow: hidden; background: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 45%, #eff6ff 100%); }
.hero .container { position: relative; z-index: 1; }
.hero h1 { font-weight: 800; letter-spacing: -.02em; line-height: 1.2; font-size: clamp(1.9rem, 4.2vw, 3rem); }
.hero .lead { color: #475569; font-size: 1.1rem; }
.hero-img { width: 100%; border-radius: 22px; box-shadow: 0 24px 60px rgba(15, 118, 110, .18); aspect-ratio: 4 / 3; object-fit: cover; background: linear-gradient(135deg, #ccfbf1, #dbeafe); }
.section { padding: 3.6rem 0; }
.section h2 { font-weight: 700; letter-spacing: -.01em; }
.step-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.4rem; height: 100%; }
.step-card .no { width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-dark); display: grid; place-items: center; font-weight: 700; margin-bottom: .8rem; }
.mat-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.25rem; height: 100%; }
.mat-card .price { color: var(--accent-dark); font-weight: 700; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--accent); margin-right: .3rem; }
.pub-foot { border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: .88rem; padding: 1.6rem 0; }
.login-wrap { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 2rem 0; }
.login-card { max-width: 420px; width: 100%; border-radius: 20px; box-shadow: 0 20px 50px rgba(15, 23, 42, .08); }
.btn-google { display: flex; align-items: center; justify-content: center; gap: .6rem; background: #fff; border: 1px solid #cbd5e1; color: #0f172a; font-weight: 600; padding: .75rem 1rem; border-radius: 12px; }
.btn-google:hover { background: #f8fafc; border-color: #94a3b8; color: #0f172a; }
.prose { max-width: 760px; }
.prose h2 { font-size: 1.15rem; margin-top: 1.8rem; font-weight: 700; }

/* ─── โหมดแอดมิน (หลังบ้านเจ้าของ) — ต้องแยกจากหน้าลูกค้าให้เห็นชัดทันที (ผู้ใช้สั่ง 2026-10-05) ──────────────
 * body.is-admin ตั้งใน views/partials/app_top.ejs เมื่อเป็นเจ้าของและอยู่ใต้ /admin · เมนูซ้ายโทนม่วงเข้ม + ป้าย ADMIN สีเหลือง + แถบสถานะบนเนื้อหา + ชื่อแท็บขึ้นต้น "Admin ·" */
body.is-admin { --sb-bg: #1e1b4b; --sb-active-bg: rgba(251, 191, 36, .16); --sb-active: #fbbf24; }
body.is-admin .app-sidebar { box-shadow: inset -3px 0 0 #fbbf24; }
.admin-badge { display: inline-block; background: #fbbf24; color: #1e1b4b; font-size: .62rem; font-weight: 800; letter-spacing: .12em; line-height: 1; padding: .2rem .45rem; border-radius: 6px; margin-left: .45rem; vertical-align: .12em; }
.admin-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 10px; padding: .45rem .85rem; font-size: .84rem; margin-bottom: 1.1rem; }
.admin-bar strong { background: #fbbf24; color: #1e1b4b; padding: .12rem .5rem; border-radius: 6px; letter-spacing: .1em; font-size: .72rem; font-weight: 800; }

/* ─── ตราชื่อแบรนด์บนหน้าแรก: THAILAND / Manufacturing as a Service — แผ่นป้ายโลหะ (ผู้ใช้เลือกแบบ Saira 2026-10-05) ──
 * พื้นกรมเข้ม + THAILAND สีเขียวเทอร์ควอยซ์ + ชื่อสีเงินไล่เฉดเหล็ก (ขาว→เทาเหล็ก) · วางบนหน้าแรกพื้นสว่างเดิมได้โดยไม่ต้องรื้อสีส่วนอื่น
 * ฟอนต์อังกฤษเฉพาะบล็อกนี้ Saira (ไม่มีอักษรไทย — ภาษาไทยทั้งเว็บยังเป็น Noto Sans Thai) เปลี่ยนที่ตัวแปร --maas-font + ลิงก์ Google Fonts ใน head.ejs */
:root { --maas-font: 'Saira', 'Noto Sans Thai', system-ui, sans-serif; }
.maas-mark { font-family: var(--maas-font); display: inline-block; position: relative; background: linear-gradient(160deg, #162033 0%, #0f172a 60%, #0b1220 100%); border: 1px solid rgba(148, 163, 184, .28); border-radius: 14px; padding: 1rem 1.4rem 1.1rem; box-shadow: 0 10px 28px rgba(15, 23, 42, .22), inset 0 1px 0 rgba(255, 255, 255, .12); }
.maas-mark::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 2px; border-radius: 14px 14px 0 0; background: linear-gradient(90deg, transparent, #94a3b8 30%, #e2e8f0 50%, #94a3b8 70%, transparent); opacity: .7; }
.maas-country { display: flex; align-items: center; gap: .8rem; font-size: .82rem; font-weight: 700; letter-spacing: .5em; color: #2dd4bf; margin-bottom: .4rem; }
.maas-rule { display: inline-block; width: 2.4rem; height: 2px; background: linear-gradient(90deg, #2dd4bf, #38bdf8); border-radius: 2px; }
.maas-title { font-size: clamp(1.8rem, 3.6vw, 2.6rem); font-weight: 700; line-height: 1.06; letter-spacing: .005em; background: linear-gradient(180deg, #f8fafc 0%, #cbd5e1 48%, #7b8aa0 100%); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
@media (max-width: 575.98px) { .maas-mark { padding: .85rem 1.05rem .95rem; } .maas-country { letter-spacing: .36em; font-size: .72rem; } }
/* ─── ตัวเลือกภาษาแบบดรอปดาวน์ (partials/lang_switch.ejs) — 2 ภาษา ผู้ใช้สั่ง 2026-10-05 ───────────────────────── */
.lang-switch .lang-btn { display: inline-flex; align-items: center; gap: .4rem; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .34rem .8rem; font-size: .84rem; font-weight: 600; color: var(--ink); line-height: 1.2; }
.lang-switch .lang-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.lang-switch .lang-btn::after { margin-left: .15rem; }
.lang-switch .dropdown-menu { min-width: 8rem; font-size: .88rem; }
.lang-switch .dropdown-item.active, .lang-switch .dropdown-item:active { background: var(--accent); color: #fff; }
.app-topbar .lang-switch { margin-left: auto; }
.app-topbar .lang-switch .lang-btn { background: transparent; border-color: rgba(255, 255, 255, .25); color: #fff; }
.sb-lang { padding: .6rem 1rem 0; }
.sb-lang .lang-switch { display: block; }
.sb-lang .lang-btn { width: 100%; justify-content: flex-start; background: transparent; border-color: rgba(255, 255, 255, .2); color: var(--sb-text); border-radius: 10px; }
.sb-lang .lang-btn:hover { color: #fff; background: var(--sb-hover); border-color: rgba(255, 255, 255, .3); }
.sb-lang .lang-btn::after { margin-left: auto; }
.sb-lang .dropdown-menu { width: 100%; }

body.is-admin .app-content, .app-content.wide { max-width: none; } /* หลังบ้านกว้างเต็มพื้นที่ (ผู้ใช้สั่ง 2026-10-05) · หน้าลูกค้าคงความกว้างสูงสุด 1180px เว้นแต่ส่ง wide: true */ /* หน้าที่ต้องกว้างเต็มพื้นที่ (เช่นดูเอกสาร) — ส่ง wide: true ตอน render */
/* ─── เมนู "ข้อมูล" (/admin/docs): กรอบแสดงเอกสาร HTML ในตัว — สูงเกือบเต็มจอ ─── */
.doc-frame { display: block; width: 100%; height: calc(100vh - 190px); min-height: 480px; border: 1px solid var(--line); border-radius: 12px; background: #0b0d12; }

/* ─── เมนูผู้ใช้บนแถบบนหน้าสาธารณะ (partials/user_menu.ejs): รูป+ชื่อ → ไปหน้าของฉัน / ออกจากระบบ ─── */
.user-menu .user-btn { display: inline-flex; align-items: center; gap: .5rem; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .2rem .8rem .2rem .25rem; font-size: .84rem; font-weight: 600; color: var(--ink); line-height: 1.2; max-width: 14rem; }
.user-menu .user-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.user-menu .user-btn .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu .user-btn img, .user-menu .user-btn .ph { width: 26px; height: 26px; border-radius: 50%; flex: none; }
.user-menu .user-btn .ph { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-dark); font-size: .95rem; }
.user-menu .dropdown-menu { min-width: 13rem; font-size: .88rem; }
.user-menu .dropdown-header { white-space: normal; word-break: break-all; }
.user-menu .dropdown-item.logout { width: 100%; text-align: left; background: none; border: 0; }
