/* หน้าต่างเลขา AI (#/secretary) — docs/AI-SECRETARY-SPEC.md ข้อ 9 · ระบบดีไซน์ docs/VIVID-SPEC.md
 * สีทั้งหมดมาจากโทเคนใน base.css (+ theme-tones.css) จึงเปลี่ยนตามธีมทั้ง 4 แบบเอง
 * สีแดงที่ใช้ได้มีแค่ "สัญญาณ" (--badge-unread #E0243C) กับ --danger — ไม่ใช้แดงเป็นสีตกแต่ง
 * ปุ่มกดได้ทุกตัว ≥ 44px · มือถือ 390×844 เป็นหลัก */

.sec-page{display:flex;flex-direction:column;height:100dvh;min-height:0;position:relative}
.sec-top{padding-bottom:8px}
.sec-top .title{min-width:0}
.sec-set-btn.on{box-shadow:0 0 0 2px var(--accent), 0 4px 8px rgba(var(--shadow-rgb),.12)}

/* ---- แท็บ 6 อัน: แคปซูลเดียว ปุ่มเท่ากัน ที่เลือก = น้ำเงินไล่แสง (เหมือนแถบล่าง) ---- */
.sec-tabs{display:flex;gap:4px;margin:0 14px 4px;padding:4px;border-radius:18px;
  background:var(--grad-surface);border:1px solid var(--card-brd);
  box-shadow:inset 0 1px 1px var(--hi), 0 3px 8px rgba(var(--shadow-rgb),.07)}
.sec-tab{position:relative;flex:1 1 auto;min-width:0;min-height:44px;padding:0 3px;border-radius:14px;
  display:flex;align-items:center;justify-content:center;
  color:var(--ink-dim);font-size:13.5px;font-weight:600;white-space:nowrap;
  transition:background .2s, color .2s}
.sec-tab span:first-child{overflow:hidden;text-overflow:ellipsis}
.sec-tab.on{color:#fff;background:var(--grad-primary);box-shadow:var(--primary-shadow)}
.sec-tab-badge.badge{position:absolute;top:-5px;right:-2px;min-width:20px;height:20px;font-size:11px;padding:0 5px}

.sec-body{flex:1;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;
  padding:10px 14px calc(28px + env(safe-area-inset-bottom))}
.sec-skel{display:flex;flex-direction:column;gap:12px}
.sec-skel .skeleton{border-radius:var(--r-lg)}

/* ---- การ์ดพื้นฐาน ---- */
.sec-card{background:var(--surface);border:1px solid var(--card-brd);border-radius:20px;
  box-shadow:0 3px 10px rgba(var(--shadow-rgb),.07)}
.sec-list{list-style:none;padding:4px 0;overflow:hidden}
.sec-list>li+li{border-top:1px solid var(--card-brd)}
.sec-none{padding:16px;font-size:14px;color:var(--ink-dim);text-align:center}

/* ---- หัวข้อส่วน ---- */
.sec-sec{margin-top:18px}
.sec-sec-h{display:flex;align-items:center;gap:8px;margin:0 2px 8px;flex-wrap:wrap}
.sec-sec-h h2{display:flex;align-items:center;gap:7px;flex:1;min-width:0;font-size:16px;font-weight:700;color:var(--ink)}
.sec-sec-h h2 svg{width:24px;height:24px}
.sec-sec-h2 h2{flex-basis:100%}
.sec-sec-sub{font-size:12.5px;color:var(--ink-dim);margin:-4px 0 0 31px}
.sec-link{min-height:44px;padding:0 6px;color:var(--accent);font-size:13.5px;font-weight:600}
.sec-link-c{display:block;margin:4px auto 0}

/* ================= การ์ดสรุป (เด่นสุดในหน้า) =================
 * กรอบไล่สีแบบ "การ์ดผู้ช่วย" ของแอป · ตัวสรุปอยู่บนแผ่นขาว (ตัวหนังสือสีหมึก) → อ่านง่ายทุกธีม
 * ไม่วางข้อความยาวบนพื้นไล่สีโดยตรง (ชมพูของ blush กับตัวขาวคอนทราสต์ไม่พอ) */
.sec-brief{position:relative;padding:12px;border-radius:24px;background:var(--grad-feature);
  box-shadow:0 10px 24px rgba(var(--shadow-rgb),.22), inset 0 1px 1px rgba(255,255,255,.35)}
.sec-brief-head{display:flex;align-items:center;gap:10px;padding:2px 2px 10px}
.sec-brief-ico{width:40px;height:40px;flex:none;border-radius:14px;display:grid;place-items:center;
  background:rgba(255,255,255,.2);box-shadow:inset 0 0 0 1px rgba(255,255,255,.35)}
.sec-brief-ico svg{width:28px;height:28px;filter:brightness(0) invert(1)}
.sec-brief-lbl{flex:1;min-width:0;display:flex;flex-direction:column;color:#fff;line-height:1.25;
  text-shadow:0 1px 2px rgba(0,0,0,.18)}
.sec-brief-lbl b{font-size:17px;font-weight:700}
.sec-brief-lbl small{font-size:12.5px;opacity:.95;font-weight:500}
.sec-brief-btn{flex:none;display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:0 14px 0 10px;
  border-radius:var(--r-pill);background:#fff;color:var(--accent-2);font-size:14px;font-weight:700;
  box-shadow:0 3px 8px rgba(0,0,0,.16);transition:transform .2s var(--ease-spring)}
.sec-brief-btn svg{width:22px;height:22px}
.sec-brief-btn:active{transform:scale(.95)}
.sec-brief-btn.busy svg{animation:secSpin 1s linear infinite}
.sec-brief-btn:disabled{opacity:.85}
@keyframes secSpin{to{transform:rotate(360deg)}}
.sec-brief-paper{padding:14px 15px 10px;border-radius:17px;background:var(--surface);color:var(--ink);
  box-shadow:0 2px 6px rgba(0,0,0,.08)}
.sec-brief-text{font-size:15px;line-height:1.65}
.sec-brief-text.clamp{max-height:11.6em;overflow:hidden;
  -webkit-mask-image:linear-gradient(180deg,#000 72%,transparent);mask-image:linear-gradient(180deg,#000 72%,transparent)}
.sec-brief-none{font-size:14.5px;line-height:1.6;color:var(--ink-dim);padding-bottom:4px}
.sec-brief-paper .sec-link{margin-top:2px}

/* ---- markdown ที่แปลงอย่างปลอดภัย (สรุป + เอกสาร) ---- */
.sec-brief-text p,.sec-md p{margin:0 0 .6em}
.sec-brief-text ul,.sec-brief-text ol,.sec-md ul,.sec-md ol{margin:0 0 .6em;padding-left:1.35em}
.sec-brief-text li,.sec-md li{margin:.15em 0}
.sec-brief-text h3,.sec-brief-text h4,.sec-brief-text h5{font-size:15px;font-weight:700;margin:.5em 0 .3em}
.sec-brief-text>:last-child,.sec-md>:last-child{margin-bottom:0}
.sec-brief-text code,.sec-md code{font-family:ui-monospace,Consolas,monospace;font-size:.9em;padding:1px 5px;border-radius:6px;
  background:var(--surface-2);color:var(--ink)}
.sec-brief-text hr,.sec-md hr{border:0;border-top:1px solid var(--card-brd);margin:.8em 0}

/* ---- ตัวเลข 3 ช่อง ---- */
/* ---- เชื่อมต่อ Google (ระยะ 4) ---- */
.sec-g{display:flex;flex-direction:column;gap:6px;padding:12px 0;border-top:1px solid var(--card-brd)}
.sec-g:first-child{border-top:0;padding-top:6px}
.sec-g-t{font-size:14.5px;color:var(--ink)}
.sec-g-row{display:flex;flex-wrap:wrap;gap:8px;margin-top:4px}
.sec-g-btn{flex:1 1 0;width:auto;min-width:0;min-height:42px;padding:0 12px;border-radius:12px;font-size:14px}
.sec-g-link{display:flex;gap:8px}
.sec-g-link input{flex:1 1 auto;width:auto;min-width:0;font-size:12.5px}
.sec-g-link button{flex:none;width:auto;min-height:42px;padding:0 14px;border-radius:12px}
.sec-g-warn{color:#E0243C}

/* ---- กฎอัตโนมัติ (ระยะ 3) ---- */
.sec-autos{list-style:none;display:flex;flex-direction:column;gap:8px;margin:10px 0}
.sec-auto{display:flex;align-items:center;gap:8px;padding:10px 12px;border-radius:14px;background:var(--surface-2);border:1px solid var(--card-brd)}
.sec-auto.is-off{opacity:.6}
.sec-auto-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px;text-align:left;color:var(--ink)}
.sec-auto-if{font-size:13.5px;font-weight:600}
.sec-auto-then{font-size:13px;color:var(--ink-dim);overflow-wrap:anywhere}
.sec-auto-meta{font-size:11.5px;color:var(--ink-faint)}
.sec-auto-act{display:flex;flex-direction:column;align-items:flex-end;gap:6px;flex:none}
.sec-auto-act .sec-link{min-height:32px;font-size:13px}

/* ---- เลขาเสนอ (ระยะ 3) ---- */
.sec-props{margin-top:12px;padding:12px 12px 6px}
.sec-props-h{display:flex;align-items:center;gap:7px;font-size:14.5px;font-weight:700;color:var(--ink);margin-bottom:4px}
.sec-props-h svg{width:18px;height:18px;color:var(--accent)}
.sec-props-n{margin-left:auto;min-width:22px;height:22px;padding:0 6px;border-radius:11px;display:grid;place-items:center;
  font-size:12px;color:#fff;background:#E0243C}
.sec-props-list{list-style:none;display:flex;flex-direction:column}
.sec-prop{display:flex;flex-direction:column;gap:8px;padding:10px 0;border-top:1px solid var(--card-brd)}
.sec-prop:first-child{border-top:0}
.sec-prop-t{font-size:14px;line-height:1.5;color:var(--ink);overflow-wrap:anywhere}
.sec-prop-act{display:flex;gap:8px;justify-content:flex-end}
.sec-prop-act button{min-height:40px;min-width:84px;padding:0 14px;border-radius:12px;font-size:14px;font-weight:600}
.sec-prop-ok{color:#fff;background:var(--grad-primary);box-shadow:var(--primary-shadow)}
.sec-prop-no{color:var(--ink-dim);background:var(--surface-2);border:1px solid var(--card-brd)}
.sec-prop-act button:disabled{opacity:.5}
.sec-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:9px;margin-top:12px}
.sec-stat{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;min-height:74px;padding:8px 4px;
  border-radius:18px;background:var(--grad-surface);border:1px solid var(--card-brd);
  box-shadow:inset 0 1px 1px var(--hi), 0 3px 8px rgba(var(--shadow-rgb),.07);transition:transform .2s var(--ease-spring)}
.sec-stat:active{transform:scale(.96)}
.sec-stat b{font-size:26px;line-height:1.1;font-weight:700;color:var(--ink)}
.sec-stat span{font-size:12.5px;font-weight:600;color:var(--ink-dim)}
/* เลยกำหนด > 0 = แดงสัญญาณ (สีเดียวกับป้ายแจ้งเตือน) ให้เห็นทันที */
.sec-stat.is-alert{background:var(--badge-unread);border-color:var(--badge-unread);
  box-shadow:0 4px 12px rgba(var(--alert-rgb),.32)}
.sec-stat.is-alert b,.sec-stat.is-alert span{color:#fff}

/* ---- แถบสถานะ AI (3 หน้าตา) — ไม่ใช้แดง ไม่ใช่ข้อผิดพลาดของผู้ใช้ ----
 * is-ok = จุดเขียว แถบบางเดียว · is-offline = เหลืองอ่อน (ชั่วคราว) · is-basic = ฟ้าอ่อนแง่บวก (ใช้คำสั่งพื้นฐาน) */
.sec-ai{--ai-c:var(--accent);display:flex;gap:10px;align-items:flex-start;margin-bottom:12px;padding:11px 14px;border-radius:18px;
  background:var(--surface-2);background:color-mix(in srgb,var(--ai-c) 10%,var(--surface));
  border:1px solid color-mix(in srgb,var(--ai-c) 38%,var(--card-brd))}
.sec-ai.is-ok{--ai-c:var(--green);padding:8px 14px;align-items:center}
.sec-ai.is-offline{--ai-c:var(--amber)}
.sec-ai-dot{flex:none;width:11px;height:11px;margin-top:6px;border-radius:50%;background:var(--ai-c);
  box-shadow:0 0 0 4px color-mix(in srgb,var(--ai-c) 22%,transparent)}
.sec-ai.is-ok .sec-ai-dot{margin-top:0}
.sec-ai-txt{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.sec-ai-txt strong{font-size:14.5px;line-height:1.4;color:var(--ink)}
.sec-ai-txt>span{font-size:12.5px;line-height:1.5;color:var(--ink-dim)}
.sec-ai.is-ok .sec-ai-txt{flex-direction:row;flex-wrap:wrap;align-items:baseline;column-gap:8px}
.sec-ai.is-ok .sec-ai-txt strong{font-size:14px}
.sec-set-h{font-size:13px;font-weight:700;color:var(--ink-dim);margin:2px 4px 8px}
.sec-cmds-wrap summary{display:flex;align-items:center;min-height:44px;margin:2px 0 -6px;cursor:pointer;list-style:none;
  font-size:13.5px;font-weight:700;color:var(--ink);text-decoration:underline;text-underline-offset:3px}
.sec-cmds-wrap summary::-webkit-details-marker{display:none}
.sec-cmds-wrap summary::after{content:'▾';margin-left:6px;font-size:12px}
.sec-cmds-wrap[open] summary::after{content:'▴'}
.sec-cmds{list-style:none;display:flex;flex-wrap:wrap;gap:6px;margin-top:7px}
.sec-cmd{min-height:38px;padding:6px 11px;border-radius:12px;background:var(--surface);border:1px dashed color-mix(in srgb,var(--ai-c,var(--accent)) 60%,var(--card-brd));
  font-family:ui-monospace,Consolas,'Anuphan',monospace;font-size:13px;color:var(--ink);text-align:left}
.sec-cmd:active{transform:scale(.97)}

/* ---- แถวนัด ---- */
.sec-ev{display:flex;align-items:center;gap:12px;width:100%;min-height:60px;padding:10px 14px;text-align:left;color:var(--ink)}
.sec-ev:active{background:var(--accent-soft)}
.sec-ev-time{flex:none;min-width:54px;display:flex;flex-direction:column;align-items:flex-start;line-height:1.2;
  padding-right:11px;border-right:3px solid var(--accent)}
.sec-ev-time b{font-size:17px;font-weight:700;color:var(--accent);font-variant-numeric:tabular-nums}
.sec-ev-time small{font-size:11.5px;color:var(--ink-dim);font-variant-numeric:tabular-nums}
.sec-ev-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.sec-ev-title{font-size:15px;font-weight:600;line-height:1.4;overflow-wrap:anywhere}
.sec-ev-sub{font-size:12.5px;color:var(--ink-dim);line-height:1.45;overflow:hidden;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.sec-ev.is-past .sec-ev-time{border-right-color:var(--card-brd)}
.sec-ev.is-past .sec-ev-time b{color:var(--ink-dim)}
.sec-ev.is-past .sec-ev-title{color:var(--ink-dim)}

.sec-pill{flex:none;display:inline-flex;align-items:center;min-height:24px;padding:2px 9px;border-radius:var(--r-pill);
  font-size:12px;font-weight:700;white-space:nowrap;background:var(--accent-soft);color:var(--accent)}
.sec-pill.soon{background:var(--accent);color:var(--on-accent)}
.sec-pill.past{background:var(--surface-2);color:var(--ink-dim)}
.sec-pill.ok{background:var(--green-soft);color:var(--green-ink)}
.sec-pill.bad{background:rgba(var(--danger-rgb),.12);color:var(--danger)}

/* ---- แถวงาน ---- */
.sec-task{display:flex;align-items:stretch;position:relative}
.sec-check{flex:none;width:52px;min-height:56px;display:grid;place-items:center}
.sec-check i{width:26px;height:26px;border-radius:50%;display:grid;place-items:center;
  border:2px solid rgba(var(--accent-rgb),.55);background:var(--surface);transition:background .18s, border-color .18s}
/* เครื่องหมายถูกวาดด้วยเส้น CSS (ภาพ check แบบมีมิติพอทำเป็นสีขาวจะกลายเป็นวงกลมทึบ ดูเหมือนปุ่มตัวเลือก) */
.sec-task.is-done .sec-check i::after{content:'';width:6px;height:12px;margin-top:-2px;border:solid #fff;border-width:0 2.6px 2.6px 0;transform:rotate(45deg)}
.sec-check:active i{transform:scale(.9)}
.sec-task.is-done .sec-check i{background:var(--accent);border-color:var(--accent)}
.sec-task-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px;padding:10px 14px 10px 0;text-align:left;color:var(--ink)}
.sec-task-main:active{background:var(--accent-soft)}
.sec-task-title{font-size:15px;font-weight:600;line-height:1.4;overflow-wrap:anywhere}
.sec-task-note{font-size:12.5px;color:var(--ink-dim)}
.sec-task.is-done .sec-task-title{color:var(--ink-dim);text-decoration:line-through;text-decoration-thickness:1.5px}
/* เลยกำหนด: แถบแดงซ้าย + พื้นแดงจาง + ป้ายแดงทึบ ให้เห็นตั้งแต่กวาดตา */
.sec-task.is-late{background:rgba(var(--alert-rgb),.07)}
.sec-task.is-late::before{content:'';position:absolute;left:0;top:6px;bottom:6px;width:4px;border-radius:0 4px 4px 0;background:var(--badge-unread)}
.sec-task.is-late .sec-check i{border-color:var(--badge-unread)}
.sec-meta{display:flex;flex-wrap:wrap;gap:5px;margin-top:2px}
.sec-due{display:inline-flex;align-items:center;gap:4px;min-height:24px;padding:2px 9px;border-radius:var(--r-pill);
  font-size:12px;font-weight:600;background:var(--surface-2);color:var(--ink-dim)}
.sec-due.soon{background:var(--accent-soft);color:var(--accent)}
.sec-due.late{background:var(--badge-unread);color:#fff}
.sec-tag{display:inline-flex;align-items:center;min-height:24px;padding:2px 9px;border-radius:var(--r-pill);
  font-size:12px;font-weight:600;background:var(--surface-2);color:var(--ink-dim)}
.sec-tag.high{background:rgba(var(--danger-rgb),.12);color:var(--danger)}
.sec-tag.doing{background:var(--accent-soft);color:var(--accent)}

/* ---- "เลขากำลังทำอะไรให้อยู่": ไทม์ไลน์ที่บอกชัดว่าใครทำ ---- */
.sec-log{list-style:none;padding:6px 0}
.sec-log-row{display:flex;gap:11px;align-items:flex-start;padding:9px 14px}
.sec-log-row+.sec-log-row{border-top:1px solid var(--card-brd)}
.sec-who-av{flex:none;width:34px;height:34px;border-radius:12px;display:grid;place-items:center}
.sec-who-av.ai{background:var(--accent-soft);box-shadow:inset 0 0 0 1px var(--ai-brd)}
.sec-who-av.ai svg{width:26px;height:26px}
.sec-who-av.me{border-radius:50%}
.sec-log-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:3px}
.sec-log-top{display:flex;align-items:center;gap:8px}
.sec-log-top time{margin-left:auto;font-size:12px;color:var(--ink-faint);white-space:nowrap}
.sec-who{display:inline-flex;align-items:center;min-height:22px;padding:1px 8px;border-radius:8px;font-size:11.5px;font-weight:700;white-space:nowrap}
.sec-who.ai{background:var(--accent);color:var(--on-accent)}
.sec-who.me{background:var(--surface-2);color:var(--ink);box-shadow:inset 0 0 0 1px var(--card-brd)}
.sec-who.sm{flex:none}
.sec-log-txt{font-size:14px;line-height:1.45;color:var(--ink);overflow-wrap:anywhere}
.sec-log-txt b{font-weight:700}

/* ---- หน้าว่าง: สอนวิธีใช้ ---- */
.sec-hello{display:flex;flex-direction:column;align-items:center;text-align:center;gap:8px;padding:18px 16px 20px;border-radius:24px;
  background:var(--grad-surface);border:1px solid var(--card-brd);box-shadow:0 6px 18px rgba(var(--shadow-rgb),.1)}
.sec-hello-mascot{width:112px;height:auto;filter:drop-shadow(0 8px 12px rgba(var(--shadow-rgb),.22))}
.sec-hello h2{font-size:21px;line-height:1.3;font-weight:700;color:var(--ink)}
.sec-hello p{font-size:14.5px;line-height:1.6;color:var(--ink-dim);max-width:330px}
.sec-ex{list-style:none;display:flex;flex-direction:column;gap:8px}
.sec-ex-btn{display:flex;align-items:center;gap:11px;width:100%;min-height:60px;padding:8px 12px 8px 8px;text-align:left;border-radius:18px;
  background:var(--surface);border:1px solid var(--card-brd);box-shadow:0 3px 8px rgba(var(--shadow-rgb),.06);color:var(--ink)}
.sec-ex-btn:active{transform:scale(.98);background:var(--accent-soft)}
.sec-ex-btn .v-plate{width:44px;height:44px;border-radius:14px}
.sec-ex-btn .v-plate svg{width:30px;height:30px}
.sec-ex-txt{flex:1;min-width:0;font-size:14.5px;font-weight:600;line-height:1.4}
.sec-ex-txt::before{content:'“'}.sec-ex-txt::after{content:'”'}
.sec-ex-btn>svg:last-child{width:22px;height:22px;flex:none;opacity:.8}
.sec-hello-cta{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:14px}
.sec-hello-cta svg{width:26px;height:26px}
.sec-hello-or{margin-top:10px;font-size:13px;color:var(--ink-dim);text-align:center;line-height:1.5}

/* ---- แถบเครื่องมือของแต่ละแท็บ ---- */
.sec-toolbar{display:flex;align-items:center;gap:8px;margin-bottom:10px}
.sec-toolbar-end{justify-content:flex-end}
.sec-chips{display:flex;gap:6px;flex:1;min-width:0;overflow-x:auto}
.sec-chips .chip{min-height:44px}
.sec-add{flex:none;display:inline-flex;align-items:center;gap:4px;min-height:44px;padding:0 14px 0 8px;border-radius:var(--r-md);
  background:var(--grad-primary);color:#fff;font-size:14px;font-weight:700;box-shadow:var(--primary-shadow);
  transition:transform .2s var(--ease-spring)}
.sec-add:active{transform:scale(.95)}
.sec-add svg{width:24px;height:24px;filter:brightness(0) invert(1)}
.sec-search{flex:1;margin:0}

.sec-day{margin-bottom:14px}
.sec-day-h{font-size:14px;font-weight:700;color:var(--ink-dim);margin:0 4px 7px}
.sec-day-h small{font-weight:500}
.sec-day-h.is-today{color:var(--accent)}

/* ---- ความจำ ---- */
.sec-mems{list-style:none;display:flex;flex-direction:column;gap:8px}
.sec-mem{display:flex;flex-direction:column;gap:7px;width:100%;padding:13px 14px;text-align:left;border-radius:18px;
  background:var(--surface);border:1px solid var(--card-brd);box-shadow:0 3px 8px rgba(var(--shadow-rgb),.06);color:var(--ink)}
.sec-mem:active{background:var(--accent-soft)}
.sec-mem-text{font-size:15px;line-height:1.55;white-space:pre-wrap;overflow-wrap:anywhere;
  display:-webkit-box;-webkit-line-clamp:5;-webkit-box-orient:vertical;overflow:hidden}
.sec-mem-tags{display:flex;flex-wrap:wrap;gap:5px}
.sec-mem-tags .sec-tag{background:var(--accent-soft);color:var(--accent)}
.sec-mem-foot{display:flex;gap:8px;font-size:12px;color:var(--ink-faint)}
.sec-mem-foot time{margin-left:auto}

/* ---- รายชื่อ (ระยะ 2) — แถวเดียวกับความจำ + ปุ่มโทรด้านขวา ---- */
.sec-ct{position:relative}
.sec-ct .sec-mem{padding-right:64px}
.sec-ct-phone{font-size:14px;color:var(--accent);font-variant-numeric:tabular-nums}
.sec-ct-call{position:absolute;right:12px;top:50%;transform:translateY(-50%);display:grid;place-items:center;width:44px;height:44px;
  border-radius:50%;background:var(--accent-soft);color:var(--accent)}
.sec-ct-call svg{width:20px;height:20px}
.sec-ct-call:active{transform:translateY(-50%) scale(.94)}

/* ---- เอกสาร ---- */
.sec-doc-row{display:flex;align-items:center;gap:12px;width:100%;min-height:66px;padding:9px 12px;text-align:left;color:var(--ink)}
.sec-doc-row:active{background:var(--accent-soft)}
.sec-doc-row .v-plate{width:44px;height:44px;border-radius:14px}
.sec-doc-row .v-plate svg{width:30px;height:30px}
.sec-doc-row>svg.vi-chevron{width:18px;height:20px;flex:none;filter:saturate(.55)}
.sec-doc-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.sec-doc-title{font-size:15px;font-weight:600}
.sec-doc-sub{font-size:12.5px;color:var(--ink-dim)}

/* ตัวอ่านเอกสารเต็มจอ (ทับทั้งหน้าเลขา) */
.sec-doc{position:fixed;inset:0;z-index:60;display:flex;flex-direction:column;
  width:min(480px,100%);margin:0 auto;background:var(--bg-0);background-image:var(--page-bg);
  animation:secDocIn .26s var(--ease-out)}
@keyframes secDocIn{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:none}}
.sec-doc-top .title{min-width:0;font-size:18px}
.sec-doc-body{flex:1;min-height:0;overflow-y:auto;padding:6px 16px calc(28px + env(safe-area-inset-bottom))}
.sec-doc-meta{font-size:12.5px;color:var(--ink-dim);margin:2px 2px 10px}
.sec-md{padding:16px 16px 18px;border-radius:20px;background:var(--surface);border:1px solid var(--card-brd);
  box-shadow:0 3px 10px rgba(var(--shadow-rgb),.07);color:var(--ink);font-size:15.5px;line-height:1.75;overflow-wrap:anywhere}
.sec-md h3{font-size:19px;line-height:1.35;font-weight:700;margin:.4em 0 .5em}
.sec-md h4{font-size:16.5px;font-weight:700;margin:.8em 0 .4em}
.sec-md h5{font-size:15.5px;font-weight:700;margin:.8em 0 .3em;color:var(--ink-dim)}
.sec-md>h3:first-child,.sec-md>h4:first-child{margin-top:0}
.sec-none-in{color:var(--ink-dim)}
.sec-doc-old{display:flex;flex-direction:column;gap:10px;margin:4px 0 12px;padding:12px;border-radius:18px;
  background:var(--surface-2);background:color-mix(in srgb,var(--amber) 16%,var(--surface));
  border:1.5px solid color-mix(in srgb,var(--amber) 55%,var(--card-brd))}
.sec-doc-old strong{font-size:14.5px;color:var(--ink)}
.sec-doc-old .btn-cta,.sec-doc-old .btn-outline-green{min-height:46px;padding:8px;font-size:14px}
.sec-doc-file{display:flex;align-items:center;gap:12px;padding:12px}
.sec-doc-open{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:12px;text-decoration:none}
.sec-doc-open svg{width:24px;height:24px}
.sec-doc-editing{display:flex;flex-direction:column}
.sec-f-grow{flex:1;display:flex;flex-direction:column}
.sec-doc-ta{flex:1;min-height:46dvh;resize:vertical;line-height:1.65;font-size:15px}
.sec-doc-warn{display:flex;gap:8px;align-items:flex-start;margin-bottom:10px;padding:10px 12px;border-radius:14px;
  background:var(--accent-soft);color:var(--ink);font-size:13.5px;line-height:1.5}
.sec-doc-warn[hidden]{display:none}
.sec-doc-warn svg{width:22px;height:22px;flex:none}

/* ---- หน้าว่างของแต่ละแท็บ ---- */
.sec-empty{display:flex;flex-direction:column;align-items:center;text-align:center;gap:8px;padding:26px 18px 22px;border-radius:22px;
  background:var(--grad-surface);border:1px dashed rgba(var(--accent-rgb),.35)}
.sec-empty .v-plate{width:64px;height:64px;border-radius:20px;margin-bottom:2px}
.sec-empty .v-plate svg{width:44px;height:44px}
.sec-empty strong{font-size:16.5px;color:var(--ink)}
.sec-empty>span{font-size:13.5px;line-height:1.6;color:var(--ink-dim);max-width:320px}
.sec-empty-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;width:auto;min-width:170px;margin-top:6px;padding:10px 18px}
.sec-empty-btn svg{width:22px;height:22px}
.sec-error{border-style:solid}

/* ---- ตั้งค่า ---- */
.sec-set{padding:12px 14px;margin-bottom:12px}
.sec-set-row{display:flex;align-items:center;gap:12px;min-height:52px}
.sec-set-row .v-plate{width:44px;height:44px;border-radius:14px}
.sec-set-row .v-plate svg{width:30px;height:30px}
.sec-set-txt{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.sec-set-t{font-size:15px;font-weight:600;color:var(--ink)}
.sec-set-s{font-size:12.5px;line-height:1.5;color:var(--ink-dim)}
.sec-times{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:12px;transition:opacity .2s}
.sec-times[data-off]{opacity:.45;pointer-events:none}
.sec-weekly{grid-column:1 / -1;align-items:flex-start;line-height:1.45}
.sec-weekly input{flex:none;margin-top:1px}
.sec-time{display:flex;flex-direction:column;gap:5px}
.sec-time>span{display:flex;align-items:center;gap:5px;font-size:13px;font-weight:600;color:var(--ink-dim)}
.sec-time>span svg{width:22px;height:22px}
.sec-time input{text-align:center;font-size:17px;font-weight:600;font-variant-numeric:tabular-nums}
.sec-set-name{margin-top:10px}
.sec-set-save{margin-top:12px;min-height:48px}
.sec-privacy{display:flex;gap:8px;align-items:flex-start;margin:4px 4px 14px;font-size:12.5px;line-height:1.6;color:var(--ink-dim)}
.sec-privacy svg{width:20px;height:20px;flex:none;margin-top:1px}
.sec-privacy a{font-weight:600;text-decoration:underline}
.sec-danger{display:flex;flex-direction:column;gap:10px;border-color:rgba(var(--danger-rgb),.35)}
.sec-wipe-btn{min-height:48px;border-radius:var(--r-md);border:1.5px solid var(--danger);color:var(--danger);font-size:14.5px;font-weight:700;
  background:var(--surface)}
.sec-wipe-btn:active{background:rgba(var(--danger-rgb),.08)}

/* ================= แผ่นเลื่อนขึ้น (ฟอร์ม/ยืนยัน) ================= */
.sec-sheet-wrap{position:fixed;inset:0;z-index:80;display:flex;align-items:flex-end;justify-content:center}
.sec-sheet-bd{position:absolute;inset:0;background:rgba(var(--shadow-rgb),.28);background:rgba(8,19,77,.34);
  backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px);animation:secFade .2s ease both}
html[data-wtheme="dark"] .sec-sheet-bd{background:rgba(0,0,0,.5)}
.sec-sheet{position:relative;width:min(480px,100%);max-height:90dvh;overflow-y:auto;
  padding:6px 18px calc(18px + env(safe-area-inset-bottom));border-radius:var(--r-sheet) var(--r-sheet) 0 0;
  background:var(--surface);border:1px solid var(--card-brd);border-bottom:0;color:var(--ink);
  box-shadow:0 -8px 30px rgba(0,0,0,.16);animation:secUp .28s var(--ease-out) both}
.sec-sheet-wrap.closing .sec-sheet{animation:secDown .18s ease-in both}
.sec-sheet-wrap.closing .sec-sheet-bd{animation:secFade .18s ease reverse both}
@keyframes secUp{from{transform:translateY(40px);opacity:0}to{transform:none;opacity:1}}
@keyframes secDown{to{transform:translateY(40px);opacity:0}}
@keyframes secFade{from{opacity:0}to{opacity:1}}
.sec-sheet-grab{width:40px;height:5px;border-radius:3px;margin:4px auto 6px;background:var(--card-brd)}
.sec-sheet-head{display:flex;align-items:center;gap:10px;margin-bottom:10px}
.sec-sheet-head h2{flex:1;min-width:0;font-size:18px;font-weight:700;line-height:1.35}
.sec-sheet-x{width:44px;height:44px}
.sec-sheet-x svg{width:22px;height:22px}
.sec-sheet-body{display:flex;flex-direction:column;gap:12px}
.sec-sheet-p{font-size:14.5px;line-height:1.6;color:var(--ink-dim)}
.sec-f{display:flex;flex-direction:column;gap:6px}
.sec-f>span{font-size:13px;font-weight:600;color:var(--ink-dim)}
.sec-ta{resize:vertical;line-height:1.55;min-height:84px}
.sec-select{appearance:auto;-webkit-appearance:menulist}
.sec-inline{display:flex;gap:8px;align-items:center}
.sec-inline .input-glass{flex:1;min-width:0}
.sec-clear{flex:none;min-height:44px;padding:0 12px;border-radius:var(--r-md);color:var(--ink-dim);font-size:13.5px;font-weight:600;
  background:var(--surface-2)}
.sec-seg{display:flex;gap:4px;padding:4px;border-radius:15px;background:var(--surface-2)}
.sec-seg-b{flex:1;min-height:44px;border-radius:12px;font-size:14px;font-weight:600;color:var(--ink-dim)}
.sec-seg-b.on{background:var(--surface);color:var(--accent);box-shadow:0 2px 6px rgba(var(--shadow-rgb),.14), inset 0 0 0 1.5px var(--accent)}
.sec-hint{display:flex;align-items:center;gap:6px;font-size:12.5px;color:var(--ink-dim)}
.sec-hint svg{width:18px;height:18px}
.sec-err{font-size:13.5px;font-weight:600;color:var(--danger);line-height:1.5}
.sec-err[hidden]{display:none}
.sec-del{min-height:46px;color:var(--danger);font-size:14.5px;font-weight:600;border-radius:var(--r-md)}
.sec-del[hidden]{display:none}
.sec-del-ask{display:flex;flex-direction:column;gap:10px;padding:12px;border-radius:16px;background:rgba(var(--danger-rgb),.08);
  font-size:14px;color:var(--ink);line-height:1.5}
.sec-del-ask[hidden]{display:none}
.sec-row2{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.sec-row2 .btn-outline-green,.sec-row2 .btn-cta{min-height:46px;padding:8px}
.sec-del-ok{min-height:46px;border-radius:var(--r-md);background:var(--danger);color:var(--on-danger);font-size:14.5px;font-weight:700}
.sec-del-ok:disabled{opacity:.45}
.sec-full{width:100%;min-height:50px}
.sec-wipe-list{padding-left:1.3em;font-size:14.5px;line-height:1.8;color:var(--ink)}
.sec-vers{list-style:none;display:flex;flex-direction:column;gap:6px}
.sec-ver{display:flex;align-items:center;gap:10px;width:100%;min-height:54px;padding:8px 12px;border-radius:14px;text-align:left;
  background:var(--surface-2);color:var(--ink)}
.sec-ver b{font-size:14.5px}
.sec-ver span:not(.sec-pill){flex:1;min-width:0;font-size:12.5px;color:var(--ink-dim)}
.sec-ver.on{box-shadow:inset 0 0 0 2px var(--accent)}

/* รายการที่เพิ่งเปลี่ยน (สด) — สว่างวาบครั้งเดียว ไม่วน */
.sec-flash{animation:secFlash 1.6s ease-out 1}
@keyframes secFlash{0%,30%{background:rgba(var(--accent-rgb),.16)}100%{background:transparent}}

/* ================= "ส่งให้เลขา" ในแผ่นเมนูของหน้าแชท ================= */
.sec-fwd{display:flex;flex-direction:column;align-items:center;gap:6px;padding:10px 8px 6px;text-align:center}
.sec-fwd-ico{width:48px;height:48px;border-radius:16px;display:grid;place-items:center;background:var(--accent-soft)}
.sec-fwd-ico svg{width:34px;height:34px}
.sec-fwd-title{font-size:15.5px;color:var(--ink);line-height:1.4}
.sec-fwd-desc{font-size:12.5px;line-height:1.55;color:var(--ink-dim)}
.sec-fwd-quote{align-self:stretch;margin:4px 0 2px;padding:9px 11px;border-radius:12px;text-align:left;
  background:var(--surface-2);border-left:3px solid var(--accent);font-size:13.5px;line-height:1.5;color:var(--ink);
  max-height:6.2em;overflow:hidden;white-space:pre-wrap;overflow-wrap:anywhere}
.sec-fwd-lb{align-self:flex-start;font-size:12.5px;font-weight:600;color:var(--ink-dim);margin-top:2px}
.sec-fwd-note.input-glass{min-height:44px;padding:9px 12px;font-size:14px}
.sec-fwd-skip{align-self:flex-start;display:flex;align-items:center;gap:8px;min-height:44px;font-size:13.5px;color:var(--ink);cursor:pointer}
.sec-fwd-skip input{width:20px;height:20px;accent-color:var(--accent)}
.sheet-btn.sec-fwd-ok{background:var(--grad-primary);color:#fff;box-shadow:var(--primary-shadow)}

/* ---- จอแคบ ---- */
@media (max-width:359px){
  .sec-tab{font-size:12px;letter-spacing:-.1px}
  .sec-brief-btn{padding:0 10px 0 8px;font-size:13px}
  .sec-add span{display:none}
  .sec-add{padding:0 10px}
}

/* ---- ธีมเข้ม: เงา/ขอบให้เห็นชั้นการ์ด ---- */
html[data-wtheme="dark"] .sec-card,html[data-wtheme="dark"] .sec-mem,html[data-wtheme="dark"] .sec-ex-btn,
html[data-wtheme="dark"] .sec-md{box-shadow:0 3px 10px rgba(0,0,0,.28)}
html[data-wtheme="dark"] .sec-brief-paper{box-shadow:0 2px 8px rgba(0,0,0,.3)}
html[data-wtheme="dark"] .sec-brief-btn{background:#fff;color:#0047D6}
html[data-wtheme="dark"] .sec-who.ai{background:#2E7BFF;color:#fff}

@media (prefers-reduced-motion:reduce){
  .sec-brief-btn.busy svg,.sec-flash,.sec-doc,.sec-sheet{animation:none}
}

/* ไอคอนขาวบนพื้นน้ำเงิน — กฎธีมเข้ม html[data-wtheme="dark"] svg.vi (base.css) เจาะจงกว่า ต้องประกาศซ้ำให้ชนะ */
html[data-wtheme] .sec-add svg.vi,html[data-wtheme] .sec-brief-ico svg.vi{filter:brightness(0) invert(1)}

/* กฎการทำงาน (แท็บตั้งค่า) — รายการสั้น ๆ ที่เลขาเห็นทุกรอบ */
.sec-rule-n{margin-inline-start:6px;font-size:12px;font-weight:600;color:var(--ink-dim);font-variant-numeric:tabular-nums}
.sec-rules{list-style:none;margin:12px 0 0;padding:0;display:flex;flex-direction:column;gap:6px}
.sec-rule{display:flex;align-items:flex-start;gap:8px;padding:9px 10px;border-radius:12px;
  background:rgba(var(--accent-rgb),.07);border:1px solid var(--card-brd)}
.sec-rule-t{flex:1;min-width:0;font-size:13.5px;line-height:1.5;word-break:break-word}
.sec-rule-none{justify-content:center;color:var(--ink-dim);font-size:12.5px;background:none;border-style:dashed}
.sec-rule-x{flex:none;display:grid;place-items:center;width:28px;height:28px;margin:-2px -3px 0 0;
  border:0;border-radius:9px;background:none;color:var(--ink-dim);cursor:pointer;transition:color .15s,background .15s}
.sec-rule-x svg{width:17px;height:17px}
.sec-rule-x:hover,.sec-rule-x:focus-visible{color:var(--danger);background:rgba(var(--danger-rgb),.12)}
.sec-rule-x:disabled{opacity:.4;cursor:default}
.sec-rule-add{margin-top:10px}
