/* Client pages (requests, case detail, AI chat) — M2 public look */
body.app.c-m2 {
  --ink: #0B1F3F; --navy: #12305F; --blue: #1A4FBF; --blue-2: #6A8CFF; --tint: #EAF1FD; --gold-soft: #F2C76A;
  --line: #E4EAF2; --line-strong: #D5DEEA; --muted: #4A5A72; --ease: cubic-bezier(.16, 1, .3, 1);
  background: radial-gradient(900px 500px at 85% -10%, rgba(106,140,255,.22), transparent 60%), radial-gradient(700px 420px at 0% 10%, rgba(242,199,106,.18), transparent 60%), #F6F8FD;
  background-attachment: fixed; font-family: "IBM Plex Sans Thai", "Noto Sans Thai", sans-serif; color: var(--ink);
}
body.c-m2 .shell { display: block; min-height: auto; max-width: 1240px; margin: 0 auto; padding: 0 24px 72px; }
body.c-m2 .main { width: 100%; }
body.c-m2 .chat-fab, body.c-m2 .chat-dialog { display: none !important; }

/* glass top bar */
.c-head { position: sticky; top: 16px; z-index: 40; padding: 0 24px; margin: 16px 0 28px; transition: top .4s var(--ease); }
.c-head .c-bar { max-width: 1240px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 12px 10px 18px; border-radius: 999px; background: rgba(255,255,255,.66); border: 1px solid rgba(255,255,255,.9); box-shadow: 0 8px 30px rgba(11,31,63,.06); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); transition: background-color .4s ease, box-shadow .4s ease; }
.c-head.scrolled { top: 8px; }
.c-head.scrolled .c-bar { background: rgba(255,255,255,.92); box-shadow: 0 14px 40px rgba(11,31,63,.12); }
.c-head .brand { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--ink); }
.c-head .brand img { height: 40px; width: auto; display: block; }
.c-head .brand b { font-weight: 600; border-left: 1px solid #B8C5D8; padding-left: 12px; line-height: 1.3; }
.c-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-weight: 500; }
.c-nav a { color: var(--ink); text-decoration: none; padding: 9px 14px; border-radius: 999px; transition: background-color .2s ease, color .2s ease; }
.c-nav a:hover { background: var(--tint); color: var(--ink); }
.c-nav a.on { background: var(--ink); color: #fff; }
.c-user { display: inline-flex; align-items: center; gap: 8px; margin-left: 8px; padding: 4px 14px 4px 4px; border-radius: 999px; background: #fff; border: 1px solid var(--line); max-width: 220px; }
.c-user .av { flex: none; width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--blue-2)); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.c-user .nm { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-menu { display: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--tint); color: var(--ink); cursor: pointer; align-items: center; justify-content: center; }

/* content entrance */
body.c-m2 .main > * { animation: cRise .8s var(--ease) both; }
body.c-m2 .main > *:nth-child(2) { animation-delay: .08s; }
body.c-m2 .main > *:nth-child(3) { animation-delay: .16s; }
body.c-m2 .page > * { animation: cRise .8s var(--ease) both; }
body.c-m2 .page > *:nth-child(2) { animation-delay: .1s; }
body.c-m2 .page > *:nth-child(3) { animation-delay: .2s; }
@keyframes cRise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.c-loaded body.c-m2 .main > *, .c-loaded body.c-m2 .page > * { animation: none; opacity: 1; transform: none; }

/* headings and breadcrumbs */
body.c-m2 h1, body.c-m2 .page-head h1, body.c-m2 .head h1, body.c-m2 .page h1 { font: 700 clamp(28px, 3vw, 38px)/1.3 "IBM Plex Sans Thai", sans-serif; color: var(--ink); margin: 6px 0 18px; }
body.c-m2 .crumb { font-size: 14px; color: var(--muted); }
body.c-m2 .crumb a { color: var(--blue); font-weight: 600; }

/* requests list */
body.c-m2 .page { max-width: none; padding: 0; gap: 0; }
body.c-m2 .page-head { padding: 0; margin-bottom: 4px; align-items: center; }
body.c-m2 .page-head h1 { margin: 0; }
body.c-m2 .btn-new { border-radius: 12px; min-height: 48px; padding: 0 22px; background: var(--blue); box-shadow: 0 10px 24px rgba(26,79,191,.25); transition: transform .25s var(--ease), background-color .2s ease; }
body.c-m2 .btn-new:hover { background: var(--ink); transform: translateY(-2px); }
body.c-m2 .btn-new img { filter: brightness(0) invert(1); }
body.c-m2 .panel { margin: 18px 0 0; border: 1px solid #fff; border-radius: 24px; padding: 20px; background: rgba(255,255,255,.9); box-shadow: 0 12px 34px rgba(11,31,63,.08); }
body.c-m2 .panel .tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: #F6F8FD; border: 1px solid var(--line); height: auto; }
body.c-m2 .panel .tab { min-height: 40px; border: 0; border-radius: 10px; background: transparent; font-size: 15px; }
body.c-m2 .panel .tab[aria-selected="true"] { background: var(--ink); color: #fff; }
body.c-m2 .tbl { border-radius: 16px; overflow: hidden; border: 1px solid var(--line); }
body.c-m2 .thead > div { background: #F6F8FD; }
body.c-m2 .progress { background: linear-gradient(180deg, #F6F8FD, #fff); }
body.c-m2 .act { border-radius: 10px; background: var(--blue); }
body.c-m2 .act:hover { background: var(--ink); }

/* case detail: make the fixed-width layout fluid */
body.c-m2 .head { background: transparent; padding: 0; gap: 4px; }
body.c-m2 .body { width: auto; margin: 0; background: transparent; gap: 20px; flex-wrap: wrap; }
body.c-m2 .vpanel { border: 1px solid #fff; border-radius: 24px; background: rgba(255,255,255,.9); box-shadow: 0 12px 34px rgba(11,31,63,.08); padding-left: 8px; }
body.c-m2 .card-main { flex: 1 1 560px; width: auto; min-width: 0; border: 1px solid #fff; border-radius: 24px; padding: 24px; background: rgba(255,255,255,.92); box-shadow: 0 12px 34px rgba(11,31,63,.08); }
body.c-m2 .card-main .tabs { overflow-x: auto; }
body.c-m2 .card-main .tabs button[aria-selected="true"]::after { height: 3px; border-radius: 3px; background: var(--blue); }
body.c-m2 .facts { width: auto; column-gap: 40px; }
body.c-m2 .doc { border-radius: 12px; margin-bottom: 6px; border: 1px solid var(--line); }

/* AI chat */
body.c-m2 .chat-card { border: 1px solid #fff; border-radius: 24px; background: rgba(255,255,255,.92); box-shadow: 0 12px 34px rgba(11,31,63,.08); padding-top: 0; }
body.c-m2 .chat-top { padding: 16px 20px; background: linear-gradient(135deg, var(--ink), var(--blue)); color: #fff; border-bottom: 0; }
body.c-m2 .chat-top .ttl { color: #fff; }
body.c-m2 .chat-top .sub { color: #C3CEE2; }
body.c-m2 .chat-top .context { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.2); color: #fff; }
body.c-m2 .chat-top .context a { color: #fff; }
body.c-m2 .thread { background: #F6F8FD; }
body.c-m2 .compose { border-radius: 14px; }

/* floating น้องปกป้อง button */
.c-fab { position: fixed; right: 24px; bottom: 24px; z-index: 60; width: 76px; height: 76px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 16px 36px rgba(26,79,191,.38); animation: cBob 3.2s ease-in-out infinite; transition: transform .3s var(--ease); }
.c-fab:hover { transform: scale(1.06); }
.c-fab .core { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #EAF1FD 70%); border: 3px solid #fff; }
.c-fab .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--blue-2); animation: cRing 2.4s ease-out infinite; }
.c-fab .ring.g { border-color: var(--gold-soft); animation-delay: 1.2s; }
.c-fab .mascot { position: relative; overflow: visible; }
.c-fab .tag { position: absolute; top: -2px; left: -4px; padding: 0 6px; border-radius: 999px; background: var(--gold-soft); color: var(--ink); font-size: 11px; font-weight: 700; line-height: 18px; }
.c-fab .mascot .eyes { transform-box: fill-box; transform-origin: center; animation: cBlink 4.6s infinite; }
.c-fab .mascot .wave { transform-box: view-box; transform-origin: 50px 32px; animation: cWave 3.2s ease-in-out infinite; }
@keyframes cBob { 50% { transform: translateY(-6px); } }
@keyframes cRing { from { transform: scale(1); opacity: .55; } to { transform: scale(1.9); opacity: 0; } }
@keyframes cBlink { 0%, 90%, 100% { transform: scaleY(1); } 93% { transform: scaleY(.1); } }
@keyframes cWave { 0%, 55%, 100% { transform: rotate(0); } 65% { transform: rotate(-22deg); } 75% { transform: rotate(10deg); } 85% { transform: rotate(-16deg); } }

@media (max-width: 1000px) {
  .c-menu { display: flex; }
  .c-head .c-bar { border-radius: 24px; }
  .c-nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding: 6px 0 4px; }
  .c-nav.open { display: flex; }
  .c-nav a { padding: 12px 14px; }
  .c-user { margin: 6px 0 0; max-width: none; }
}
@media (max-width: 640px) {
  .c-head { padding: 0 12px; top: 10px; margin: 10px 0 20px; }
  .c-head .brand b { font-size: 14px; }
  body.c-m2 .shell { padding: 0 16px 56px; }
  body.c-m2 .panel { padding: 14px; border-radius: 18px; }
  body.c-m2 .vpanel { width: 100%; }
  body.c-m2 .vstepper { width: auto; height: auto; max-height: 300px; }
  body.c-m2 .facts { grid-template-columns: 1fr; }
  .c-fab { right: 16px; bottom: 16px; width: 66px; height: 66px; }
  .c-fab .mascot { width: 46px; height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
  body.c-m2 .main > *, body.c-m2 .page > *, .c-fab, .c-fab .ring, .c-fab .mascot .eyes, .c-fab .mascot .wave { animation: none !important; }
}

@media (max-width: 640px) { body.c-m2 .card-main .tabs { justify-content: flex-start; gap: 4px; } body.c-m2 .card-main .tabs button, body.c-m2 .card-main .tabs button[aria-selected="true"] { flex: none; width: auto; padding: 0 12px 9px; white-space: nowrap; } body.c-m2 .card-main { padding: 18px 16px; } }
