/* ===== Workbench v3 — glass / aurora theme =====
   Motion components adapted from DesignBookmark Motion (designbookmark.com/motion). */
:root {
  --bg: #07090f; --bg2: #0c1019; --glass: rgba(22,27,40,.66); --glass-2: rgba(30,36,52,.58); --surface: #1a2030;
  --ink: #eef1f8; --muted: #9aa4ba; --faint: #69738a; --line: rgba(255,255,255,.07); --line-2: rgba(255,255,255,.13);
  --fill-2: rgba(255,255,255,.08); --fill-3: rgba(255,255,255,.14);
  --a1: #7c5cff; --a2: #22d3ee; --a3: #f472b6; --accent: #8b7bff; --accent-ink: #b4a9ff; --accent-soft: rgba(139,123,255,.14);
  --grad: linear-gradient(135deg, var(--a1), var(--a2));
  --ok: #34d399; --on-ok: #04140a; --warn: #fbbf24; --bad: #fb7185; --p0: #f43f5e; --p1: #fb7185; --p2: #fbbf24; --p3: #64748b;
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 20px 50px -20px rgba(0,0,0,.55);
  --r: 14px; --ease-out: cubic-bezier(.22,1,.36,1); --spring: cubic-bezier(.34,1.56,.64,1); --ease-move: cubic-bezier(.77,0,.175,1);
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, monospace;
  /* legacy aliases used by older markup */
  --page: var(--bg); --paper: var(--glass); --blue: var(--accent); --blue-dark: var(--accent-ink); --blue-soft: var(--accent-soft);
  color-scheme: dark;
  font: 14px/1.55 "Noto Sans SC", "Microsoft YaHei", "Yu Gothic", system-ui, sans-serif;
}
:root[data-theme=light] {
  --bg: #f3f4fb; --bg2: #eceefa; --glass: rgba(255,255,255,.74); --glass-2: rgba(255,255,255,.62); --surface: #fff;
  --ink: #121726; --muted: #556077; --faint: #858ea3; --line: rgba(18,23,38,.08); --line-2: rgba(18,23,38,.15);
  --fill-2: rgba(18,23,38,.06); --fill-3: rgba(18,23,38,.12);
  --accent: #6047ff; --accent-ink: #4a33e0; --accent-soft: rgba(96,71,255,.10); --ok: #10b981; --warn: #b7791f; --bad: #e11d48;
  --shadow: 0 1px 2px rgba(18,23,38,.05), 0 12px 32px -16px rgba(18,23,38,.18);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button, summary { cursor: pointer; }
a { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
svg { width: 1.15em; height: 1.15em; flex: none; }
select option { background: var(--surface); color: var(--ink); }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- animated background ---------- */
/* perf: soft edge comes from the gradient itself, no filter/blend mode -> layer is rasterized once and only moved by the compositor */
body::before, body::after { content: ""; position: fixed; z-index: -1; pointer-events: none; width: 62vmax; height: 62vmax; opacity: .34; will-change: transform; contain: strict; }
body::before { background: radial-gradient(closest-side, var(--a1), color-mix(in srgb, var(--a1) 40%, transparent) 45%, transparent); top: -26vmax; left: -18vmax; animation: drift1 22s ease-in-out infinite alternate; }
body::after { background: radial-gradient(closest-side, var(--a2), color-mix(in srgb, var(--a2) 40%, transparent) 45%, transparent); top: -20vmax; right: -22vmax; animation: drift2 26s ease-in-out infinite alternate; }
:root[data-theme=light] body::before, :root[data-theme=light] body::after { opacity: .14; }
.aurora-grid { position: fixed; inset: 0; z-index: -1; pointer-events: none; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 30%, transparent 75%); }
@keyframes drift1 { to { transform: translate(18vw,10vh) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-14vw,16vh) scale(.9); } }

/* ---------- glass surfaces ---------- */
.panel, .glass { position: relative; min-width: 0; background: color-mix(in srgb, var(--surface) 90%, transparent); /* perf: was backdrop-filter blur(18px) on every panel */ border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.spot::before { --mx: inherit; --my: inherit; content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .4s; background: radial-gradient(420px circle at var(--mx,50%) var(--my,50%), rgba(139,123,255,.10), transparent 45%); }
.spot:hover::before { opacity: 1; }
/* perf: --mx/--my are set on pointermove; non-inherited so only .spot itself restyles, not its whole subtree */
@property --mx { syntax: "<length-percentage>"; inherits: false; initial-value: 50%; }
@property --my { syntax: "<length-percentage>"; inherits: false; initial-value: 50%; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; min-height: 58px; padding: 0 clamp(14px, 2vw, 26px); display: flex; align-items: center; gap: 10px; background: color-mix(in srgb, var(--bg) 66%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.identity { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 750; white-space: nowrap; margin: 0; }
.mark { position: relative; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #fff; font: 800 15px/1 system-ui; background: var(--grad); overflow: hidden; flex: none; }
.mark::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%); transform: translateX(-120%); animation: sheen 4.5s var(--ease-out) infinite 1s; }
@keyframes sheen { 40%, 100% { transform: translateX(120%); } }
.topbar-spacer { flex: 1; }
.live { display: flex; align-items: center; gap: 9px; height: 34px; padding: 0 5px 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass-2); font-size: 12px; color: var(--muted); white-space: nowrap; }
.pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: ping 1.8s var(--ease-out) infinite; }
.live[data-state=failed] .pulse { background: var(--warn); }
@keyframes ping { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(3); opacity: 0; } }
.scr { font-family: var(--mono); white-space: pre; letter-spacing: -.01em; }
.scr .c { color: var(--faint); } .scr .c.ok { color: var(--ink); }
.refresh { width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 0; background: var(--fill-2); display: grid; place-items: center; color: var(--muted); }
.refresh:hover { color: var(--ink); }
.refresh:disabled svg { animation: rot .9s linear infinite; }
.refresh #sync { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@keyframes rot { to { transform: rotate(360deg); } }
.icon-btn { width: 34px; height: 34px; padding: 0; border-radius: 10px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--glass-2); color: var(--muted); transition: transform .3s var(--spring), color .2s; flex: none; }
.icon-btn:hover { color: var(--ink); transform: rotate(-18deg) scale(1.06); }
.topbar .identity + .theme-toggle { margin-inline-start: auto; }
.locale-select { min-height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--glass-2); padding: 4px 8px; color: var(--muted); }
.staff-account { display: flex; gap: 10px; align-items: center; font-size: 12.5px; }
.staff-account .muted { white-space: nowrap; }
.topbar .staff-account .button { height: 34px; min-height: 34px; }
.admin-view-switch { display: flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.admin-view-switch a { color: var(--ink); padding: 7px 10px; border-radius: 8px; white-space: nowrap; }
.admin-view-switch a[aria-current="page"] { font-weight: 700; background: var(--surface); text-decoration: underline; text-underline-offset: .22em; }

/* ---------- command palette (DesignBookmark) ---------- */
.pal-slot { position: relative; width: 250px; height: 36px; flex: none; }
.pal { position: absolute; right: 0; top: 0; width: 250px; height: 36px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line-2); overflow: hidden; z-index: 40; box-shadow: 0 24px 60px -20px rgba(0,0,0,.6); }
.pal-trig { position: absolute; left: 0; top: 0; width: 250px; height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 13px; border: 0; background: none; color: var(--faint); }
.pal-trig span { flex: 1; text-align: left; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
kbd { font: 11px system-ui; color: var(--muted); background: var(--fill-2); border-radius: 6px; padding: 2px 6px; white-space: nowrap; }
.pal-box { position: absolute; right: 0; top: 0; width: min(540px, 92vw); opacity: 0; pointer-events: none; }
.pal-box.on { pointer-events: auto; }
.pal-q { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 16px; color: var(--faint); border-bottom: 1px solid var(--line); }
.pal-q input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 15px; }
.pal-res { position: relative; list-style: none; margin: 0; padding: 6px; height: 312px; }
.pal-res li { position: absolute; left: 6px; right: 6px; top: 6px; height: 38px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border-radius: 10px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.pal-res li > span:nth-child(2) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-res li.cur { color: var(--ink); }
.pal-res .hl { position: absolute; left: 6px; right: 6px; top: 6px; height: 38px; border-radius: 10px; background: linear-gradient(90deg, rgba(124,92,255,.25), rgba(34,211,238,.10)); }
.pal-empty { position: absolute; left: 0; right: 0; top: 20px; text-align: center; color: var(--faint); font-size: 13px; }
.pal-dim { position: fixed; inset: 0; z-index: 25; background: rgba(5,7,12,.45); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; }

/* ---------- page ---------- */
main { max-width: 1680px; margin-inline: auto; padding: 22px clamp(14px, 2vw, 26px) 40px; }
h1 { font-size: 30px; margin: 0; letter-spacing: -.03em; background: linear-gradient(90deg, var(--ink), var(--ink) 40%, var(--accent-ink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
h2 { font-size: clamp(18px, 1.5vw, 22px); margin: 0; line-height: 1.35; overflow-wrap: anywhere; }
h3 { font-size: 13.5px; font-weight: 750; margin: 0 0 9px; }
.muted, .meta { color: var(--muted); font-size: 12px; }

.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.greet { color: var(--muted); font-size: 13px; margin-top: 2px; }
.greet b { color: var(--ink); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(112px, 1fr)) minmax(270px, 1.6fr); gap: 10px; }
.mini { padding: 11px 14px; }
.mini .lab { font-size: 12px; color: var(--muted); }
.mini .num { font-size: 27px; font-weight: 750; line-height: 1.2; letter-spacing: -.02em; margin-top: 2px; }
.mini .sub { font-size: 11.5px; color: var(--faint); }
/* stat card (DesignBookmark) */
.statc { padding: 11px 14px 9px; display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; }
.statc .lab { font-size: 12px; color: var(--muted); }
.statc .big { font-size: 27px; font-weight: 750; line-height: 1.2; letter-spacing: -.02em; }
.statc .delta { display: inline-block; margin-top: 3px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; color: var(--faint); background: var(--fill-2); }
.statc .cw { position: relative; grid-row: span 2; min-width: 0; }
.statc .chart { display: block; width: 100%; height: 56px; overflow: visible; }
.statc .dot { position: absolute; left: 0; top: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(52,211,153,.18); }
.rseg { grid-column: 1 / -1; position: relative; display: flex; padding: 3px; border-radius: 999px; background: var(--fill-2); margin-top: 4px; }
.rseg button { position: relative; z-index: 1; flex: 1; padding: 2px 0; border: 0; background: none; font-size: 12px; font-weight: 600; color: var(--muted); transition: color .2s; }
.rseg button.on { color: var(--ink); }
.rseg .pill { position: absolute; left: 0; top: 3px; bottom: 3px; border-radius: 999px; background: var(--fill-3); }

.collection-health { margin: 0 0 14px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--glass-2); font-size: 12.5px; }
.collection-count { margin-inline-start: 10px; color: var(--muted); }
#collection-warning { color: var(--muted); margin: 4px 0 0; }
#collection-warning:empty { display: none; }
#workspace .collection-health:not([data-state=failed]):has(#collection-warning:empty) { display: none; }
.collection-health[data-state=failed] { background: rgba(251,191,36,.10); border-color: rgba(251,191,36,.35); }
.collection-health[data-state=failed] #collection-warning { color: var(--warn); }

/* ---------- toolbar / segmented control (DesignBookmark) ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.seg-wrap { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-width: 0; }
.segments { position: relative; display: flex; padding: 4px; border-radius: 14px; background: color-mix(in srgb, var(--surface) 90%, transparent); border: 1px solid var(--line); }
.segments button { position: relative; z-index: 1; height: 34px; padding: 0 13px; border: 0; background: none; border-radius: 10px; font-weight: 600; color: var(--muted); display: flex; gap: 7px; align-items: center; white-space: nowrap; transition: color .25s; }
.segments button span { font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--fill-2); font-variant-numeric: tabular-nums; }
.segments button[aria-pressed="true"] { color: #fff; }
.segments button[aria-pressed="true"] span { background: rgba(255,255,255,.22); }
.segment-indicator { position: absolute; left: 0; top: 4px; height: 34px; z-index: 0; border-radius: 10px; background: var(--grad); pointer-events: none; box-shadow: 0 6px 20px -4px rgba(124,92,255,.6); }
.seg-cap { position: relative; height: 22px; min-width: 260px; }
.seg-cap .cw { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 13px; color: var(--muted); }
.seg-cap .cw b { color: var(--ink); }
.tools { flex: 1 1 290px; display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.search { flex: 1 1 auto; max-width: 420px; min-width: 0; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; color: var(--faint); border: 1px solid var(--line); background: var(--glass); border-radius: 11px; transition: border-color .2s, box-shadow .2s; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search input { width: 100%; outline: none; border: 0; background: none; color: var(--ink); }

/* ---------- buttons ---------- */
.button { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 6px 14px; border: 1px solid transparent; border-radius: 10px; text-decoration: none; font-weight: 600; white-space: nowrap; transition: transform .25s var(--spring), background-color .2s, border-color .2s, box-shadow .25s; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: scale(.96); }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.secondary { color: var(--ink); background: var(--glass-2); border-color: var(--line-2); }
.secondary:hover { border-color: var(--accent); }
.primary { color: #fff; background: var(--grad); box-shadow: 0 8px 24px -8px rgba(124,92,255,.8); min-width: 98px; }
.primary:hover:not(:disabled) { box-shadow: 0 10px 30px -6px rgba(124,92,255,.95); }

/* copy button (DesignBookmark) */
.cp-btn { overflow: hidden; padding: 0 14px 0 12px; height: 36px; }
.cp-btn[data-copied] { background: linear-gradient(135deg, #10b981, #34d399); box-shadow: 0 8px 24px -8px rgba(16,185,129,.8); }
.cp-ic { position: relative; width: 18px; height: 18px; flex: none; }
.cp-ic svg { position: absolute; inset: 0; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cp-ic .i-ok { stroke-width: 2.4; opacity: 0; }
.cp-roll { position: relative; height: 20px; overflow: hidden; display: block; }
.cp-w { display: flex; flex-direction: column; }
.cp-w b { display: block; height: 20px; line-height: 20px; font-weight: 600; white-space: nowrap; }

/* filter dropdown */
.filter { position: relative; }
.filter summary { list-style: none; height: 38px; }
.filter summary::-webkit-details-marker { display: none; }
.filter summary svg { transition: transform .3s var(--spring); }
.filter[open] summary svg { transform: rotate(180deg); }
.filter-menu { position: absolute; z-index: 6; right: 0; top: calc(100% + 8px); width: 220px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 14px; box-shadow: 0 20px 50px -16px rgba(0,0,0,.55); padding: 12px; display: grid; gap: 6px; transform-origin: top right; }
@keyframes dropdown-in { 0% { opacity: 0; transform: translateY(-6px) scale(.96); } 70% { transform: translateY(1px) scale(1.01); } 100% { opacity: 1; transform: none; } }
.filter-menu select { width: 100%; min-height: 36px; background: var(--fill-2); border: 1px solid var(--line); border-radius: 9px; padding: 4px 8px; }
.filter-menu label { font-size: 12px; color: var(--muted); }
.filter-menu label:not(:first-child) { margin-top: 5px; }

/* ---------- ticket list ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 42fr) minmax(0, 58fr); gap: 14px; align-items: start; }
.list { max-height: calc(100dvh - 260px); min-height: 440px; overflow: auto; overscroll-behavior: contain; padding: 4px 6px 6px; scrollbar-width: thin; }
table { border-collapse: separate; border-spacing: 0 3px; table-layout: fixed; width: 100%; }
thead { position: sticky; top: 0; z-index: 2; }
th { text-align: start; padding: 8px 8px; font-size: 11.5px; font-weight: 650; color: var(--faint); background: var(--surface); /* perf: no backdrop-filter on sticky cells */ }
th:first-child { width: 27%; border-radius: 9px 0 0 9px; padding-left: 14px; }
th:nth-child(2) { width: 43%; }
th:nth-child(3) { width: 14%; }
th:last-child { width: 16%; border-radius: 0 9px 9px 0; }
td { text-align: start; padding: 11px 8px; overflow-wrap: anywhere; vertical-align: middle; transition: background-color .2s; }
td:first-child { border-radius: 11px 0 0 11px; padding-left: 14px; box-shadow: inset 3px 0 0 var(--pc, transparent); }
td:last-child { border-radius: 0 11px 11px 0; }
tbody tr { cursor: pointer; }
tbody tr.enter { opacity: 0; transform: translateY(10px); animation: rise .55s var(--ease-out) forwards; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes rise { to { opacity: 1; transform: none; } }
tbody tr:hover:not(.selected) td { background: var(--glass-2); }
tr.selected td { background: rgba(124,92,255,.17); }
:root[data-theme=light] tr.selected td { background: rgba(96,71,255,.09); }
tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--pc, var(--accent)), inset 0 1px 0 rgba(139,123,255,.55), inset 0 -1px 0 rgba(139,123,255,.55); }
tr.selected td:not(:first-child):not(:last-child) { box-shadow: inset 0 1px 0 rgba(139,123,255,.55), inset 0 -1px 0 rgba(139,123,255,.55); }
tr.selected td:last-child { box-shadow: inset -1px 0 0 rgba(34,211,238,.35), inset 0 1px 0 rgba(139,123,255,.55), inset 0 -1px 0 rgba(139,123,255,.55); }
tr.hot td:first-child { position: relative; }
tr.hot td:first-child::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 11px 0 0 11px; background: var(--surface); opacity: 0; pointer-events: none; animation: hot 2s ease-in-out infinite; will-change: opacity; }
@keyframes hot { 50% { opacity: .65; } }
.player-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who { width: 36px; height: 36px; border-radius: 11px; flex: none; display: grid; place-items: center; font-weight: 750; font-size: 12px; color: #fff; background: var(--av); }
.player-cell > div { min-width: 0; }
.ticket-link { color: var(--ink); text-decoration: none; display: block; font-weight: 600; }
.ticket-link:hover { color: var(--accent-ink); }
.player-name, .ticket-link { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.player-name { font-weight: 700; }
.player-spend { gap: 4px; }
.spend-amount { font-variant-numeric: tabular-nums; }
.spend-badge { border-radius: 5px; padding-inline: 4px; font-size: 10.5px; font-weight: 750; line-height: 1.45; white-space: nowrap; }
.spend-svip { color: #fbd568; background: #483615; }
.spend-vip { color: #e0c8ff; background: #40265d; }
.spend-key { color: #9ee8e7; background: #154648; }
:root[data-theme=light] .spend-svip { color: #714800; background: #fff0be; }
:root[data-theme=light] .spend-vip { color: #59298b; background: #f0e3ff; }
:root[data-theme=light] .spend-key { color: #0d5459; background: #d7f3f2; }
.cell-sub { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.cell-tag { padding: 0 7px; border-radius: 6px; background: var(--fill-2); font-size: 11px; line-height: 19px; }
.cell-prio { font-weight: 800; font-size: 11px; color: var(--pc); }
.wait { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; color: var(--muted); }
.wait.late { color: var(--bad); font-weight: 750; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 1px 9px; white-space: nowrap; font-size: 11px; font-weight: 700; line-height: 20px; color: var(--muted); background: var(--fill-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge:empty { display: none; }
.badge.pending { color: var(--warn); background: rgba(251,191,36,.13); }
.badge.replied { color: var(--ok); background: rgba(52,211,153,.13); }
.badge.bug { color: var(--bad); background: rgba(251,113,133,.14); }
.empty { color: var(--muted); text-align: center; padding: 38px 14px; }

/* ---------- detail ---------- */
.detail { min-height: 440px; padding: 20px clamp(14px, 1.6vw, 24px) 22px; }
#ticket.enter > * { opacity: 0; transform: translateY(8px); animation: rise .55s var(--ease-out) forwards; }
#ticket.enter > :nth-child(2) { animation-delay: 40ms; } #ticket.enter > :nth-child(3) { animation-delay: 80ms; }
#ticket.enter > :nth-child(4) { animation-delay: 120ms; } #ticket.enter > :nth-child(5) { animation-delay: 160ms; }
#ticket.enter > :nth-child(6) { animation-delay: 200ms; } #ticket.enter > :nth-child(7) { animation-delay: 240ms; }
.detail-head, .history-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.meta { margin: 9px 0 16px; overflow-wrap: anywhere; font-size: 12.5px; }
.back { display: none; }

/* AI summary: goo thinking → streaming reply (DesignBookmark) */
.insight { position: relative; padding: 14px 16px 16px; border-radius: var(--r); background: var(--glass-2); isolation: isolate; }
.insight::before { content: ""; position: absolute; inset: -1px; z-index: -1; border-radius: inherit; padding: 1px; background: conic-gradient(from var(--ang), var(--a1), var(--a2), var(--a3), var(--a1)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.insight:has(#conversation-status:not(:empty):not(.error))::before { animation: spin 6s linear infinite; }
@property --ang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes spin { to { --ang: 360deg; } }
.insight h3 { display: flex; align-items: center; gap: 8px; }
.insight h3 svg { color: var(--a2); }
.insight h3 .g { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.insight p { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
#conversation-status { font-size: 12px; font-weight: 600; background: linear-gradient(90deg, var(--faint) 20%, var(--ink) 50%, var(--faint) 80%) 0 0/200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 1.4s linear infinite; margin-bottom: 8px; }
#conversation-status.error { animation: none; color: var(--warn); -webkit-text-fill-color: var(--warn); }
#conversation-status:empty { display: none; }
@keyframes shine { to { background-position: -200% 0; } }
.ai-box { position: relative; width: 64px; height: 40px; border-radius: 20px; background: var(--fill-2); overflow: hidden; }
.ai-box.done { background: transparent; }
.goo { position: absolute; left: 0; top: 0; width: 64px; height: 40px; filter: url(#dotgoo); }
.goo i { position: absolute; left: 0; top: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--accent-ink); }
#conversation-result { position: absolute; left: 0; top: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 16px; margin: 0; }
#conversation-result dt { color: var(--faint); font-size: 12.5px; white-space: nowrap; }
#conversation-result dd { margin: 0; overflow-wrap: anywhere; }
.wd { display: inline; opacity: 0; }

.draft { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--glass-2); overflow: hidden; transition: border-color .25s, box-shadow .25s; }
.draft:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.draft h3 { margin: 0; padding: 11px 16px 0; }
#draft-note { margin: 2px 16px 8px; }
.draft textarea { display: block; width: 100%; min-height: 128px; padding: 12px 16px; border: 0; border-top: 1px solid var(--line); background: transparent; resize: vertical; line-height: 1.8; outline: none; }
.draft-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 9px 10px 9px 16px; border-top: 1px solid var(--line); }

.history { margin-top: 18px; }
.history-head h3 { margin: 0; }
.switch { color: var(--muted); font-size: 12px; display: flex; gap: 6px; align-items: center; }
.switch input, .workflow-member input { accent-color: var(--accent); }
.timeline { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 12px; }
.message { position: relative; max-width: 88%; padding: 10px 14px; border-radius: 4px 14px 14px 14px; background: var(--glass-2); border: 1px solid var(--line); overflow-wrap: anywhere; }
.message.staff { margin-left: auto; border-radius: 14px 4px 14px 14px; background: linear-gradient(135deg, rgba(124,92,255,.22), rgba(34,211,238,.12)); border-color: rgba(139,123,255,.28); }
:root[data-theme=light] .message.staff { background: linear-gradient(135deg, rgba(96,71,255,.10), rgba(34,211,238,.08)); }
.timeline.enter .message { opacity: 0; animation: pop .55s var(--spring) forwards; animation-delay: calc(var(--i, 0) * 70ms + 120ms); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
.message header { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--faint); }
.message header strong { color: var(--ink); font-size: 12px; }
.message p { margin: 5px 0 0; white-space: pre-wrap; }
.attachments { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 9px; max-width: 400px; }
.thumbnail { display: block; border: 1px solid var(--line-2); padding: 0; background: var(--fill-2); border-radius: 9px; overflow: hidden; aspect-ratio: 16/9; transition: transform .3s var(--spring); }
.thumbnail:hover { transform: scale(1.04) rotate(-1deg); }
.thumbnail img { width: 100%; height: 100%; object-fit: cover; display: block; }
.environment-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(155px, 100%), 1fr)); gap: 7px; margin: 8px 0; }
.environment-field { min-width: 0; padding: 7px 10px; background: var(--fill-2); border: 1px solid var(--line); border-radius: 9px; }
.environment-field dt { color: var(--faint); font-size: 11.5px; font-weight: 700; }
.environment-field dd { margin: 2px 0 0; overflow-wrap: anywhere; }

/* lightbox */
dialog { width: min(950px, calc(100% - 28px)); max-height: 90dvh; padding: 12px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; }
.lightbox-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
#full-image { max-width: 100%; max-height: calc(90dvh - 62px); object-fit: contain; margin-inline: auto; display: block; border-radius: 8px; }
dialog::backdrop { background: rgba(5,7,12,.7); backdrop-filter: blur(4px); }

/* ---------- workflow ---------- */
.workflow { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--glass-2); }
.workflow > summary { padding: 12px 16px; font-size: 13.5px; font-weight: 750; }
.workflow-content { padding: 2px 16px 14px; }
.workflow-content label { display: block; margin: 9px 0 5px; font-weight: 650; font-size: 13px; }
.workflow-content textarea, .workflow-content select, .workflow-content input[type=text], .dev-list input, .workflow textarea { width: 100%; min-width: 0; border: 1px solid var(--line-2); background: var(--fill-2); border-radius: 9px; padding: 7px 10px; }
.workflow-content textarea { display: block; resize: vertical; margin-bottom: 7px; line-height: 1.7; }
.workflow-content hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.workflow-row { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
/* checkbox list (DesignBookmark-style pop + draw) */
.workflow-content .workflow-member { display: flex; align-items: flex-start; gap: 11px; padding: 9px 10px; margin: 4px 0; font-weight: 500; border: 1px solid var(--line); border-radius: 10px; overflow-wrap: anywhere; transition: background-color .2s, border-color .2s; }
.workflow-member:has(input:checked) { background: rgba(52,211,153,.08); border-color: rgba(52,211,153,.3); }
.workflow-member input[type=checkbox] { appearance: none; -webkit-appearance: none; position: relative; width: 22px; height: 22px; margin: 0; flex: none; border-radius: 7px; background: var(--fill-3); cursor: pointer; transition: background-color .25s; }
.workflow-member input[type=checkbox]::after { content: ""; position: absolute; left: 7.5px; top: 3.5px; width: 5px; height: 10px; border: solid var(--on-ok); border-width: 0 2.6px 2.6px 0; transform: rotate(45deg) scale(0); transition: transform .35s var(--spring) 60ms; }
.workflow-member input[type=checkbox]:checked { background: var(--ok); animation: cbpop .45s var(--spring); }
.workflow-member input[type=checkbox]:checked::after { transform: rotate(45deg) scale(1); }
@keyframes cbpop { 0% { transform: scale(.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
#wf-members { max-height: 260px; overflow: auto; margin-bottom: 8px; }
.workflow-preview { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); overflow-wrap: anywhere; }
.workflow-preview h4, .workflow-preview p, .workflow-preview pre { margin: 4px 0; }
.workflow-preview pre { font: inherit; white-space: pre-wrap; }
.workflow-audit { margin-top: 10px; font-size: 12px; }
.workflow-audit li { margin: 6px 0; overflow-wrap: anywhere; }
.solution-languages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 10px; }
.solution-languages:has(#wf-solution-ja-panel[hidden]) { grid-template-columns: minmax(0, 1fr); }
#wf-solution-ja-panel { padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--accent-soft); }
#wf-solution-ja-label { font-size: 13px; margin: 0 0 4px; }
#wf-solution-ja-status { margin: 4px 0; }
#wf-solution-ja-status:empty { display: none; }
#wf-solution-ja { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin: 4px 0 0; }
[data-role=support] :is(#wf-create, #wf-link, #wf-save, #wf-new-title, #wf-existing, label[for=wf-new-title], label[for=wf-existing]) { display: none; }
[data-role=support] #wf-solution { pointer-events: none; opacity: .8; }
[data-role=support] #wf-ungrouped::after { content: "等待开发将这张工单归入 Bug 组。"; display: block; margin: 8px 0; color: var(--muted); }
html[lang=ja] [data-role=support] #wf-ungrouped::after { content: "開発担当による不具合グループへの追加をお待ちください。"; }
html[lang=ja] { font-family: "Noto Sans JP", "Yu Gothic", Meiryo, system-ui, sans-serif; }

/* ---------- auth / developer / setup pages ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-panel { width: min(420px, 100%); padding: 28px; }
.auth-panel .identity { margin-bottom: 4px; }
.auth-panel h1 { margin-top: 18px; font-size: 24px; }
.auth-panel label, .dev-list label { display: block; margin: 14px 0 6px; font-weight: 650; font-size: 12.5px; }
.auth-panel input, .dev-list input { display: block; width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--fill-2); transition: border-color .2s, box-shadow .2s; }
.auth-panel input:focus, .dev-list input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.auth-panel button { margin-top: 18px; width: 100%; height: 40px; }
.auth-panel .locale-select { position: absolute; top: 24px; right: 24px; }
.auth-panel .theme-toggle { position: absolute; top: 24px; right: 112px; width: 34px; height: 34px; margin: 0; }
.dev-page .layout, .dev-page main > .layout { margin-top: 14px; }
.dev-page h1 { margin-bottom: 14px; }
.dev-list { padding: 12px; }
.dev-case { display: block; text-align: start; width: 100%; background: transparent; padding: 10px; border: 0; border-radius: 10px; margin: 2px 0; transition: background-color .2s; }
.dev-case:hover { background: var(--glass-2); }
.dev-case[aria-pressed=true] { background: linear-gradient(90deg, rgba(124,92,255,.2), rgba(34,211,238,.07)); font-weight: 700; }
.dev-page #dev-active > .insight { margin-top: 4px; }

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: no-preference) {
  .filter[open][data-pointer] .filter-menu { animation: dropdown-in .32s var(--ease-out); }
  dialog[data-pointer] { opacity: 0; transform: scale(.96); transition: opacity 220ms var(--ease-out), transform 260ms var(--spring), display 220ms, overlay 220ms; transition-behavior: allow-discrete; }
  dialog[data-pointer][open]:not([data-closing]) { opacity: 1; transform: scale(1); }
  @starting-style { dialog[data-pointer][open] { opacity: 0; transform: scale(.96); } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  body::before, body::after { display: none; }
  .topbar, .pal-dim, dialog::backdrop { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
}
body.lite, body.lite * { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
body.lite::before, body.lite::after { display: none; }
body.lite .panel, body.lite .glass { background: var(--surface); }
body.lite .mark::after, body.lite .pulse::after, body.lite tr.hot td:first-child::after, body.lite .insight::before, body.lite #conversation-status { animation: none !important; }
body.lite #conversation-status { color: var(--muted); -webkit-text-fill-color: var(--muted); background: none; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) { .stats { grid-template-columns: repeat(3, 1fr); width: 100%; } .statc { grid-column: 1 / -1; } }
@media (max-width: 800px) {
  .topbar { flex-wrap: wrap; padding-block: 8px; }
  .pal-slot, .live .scr, .staff-account .muted { display: none; }
  .live { padding: 0 5px; }
  main { padding-top: 14px; }
  h1 { font-size: 25px; }
  .seg-wrap, .segments { width: 100%; }
  .segments button { flex: 1; justify-content: center; padding-inline: 4px; font-size: 13px; }
  .seg-cap { min-width: 0; }
  .tools { justify-content: flex-start; }
  .layout { display: block; }
  .list { max-height: none; min-height: 250px; }
  .detail { display: none; }
  main[data-detail] .list, main[data-detail] .toolbar, main[data-detail] .hero { display: none; }
  main[data-detail] .detail { display: block; }
  .dev-page .detail { display: block; margin-top: 10px; }
  .back { display: inline-flex; margin-bottom: 10px; }
  th:first-child { width: 34%; } th:nth-child(2) { width: 38%; }
  td, th { padding-inline: 5px; }
  .who { display: none; }
  .solution-languages { grid-template-columns: minmax(0, 1fr); }
  .message { max-width: 100%; }
}
#reply-confirm:modal, #wf-batch-dialog:modal {
  max-inline-size: min(38rem, calc(100% - 2rem));
  max-block-size: calc(100% - 2rem);
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #d5ddeb;
  border-radius: 1rem;
  padding: 1.25rem;
  color: #17263c;
  background: #fff;
}
#reply-confirm::backdrop, #wf-batch-dialog::backdrop { background: rgb(14 28 49 / .48); overflow: hidden; overscroll-behavior: contain; }
#reply-content, #wf-batch-body { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; max-block-size: 45vh; overflow: auto; }
