/* ==========================================================
   TECH ION SUPPORT - หน้าแจ้งปัญหา
   style.css : mobile first
   ธีมเดียวกับ docs-portal / เว็บบริษัท: ฟอนต์ Prompt · น้ำเงิน #155FD5 · ฟ้า #00C8F5 · กรมท่า #0A193A · พื้น #F7F9FC
   ฟอนต์อยู่ใน assets/fonts/ (SIL Open Font License) ไม่โหลดจาก CDN
========================================================== */

:root {
  --ink: #172033;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f7f9fc;
  --card: #ffffff;
  --brand: #155fd5;
  --brand-hover: #1677e8;
  --brand-soft: #e8f0fd;
  --accent: #00c8f5;
  --accent-ink: #00bfbf;
  --navy: #0a193a;
  --on-navy: #b8c5d9;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --ok: #065f46;
  --ok-soft: #d1fae5;
  --radius: 12px;
}

@font-face { font-family:"Prompt"; font-style:normal; font-weight:400; font-display:swap; src:url("assets/fonts/prompt-400-thai.woff2") format("woff2"); unicode-range:U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family:"Prompt"; font-style:normal; font-weight:400; font-display:swap; src:url("assets/fonts/prompt-400-latin.woff2") format("woff2"); unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family:"Prompt"; font-style:normal; font-weight:500; font-display:swap; src:url("assets/fonts/prompt-500-thai.woff2") format("woff2"); unicode-range:U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family:"Prompt"; font-style:normal; font-weight:500; font-display:swap; src:url("assets/fonts/prompt-500-latin.woff2") format("woff2"); unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family:"Prompt"; font-style:normal; font-weight:600; font-display:swap; src:url("assets/fonts/prompt-600-thai.woff2") format("woff2"); unicode-range:U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family:"Prompt"; font-style:normal; font-weight:600; font-display:swap; src:url("assets/fonts/prompt-600-latin.woff2") format("woff2"); unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

* { box-sizing: border-box; }

/* ให้ attribute hidden ชนะ display ของ class เสมอ (JS ใช้ hidden ซ่อน/โชว์ส่วนต่างๆ) */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Prompt", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- แถบบน (เหมือน docs-portal) ---------- */
.topbar {
  background: var(--navy);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: .55rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; color: #fff; line-height: 1.1; }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; width: auto; }
.brand b { font-weight: 600; font-size: 1.15rem; letter-spacing: -.01em; }
.brand b span { color: var(--accent-ink); }
.brand small { display: block; font-size: .6rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--on-navy); margin-top: .15rem; }
.phone { color: var(--on-navy); font-size: .85rem; white-space: nowrap; }
.phone:hover { color: #fff; text-decoration: none; }

footer {
  text-align: center;
  color: var(--on-navy);
  background: var(--navy);
  font-size: .8rem;
  padding: 1.25rem 1rem;
  margin-top: auto;
}

/* ---------- โครงหน้า ---------- */
.page {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
  flex: 1;
}
.card-stack { display: flex; flex-direction: column; gap: 14px; }

.title { font-size: 1.5rem; font-weight: 600; margin: .25rem 0 0; letter-spacing: -.01em; }
.subtitle { margin: 0 0 4px; color: var(--muted); font-size: .9rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: 0 1px 2px rgba(10,25,58,.04);
}
.card-title { font-size: 1.05rem; font-weight: 600; margin: 0 0 .6rem; }
.card-label { font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }

/* ---------- ช่องกรอก ---------- */
.field { display: block; margin-bottom: .9rem; }
.field:last-child { margin-bottom: 0; }
.field-label { display: block; font-size: .95rem; margin-bottom: .25rem; font-weight: 600; }
.req { color: var(--danger); font-weight: 700; }

input[type="text"], input[type="tel"], input[type="email"], select, textarea {
  width: 100%;
  font: inherit;
  font-weight: normal;
  font-size: 16px; /* 16px ขึ้นไป iOS จะไม่ซูมเข้าเวลาแตะ */
  padding: .6rem .7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
select { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' fill='none' stroke='%2364748b' stroke-width='2'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand);
}
input.invalid, select.invalid, textarea.invalid { border-color: var(--danger); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 380px) { .two-col { grid-template-columns: 1fr; } }

.hint { font-size: .8rem; color: var(--muted); margin-top: 6px; }

/* ---------- รายการค้นหาลูกค้า ---------- */
.search-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin: -6px 0 12px;
  overflow: hidden;
}
.search-list button {
  display: block; width: 100%; text-align: left;
  font: inherit; font-size: 16px;
  padding: .7rem .75rem; border: 0; background: none; color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.search-list button:last-child { border-bottom: 0; }
.search-list button:active { background: var(--brand-soft); }
.search-list .empty { padding: .7rem .75rem; color: var(--muted); font-size: .9rem; }

.chosen {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--brand-soft); border-radius: 8px;
  padding: .6rem .75rem; margin-bottom: .9rem; font-weight: 500;
}
.link-btn { font: inherit; font-size: .9rem; color: var(--brand); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

/* ---------- การ์ดอุปกรณ์ (โหมด QR) ---------- */
.device-card { border-left: 4px solid var(--accent); }
.device-main { font-size: 1.15rem; font-weight: 600; margin-top: 4px; }
.device-sub { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.device-warn { background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: .5rem .7rem; font-size: .85rem; margin-top: 10px; }

/* ---------- รูปถ่าย ---------- */
.photo-row { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-add {
  width: 96px; height: 96px; border: 2px dashed var(--line); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--brand); font-weight: 500; font-size: .9rem; cursor: pointer;
}
.photo-thumb { position: relative; width: 96px; height: 96px; border-radius: 8px; overflow: hidden; background: var(--line); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb .remove {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%;
  border: 0; background: rgba(10,25,58,.7); color: #fff; font-size: 16px; line-height: 26px; padding: 0; cursor: pointer;
}
.photo-thumb .busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.7); font-size: .75rem; color: var(--muted); }

/* ---------- ส่ง ---------- */
.submit-area { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.turnstile { min-height: 65px; display: flex; justify-content: center; }
.btn-primary {
  font: inherit; font-size: 1.05rem; font-weight: 600;
  background: var(--brand); color: #fff; border: 1px solid var(--brand); border-radius: 8px;
  padding: .85rem 1rem; width: 100%; cursor: pointer;
}
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-primary:disabled { opacity: .6; cursor: wait; }
.btn-secondary {
  font: inherit; font-size: 1rem; font-weight: 500;
  background: #fff; color: var(--brand); border: 1px solid var(--brand); border-radius: 8px;
  padding: .7rem 1rem; width: 100%; margin-top: 12px; cursor: pointer;
}
.btn-secondary:hover { background: var(--brand-soft); }
.fineprint { font-size: .85rem; color: var(--muted); text-align: center; margin: 0; }

/* ---------- ข้อความแจ้ง ---------- */
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: .6rem .8rem; font-size: .9rem; }
.form-error { background: var(--danger-soft); color: var(--danger); border-radius: 6px; padding: .6rem .8rem; font-size: .9rem; }

/* ---------- หน้าสำเร็จ ---------- */
.success-card { text-align: center; padding: 1.75rem 1rem; }
.success-icon {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 8px;
  background: var(--ok-soft); color: var(--ok); font-size: 34px; line-height: 64px; font-weight: 700;
}
.success-ticket { font-size: 1.25rem; margin: 6px 0; }
