/* server-timeline.css — "Server Timeline" (public) · light theme · admin.css tokens + Cinzel/Prompt
   ★ redesign v3 (15 ก.ย.): การ์ดแน่นขึ้น (ไม่โล่ง) · หัวมีไอคอนปลายทาง+สถานะ · กดการ์ด→โมดัลรายละเอียด · แบ่งหน้า */
.tl-page { background: var(--tint); color: var(--ink); font-family: 'Prompt', system-ui, sans-serif; }

/* ── hero ── */
.tl-hero { position: relative; overflow: hidden; background: linear-gradient(135deg, #0b1a3a 0%, #123a72 58%, #1e63b8 100%); color: #fff; }
.tl-hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(1100px 320px at 82% -30%, rgba(130,185,255,.38), transparent 68%); pointer-events: none; }
.tl-hero-inner { position: relative; max-width: 1160px; margin: 0 auto; padding: 48px 22px 42px; }
.tl-crumb { display: flex; align-items: center; gap: 7px; font-size: .8rem; color: #bcd3f5; margin: 0 0 14px; }
.tl-crumb a { color: #bcd3f5; text-decoration: none; }
.tl-crumb a:hover { color: #fff; }
.tl-hero h1 { font-family: 'Cinzel', serif; font-weight: 700; font-size: clamp(1.9rem, 4.4vw, 3rem); margin: 0 0 10px; letter-spacing: .5px; }
.tl-hero h1 span { color: #7fb0ff; }
.tl-hero .lead { max-width: 660px; font-size: clamp(.9rem, 1.6vw, 1.02rem); color: #d7e6ff; line-height: 1.65; margin: 0; }

/* ── main ── */
.tl-main { max-width: 1160px; margin: 0 auto; padding: 24px 22px 72px; }

/* ── tabs (segmented) ── */
.tl-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 5px; background: var(--card); border: 1.5px solid var(--line);
  border-radius: 14px; margin-bottom: 12px; box-shadow: 0 2px 10px rgba(20,50,100,.05); }
.tl-tab { appearance: none; border: 0; background: transparent; color: var(--ink-2); font-family: 'Prompt', sans-serif; font-weight: 600;
  font-size: .9rem; padding: 9px 18px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  transition: color .18s, background .18s, box-shadow .18s; }
.tl-tab:hover { color: var(--blue); background: var(--hl); }
.tl-tab.on { background: var(--blue); color: #fff; box-shadow: 0 4px 14px rgba(30,99,184,.30); }
.tl-tab .tl-tab-ic { width: 17px; height: 17px; flex: none; }
.tl-sub { color: var(--ink-3); font-size: .86rem; margin: 4px 4px 20px; min-height: 1.1em; }

/* ── list grid ── */
.tl-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 16px; align-items: start; }
.tl-loading, .tl-empty { grid-column: 1 / -1; text-align: center; color: var(--ink-3); padding: 54px 0; font-size: .95rem; }
.tl-loading::before { content: ""; display: inline-block; width: 18px; height: 18px; margin-right: 9px; vertical-align: -3px;
  border: 2.5px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: tlSpin .7s linear infinite; }
@keyframes tlSpin { to { transform: rotate(360deg); } }

/* ── card (แน่น · คลิกได้) ── */
.tl-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px 13px;
  display: flex; flex-direction: column; gap: 11px; box-shadow: 0 1px 3px rgba(20,50,100,.05); cursor: pointer; outline: none;
  transition: border-color .18s, box-shadow .18s, transform .18s;
  animation: tlIn .42s cubic-bezier(.22,.61,.36,1) both; animation-delay: var(--d, 0ms); }
@keyframes tlIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.tl-card:hover, .tl-card:focus-visible { border-color: #bcd2f2; box-shadow: 0 12px 32px rgba(20,50,100,.13); transform: translateY(-3px); }
.tl-card:focus-visible { box-shadow: 0 0 0 3px rgba(59,130,246,.35), 0 12px 32px rgba(20,50,100,.13); }

/* head: [icon] [action + meta] [received] */
.tl-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; }
.tl-ico { width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #4f93ff, #1e63b8); box-shadow: 0 3px 8px rgba(30,99,184,.25); }
.tl-ico svg { width: 20px; height: 20px; }
.tl-card.d-cash  .tl-ico, .tl-ico.d-cash  { background: linear-gradient(135deg, #f0b45c, #d1861f); box-shadow: 0 3px 8px rgba(200,130,30,.28); }
.tl-card.d-web   .tl-ico, .tl-ico.d-web   { background: linear-gradient(135deg, #57c98a, #1f9d5a); box-shadow: 0 3px 8px rgba(30,160,90,.26); }
.tl-card.d-none  .tl-ico, .tl-ico.d-none  { background: linear-gradient(135deg, #9db2d0, #7387a3); box-shadow: none; }
.tl-head-txt { min-width: 0; }
.tl-cat { display: block; font-weight: 700; font-size: .95rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-metaline { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: .72rem; color: var(--ink-3); margin-top: 2px; }
.tl-clock { width: 12px; height: 12px; flex: none; opacity: .7; }
.tl-metaline .tl-when { color: var(--ink-2); }

/* mid: avatar + user + detail pill */
.tl-mid { display: flex; align-items: center; gap: 11px; }
.tl-ava { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, #4f93ff, #1e63b8); color: #fff; font-weight: 700; font-size: 1rem; text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(30,99,184,.28); }
.tl-who-txt { min-width: 0; flex: 1; }
.tl-user { display: block; font-weight: 700; font-size: .95rem; color: var(--ink); letter-spacing: 1px; }
.tl-act { display: block; font-size: .75rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-detail { flex: none; font-size: .82rem; font-weight: 700; color: var(--blue); background: var(--hl); padding: 5px 12px; border-radius: 999px; white-space: nowrap; }

/* item tiles */
.tl-items { display: flex; flex-wrap: wrap; gap: 7px; }
.tl-it { position: relative; width: 46px; height: 46px; border-radius: 11px; border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--tint), var(--card)); display: grid; place-items: center; overflow: hidden; flex: none; }
.tl-it img { width: 100%; height: 100%; object-fit: contain; }
.tl-it-ph { font-size: .58rem; color: var(--ink-3); font-weight: 700; padding: 2px; text-align: center; line-height: 1.1; }
.tl-it-q { position: absolute; right: -2px; bottom: -3px; font-style: normal;
  font-size: .62rem; font-weight: 800; background: var(--blue); color: #fff; border-radius: 6px; padding: 0 4px; box-shadow: 0 0 0 2px var(--card); }
.tl-more-items { align-self: center; font-size: .8rem; font-weight: 700; color: var(--ink-2); padding: 0 6px; }

/* foot: dest + view hint */
.tl-foot { display: flex; align-items: center; gap: 8px; padding-top: 2px; }
.tl-dest { font-size: .72rem; font-weight: 600; padding: 3px 11px; border-radius: 999px; background: var(--hl); color: var(--ink-2); }
.tl-dest.cash  { background: var(--t-gold, #fdf0dc); color: var(--c-gold, #b45309); }
.tl-dest.event { background: var(--t-blue, #e5efff); color: var(--blue); }
.tl-dest.web   { background: var(--t-green, #e3f6ea); color: var(--c-green, #15803d); }
.tl-recv { font-size: .72rem; font-weight: 700; padding: 3px 11px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.tl-recv.ok   { background: var(--t-green, #e3f6ea); color: var(--c-green, #15803d); }
.tl-recv.wait { background: var(--t-gold, #fdf0dc); color: var(--c-gold, #b45309); }
.tl-view { margin-left: auto; font-size: .76rem; font-weight: 600; color: var(--ink-3); display: inline-flex; align-items: center; gap: 3px; transition: color .16s; }
.tl-view svg { width: 13px; height: 13px; transition: transform .16s; }
.tl-card:hover .tl-view, .tl-card:focus-visible .tl-view { color: var(--blue); }
.tl-card:hover .tl-view svg { transform: translateX(3px); }

/* ── modal ── */
.tl-modal[hidden] { display: none; }
.tl-modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 18px; }
.tl-modal-scrim { position: absolute; inset: 0; background: rgba(12,26,50,.55); backdrop-filter: blur(2px); animation: tlFade .18s ease; }
.tl-modal-panel { position: relative; width: min(560px, 100%); max-height: 88vh; overflow-y: auto; background: var(--card);
  border-radius: 18px; padding: 22px 22px 24px; box-shadow: 0 24px 70px rgba(10,25,50,.4); animation: tlPop .22s cubic-bezier(.22,.61,.36,1); }
@keyframes tlFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tlPop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.tl-modal-x { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border: 0; border-radius: 10px; background: var(--tint);
  color: var(--ink-2); cursor: pointer; display: grid; place-items: center; transition: background .15s, color .15s; }
.tl-modal-x:hover { background: var(--hl); color: var(--blue); }
.tl-modal-x svg { width: 16px; height: 16px; }
.tl-modal-head { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; padding-right: 40px; }
.tl-modal-head .tl-ico { width: 46px; height: 46px; border-radius: 13px; }
.tl-modal-head .tl-ico svg { width: 24px; height: 24px; }
.tlm-title { font-family: 'Prompt', sans-serif; font-size: 1.12rem; font-weight: 700; margin: 0; color: var(--ink); line-height: 1.3; }
.tlm-sub { font-size: .8rem; color: var(--ink-3); }
.tlm-grid { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; padding: 14px 16px; background: var(--tint); border-radius: 12px; margin-bottom: 16px; }
.tlm-k { font-size: .82rem; color: var(--ink-3); white-space: nowrap; }
.tlm-v { font-size: .84rem; color: var(--ink); font-weight: 600; word-break: break-word; }
.tlm-v .tl-recv, .tlm-v .tl-dest { font-weight: 700; }
.tlm-v.mono { letter-spacing: 1px; }
.tlm-h3 { font-size: .9rem; font-weight: 700; color: var(--ink); margin: 0 0 10px; display: flex; align-items: center; gap: 7px; }
.tlm-h3 span { font-size: .78rem; font-weight: 600; color: var(--ink-3); }
.tlm-items { display: flex; flex-direction: column; gap: 7px; }
.tlm-mrow { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); }
.tlm-mrow .tlm-ic { width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line); background: linear-gradient(180deg, var(--tint), var(--card)); display: grid; place-items: center; overflow: hidden; flex: none; }
.tlm-mrow .tlm-ic img { width: 100%; height: 100%; object-fit: contain; }
.tlm-mrow .tlm-ic-ph { font-size: .58rem; color: var(--ink-3); font-weight: 700; text-align: center; padding: 2px; }
.tlm-nm { flex: 1; min-width: 0; font-size: .86rem; font-weight: 600; color: var(--ink); }
.tlm-q { flex: none; font-weight: 800; font-size: .86rem; color: var(--blue); }

/* ── pagination ── */
.tl-pager { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 30px; }
.tl-pg { appearance: none; min-width: 38px; height: 38px; padding: 0 12px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink-2); font-family: 'Prompt', sans-serif; font-weight: 600; font-size: .88rem; border-radius: 10px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; transition: all .15s; }
.tl-pg:hover:not(:disabled):not(.on) { border-color: var(--blue); color: var(--blue); background: var(--hl); }
.tl-pg.on { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 3px 10px rgba(30,99,184,.28); cursor: default; }
.tl-pg:disabled { opacity: .42; cursor: default; }
.tl-pg-gap { min-width: 24px; text-align: center; color: var(--ink-3); user-select: none; }

@media (prefers-reduced-motion: reduce) { .tl-card, .tl-modal-scrim, .tl-modal-panel { animation: none; } }
@media (max-width: 560px) {
  .tl-list { grid-template-columns: 1fr; }
  .tl-tabs { display: flex; width: 100%; }
  .tl-tab { flex: 1; justify-content: center; padding: 9px 6px; font-size: .8rem; }
  .tl-tab .tl-tab-ic { display: none; }
  .tl-detail { display: none; }
  .tlm-grid { grid-template-columns: 1fr; gap: 3px 0; }
  .tlm-grid .tlm-k { margin-top: 7px; }
}
