:root {
  --bg: #0b0d14;
  --bg2: #10131c;
  --panel: rgba(22, 26, 38, .72);
  --panel-solid: #161a26;
  --panel2: #1c2130;
  --line: rgba(255, 255, 255, .07);
  --line2: rgba(255, 255, 255, .12);
  --text: #e8eaf2;
  --muted: #8b91a7;
  --faint: #5b6178;
  --violet: #8b7bff;
  --cyan: #30d5c8;
  --pink: #ff6fae;
  --amber: #ffb547;
  --green: #3ddc84;
  --red: #ff5d6c;
  --blue: #4da3ff;
  --grad: linear-gradient(135deg, var(--violet), var(--cyan));
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .35);
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(900px 500px at 10% -10%, rgba(139, 123, 255, .16), transparent 60%),
    radial-gradient(800px 500px at 110% 10%, rgba(48, 213, 200, .10), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.55 "Anuphan", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-feature-settings: "tnum"; }
.err { color: var(--red); min-height: 1.4em; margin: 8px 0 0; font-size: 14px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
i[data-i] { display: inline-flex; width: 18px; height: 18px; flex: none; }
i[data-i] svg { width: 100%; height: 100%; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 22px; }
.brand b { display: block; font-size: 17px; letter-spacing: -.01em; }
.brand small { display: block; color: var(--muted); font-size: 12px; font-family: var(--mono); }
.logo {
  width: 38px; height: 38px; border-radius: 11px; background: var(--grad); position: relative; flex: none;
  box-shadow: 0 6px 24px rgba(139, 123, 255, .45);
}
.logo::after {
  content: ""; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M9 22l5-12h4l5 12h-3.6l-1-2.6h-4.8l-1 2.6zm5.6-5.4h2.8L16 12.8z' fill='white'/%3E%3C/svg%3E") center/100% no-repeat;
}
.brand.big { justify-content: center; padding-bottom: 8px; }
.brand.big .logo { width: 48px; height: 48px; border-radius: 14px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; padding: 22px 14px; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: rgba(11, 13, 20, .6); backdrop-filter: blur(16px);
}
#nav { display: flex; flex-direction: column; gap: 4px; }
#nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; color: var(--muted);
  transition: .15s; position: relative;
}
#nav a:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
#nav a.on { color: var(--text); background: linear-gradient(90deg, rgba(139, 123, 255, .18), rgba(139, 123, 255, .04)); }
#nav a.on::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--grad); }
#nav em {
  margin-left: auto; font-style: normal; font-size: 11px; font-family: var(--mono); padding: 1px 7px; border-radius: 99px;
  background: var(--violet); color: #fff;
}
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.conn { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); padding: 0 6px; }
main { padding: 28px 32px 60px; min-width: 0; max-width: 1480px; }
.page { display: none; animation: fade .25s ease; }
.page.on { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* ---------- primitives ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  backdrop-filter: blur(12px);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line2);
  background: rgba(255, 255, 255, .04); padding: 9px 16px; border-radius: 11px; cursor: pointer; transition: .15s;
  white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, .08); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--grad); border: 0; color: #fff; font-weight: 600; box-shadow: 0 6px 20px rgba(139, 123, 255, .35); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--red); border-color: rgba(255, 93, 108, .35); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn.wide { width: 100%; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(61, 220, 132, .15); }
.dot.bad { background: var(--red); box-shadow: 0 0 0 3px rgba(255, 93, 108, .15); }
.dot.busy { background: var(--violet); box-shadow: 0 0 0 0 rgba(139, 123, 255, .6); animation: pulse 1.6s infinite; }
.dot.warn { background: var(--amber); }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(139, 123, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(139, 123, 255, 0); } }
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 10px; border-radius: 99px;
  background: rgba(255, 255, 255, .06); color: var(--muted); white-space: nowrap;
}
.pill.ok { background: rgba(61, 220, 132, .12); color: var(--green); }
.pill.bad { background: rgba(255, 93, 108, .12); color: var(--red); }
.pill.busy { background: rgba(139, 123, 255, .15); color: #b9b0ff; }
.pill.warn { background: rgba(255, 181, 71, .12); color: var(--amber); }
.bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--grad); transition: width .6s ease; }
.bar.hot > span { background: linear-gradient(90deg, var(--amber), var(--red)); }
.bar.stripe > span {
  background-image: linear-gradient(135deg, rgba(255,255,255,.18) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.18) 50%, rgba(255,255,255,.18) 75%, transparent 75%), var(--grad);
  background-size: 18px 18px, 100% 100%; animation: stripe 1s linear infinite;
}
@keyframes stripe { to { background-position: 18px 0, 0 0; } }
.empty { text-align: center; color: var(--faint); padding: 28px 10px; font-size: 14px; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; }
.kpi small { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.kpi b { display: block; font-size: 28px; font-weight: 600; margin-top: 4px; font-family: var(--mono); letter-spacing: -.02em; }
.kpi b span { font-size: 14px; color: var(--muted); font-weight: 400; margin-left: 4px; font-family: "Anuphan"; }

/* ---------- overview ---------- */
.ov { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.machines { display: grid; gap: 16px; }
.machine { padding: 0; overflow: hidden; }
.machine-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.machine-icon {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: rgba(139, 123, 255, .12); color: var(--violet);
}
.machine-icon.pc { background: rgba(48, 213, 200, .12); color: var(--cyan); }
.machine-icon i { width: 22px; height: 22px; }
.machine-head h3 { font-size: 16px; }
.machine-head .meta { color: var(--muted); font-size: 13px; }
.machine-head .right { margin-left: auto; display: flex; gap: 14px; align-items: center; }
.mini-stat { text-align: right; font-size: 12px; color: var(--muted); min-width: 92px; }
.mini-stat b { display: block; font-family: var(--mono); color: var(--text); font-size: 13px; font-weight: 600; }
.mini-stat .bar { margin-top: 5px; height: 4px; }
.gpus { display: grid; grid-template-columns: 1fr 1fr; }
.gpu { padding: 16px 18px; border-right: 1px solid var(--line); min-width: 0; }
.gpu:last-child { border-right: 0; }
.gpu-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.gpu-top b { font-size: 14px; }
.gpu-top small { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 14px; }
.meter small { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.meter small b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.ai-list { display: flex; flex-direction: column; gap: 8px; }
.ai {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 11px; background: rgba(255, 255, 255, .03);
  border: 1px solid var(--line); font-size: 13px; min-width: 0;
}
.ai.busy { border-color: rgba(139, 123, 255, .4); background: linear-gradient(90deg, rgba(139, 123, 255, .14), rgba(139, 123, 255, .03)); }
.ai.off { opacity: .55; }
.ai .t { min-width: 0; flex: 1; }
.ai .t b { display: block; font-weight: 500; }
.ai .t span { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mac-body { padding: 16px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.future {
  border: 1px dashed var(--line2); border-radius: var(--radius); padding: 16px 18px; display: flex; gap: 14px;
  align-items: center; color: var(--muted); font-size: 13px;
}
.future .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.flow-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.flow-line .pill { background: rgba(255, 255, 255, .05); }
.flow-line .arr { color: var(--faint); }

/* job rows */
.jobs-list { display: flex; flex-direction: column; gap: 8px; }
.job {
  display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px;
  border-radius: 13px; background: rgba(255, 255, 255, .025); border: 1px solid var(--line); cursor: pointer; transition: .15s;
}
.job:hover { background: rgba(255, 255, 255, .05); border-color: var(--line2); }
.job-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; }
.job-ic i { width: 19px; height: 19px; }
.job .t { min-width: 0; }
.job .t b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job .t span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job .bar { margin-top: 7px; height: 4px; }
.job .r { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.job .r small { font-size: 11px; color: var(--faint); font-family: var(--mono); }

/* timeline */
.tl { display: flex; flex-direction: column; }
.tl-row { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; padding: 7px 0; font-size: 13px; border-bottom: 1px solid var(--line); }
.tl-row:last-child { border-bottom: 0; }
.tl-row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-row small { color: var(--faint); font-family: var(--mono); font-size: 11px; }

/* ---------- create ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.tile {
  text-align: left; padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); cursor: pointer;
  background: var(--panel); transition: .2s; position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px;
}
.tile::after {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: .2s; pointer-events: none;
  background: radial-gradient(400px 160px at 0 0, var(--c, var(--violet)), transparent 70%);
}
.tile:hover { transform: translateY(-2px); border-color: var(--line2); }
.tile:hover::after { opacity: .12; }
.tile.on { border-color: var(--c); box-shadow: 0 0 0 1px var(--c) inset; }
.tile.on::after { opacity: .16; }
.tile-ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; }
.tile-ic i { width: 22px; height: 22px; }
.tile b { font-size: 15px; font-weight: 600; }
.tile p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.tile .flow-line { margin-top: auto; }
.form-card { margin-top: 18px; scroll-margin-top: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; color: var(--muted); }
.field input[type=text], .field input[type=number], .field select, .field textarea {
  background: rgba(0, 0, 0, .25); border: 1px solid var(--line2); border-radius: 11px; padding: 10px 12px;
  outline: none; transition: .15s; width: 100%;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139, 123, 255, .18); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; padding: 6px 0; }
.check input { width: 18px; height: 18px; accent-color: var(--violet); }
.drop {
  border: 1px dashed var(--line2); border-radius: 12px; padding: 16px; text-align: center; color: var(--muted);
  cursor: pointer; font-size: 13px; transition: .15s;
}
.drop:hover { border-color: var(--violet); color: var(--text); }
.drop img { max-height: 160px; max-width: 100%; border-radius: 8px; display: block; margin: 0 auto 8px; }
/* คลังพรีเซนเตอร์ (วิดีโอโฆษณา) */
.pres-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.pres-card {
  display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 6px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line2); background: rgba(255, 255, 255, .03); color: var(--text); text-align: left; font: inherit; transition: .15s;
}
.pres-card:hover { border-color: var(--violet); }
.pres-card.on { border-color: var(--violet); box-shadow: 0 0 0 2px var(--violet); background: rgba(139, 123, 255, .1); }
.pres-card img, .pres-card .pres-ph { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; display: grid; place-items: center; background: rgba(0, 0, 0, .25); color: var(--muted); font-size: 12px; text-align: center; }
.pres-card .pres-ph i { width: 26px; height: 26px; }
.pres-card b { font-weight: 500; font-size: 13px; padding: 2px 2px 0; }
.pres-card small { color: var(--muted); font-size: 11px; padding: 0 2px 2px; line-height: 1.35; }
.pres-card.wait { cursor: default; opacity: .75; }
.pres-card.new, .pres-card.ai { border-style: dashed; }
.pres-outfits { margin-top: 12px; }
.pres-sub { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.pres-orow { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pres-outfit {
  display: flex; flex-direction: column; gap: 4px; padding: 5px; border-radius: 10px; border: 1px solid var(--line2); cursor: pointer;
  background: rgba(255, 255, 255, .03); color: var(--text); font: inherit; font-size: 12px; text-align: center;
}
.pres-outfit img, .pres-outfit .pres-ph { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 7px; display: grid; place-items: center; background: rgba(0, 0, 0, .25); color: var(--muted); font-size: 11px; }
.pres-outfit.on { border-color: var(--violet); box-shadow: 0 0 0 2px var(--violet); }
.pres-outfit.add { border-style: dashed; color: var(--muted); }
.pres-outfit.wait { cursor: default; opacity: .75; }
.pres-addrow { display: flex; gap: 8px; margin-top: 8px; }
.pres-addrow[hidden], .pres-new[hidden], .pres-outfits[hidden] { display: none; }
.pres-addrow input { flex: 1; }
.pres-new { margin-top: 12px; padding: 12px; border: 1px dashed var(--line2); border-radius: 12px; display: grid; gap: 10px; }
.pres-new label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.pres-newgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.pres-new input, .pres-new select, .pres-new textarea, .pres-addrow input {
  font: inherit; font-size: 14px; color: var(--text); background: rgba(0, 0, 0, .25); border: 1px solid var(--line2); border-radius: 9px; padding: 8px 10px; outline: none;
}
.pres-new textarea { resize: vertical; }
@media (max-width: 760px) {  /* มือถือ: 3 คอลัมน์ ไม่ต้องเลื่อนยาว */
  .pres-grid, .pres-orow { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .pres-card { padding: 4px; }
  .pres-card small { font-size: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .pres-outfit { font-size: 11px; padding: 4px; }
}
.drop.multi { padding: 12px; }
.drop .thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.drop .thumbs:not(:empty) { margin-bottom: 10px; }
.drop .thumb { position: relative; width: 84px; height: 84px; border-radius: 9px; overflow: hidden; border: 1px solid var(--line2); cursor: default; }
.drop .thumb img { width: 100%; height: 100%; object-fit: cover; max-height: none; margin: 0; border-radius: 0; }
.drop .thumb b { position: absolute; left: 4px; top: 4px; font-size: 11px; background: rgba(0, 0, 0, .65); color: #fff; border-radius: 6px; padding: 1px 6px; }
.drop .thumb button { position: absolute; right: 4px; top: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .7); color: #fff; cursor: pointer; font-size: 15px; line-height: 22px; padding: 0; }
.drop .add { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 4px 0; }
.drop .add[hidden] { display: none; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.form-foot .eta { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }

/* ---------- jobs page ---------- */
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { border: 1px solid var(--line); background: none; padding: 6px 13px; border-radius: 99px; cursor: pointer; color: var(--muted); font-size: 13px; }
.filters button.on { background: rgba(139, 123, 255, .16); color: var(--text); border-color: rgba(139, 123, 255, .4); }

/* drawer */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer-bg { position: absolute; inset: 0; background: rgba(4, 5, 10, .55); backdrop-filter: blur(3px); animation: fade .2s; }
.drawer-panel {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(720px, 100%); background: var(--bg2);
  border-left: 1px solid var(--line2); overflow-y: auto; padding: 24px; animation: slide .25s ease; box-shadow: var(--shadow);
}
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-panel {
  padding-top: calc(env(safe-area-inset-top, 0px) + 20px);
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  overscroll-behavior: contain;
}
/* หัวแผงติดด้านบนตลอด (ปุ่มกลับกดได้เสมอ) และกินพื้นที่แถบสถานะของ iPhone ไว้ ไม่ให้ปุ่มไปชนนาฬิกา/แบต */
.d-head {
  display: flex; align-items: flex-start; gap: 14px; position: sticky; z-index: 5;
  top: calc(-1 * (env(safe-area-inset-top, 0px) + 20px)); /* sticky นับจากขอบ padding -> ดึงขึ้นไปชิดขอบจอ */
  margin: calc(-1 * (env(safe-area-inset-top, 0px) + 20px)) -24px 18px;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 24px 12px;
  background: rgba(16, 19, 28, .92); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line);
}
.d-close { flex: none; }
.d-close span { display: none; }
.d-head h2 { font-size: 20px; line-height: 1.35; word-break: break-word; }
.d-head .x { margin-left: auto; }
.d-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.d-meta div { background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.d-meta small { display: block; color: var(--muted); font-size: 12px; }
.d-meta b { font-weight: 500; font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.outs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.out { background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.out.wide { grid-column: 1 / -1; }
.out img, .out video { width: 100%; display: block; background: #000; }
.out img { cursor: zoom-in; aspect-ratio: auto; }
.out audio { width: 100%; display: block; }
.out-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; font-size: 13px; }
.out-foot a { color: var(--muted); display: inline-flex; }
.out-foot a:hover { color: var(--text); }
.md { padding: 14px 18px; font-size: 14px; line-height: 1.7; max-height: 520px; overflow: auto; }
.md h1 { font-size: 20px; margin: 4px 0 10px; }
.md h2 { font-size: 17px; margin: 18px 0 8px; }
.md h3 { font-size: 15px; margin: 14px 0 6px; }
.md table { border-collapse: collapse; width: 100%; font-size: 13px; }
.md th, .md td { border: 1px solid var(--line2); padding: 6px 8px; text-align: left; vertical-align: top; }
.md blockquote { margin: 8px 0; padding: 4px 14px; border-left: 3px solid var(--violet); color: var(--muted); }
.md code { font-family: var(--mono); font-size: 12.5px; background: rgba(255, 255, 255, .06); padding: 1px 5px; border-radius: 5px; }
pre.json { margin: 0; padding: 14px; font: 12px/1.5 var(--mono); max-height: 360px; overflow: auto; color: #c9cde0; }
.log { background: #07080d; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font: 12px/1.6 var(--mono); color: #aab0c6; max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.section-t { font-size: 13px; color: var(--muted); margin: 20px 0 10px; text-transform: none; display: flex; align-items: center; gap: 8px; }

/* ---------- library ---------- */
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.lib-card { padding: 0; overflow: hidden; cursor: pointer; transition: .2s; }
.lib-card:hover { transform: translateY(-2px); border-color: var(--line2); }
.thumb { aspect-ratio: 16 / 9; background: #07080d center/cover no-repeat; position: relative; }
.thumb .play {
  position: absolute; inset: 0; margin: auto; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0, 0, 0, .45); backdrop-filter: blur(6px); border: 1px solid rgba(255, 255, 255, .25);
}
.thumb .play i { width: 22px; height: 22px; margin-left: 3px; }
.thumb .tag { position: absolute; left: 10px; top: 10px; }
.lib-card .body { padding: 12px 14px; }
.lib-card .body b { display: block; font-weight: 500; font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lib-card .body small { color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 4px; background: rgba(255, 255, 255, .04); padding: 4px; border-radius: 12px; border: 1px solid var(--line); }
.tabs button { background: none; border: 0; padding: 7px 14px; border-radius: 9px; cursor: pointer; color: var(--muted); font-size: 14px; }
.tabs button.on { background: rgba(255, 255, 255, .09); color: var(--text); }

/* ---------- downloads & selection ---------- */
.out-foot span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.dl { padding: 5px 10px; flex: none; }
.btn.dl:empty, .btn.dl i:only-child { gap: 0; }
.lib-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; font-size: 14px; }
.outs-wide { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.outs-sm { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sel-item { position: relative; transition: .15s; }
.sel-check {
  display: none; position: absolute; top: 8px; left: 8px; z-index: 2; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .85); background: rgba(0, 0, 0, .45); color: #fff; place-items: center; padding: 3px;
}
.sel-mode .sel-check { display: grid; }
.sel-mode .sel-item { cursor: pointer; }
.sel-mode .sel-item video, .sel-mode .sel-item audio { pointer-events: none; }
.sel-item.selected { border-color: var(--violet); box-shadow: 0 0 0 2px var(--violet); }
.sel-item.selected .sel-check { background: var(--violet); border-color: var(--violet); }
.selbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 60; width: min(560px, calc(100% - 32px));
  display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 18px; border-radius: 16px;
  background: var(--panel-solid); border: 1px solid rgba(139, 123, 255, .45); box-shadow: var(--shadow); animation: fade .2s;
}
.thumb-dl {
  position: absolute; right: 10px; bottom: 10px; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: rgba(0, 0, 0, .55); backdrop-filter: blur(6px); border: 1px solid rgba(255, 255, 255, .2); color: #fff; transition: .15s;
}
.thumb-dl:hover { background: var(--violet); }
/* เลขประจำคลิป + ใช้ได้/ใช้ไม่ได้/คอมเมนต์ใต้ผลงาน */
.clip-num {
  position: absolute; right: 8px; top: 8px; z-index: 3; pointer-events: none; font: 700 13px/1 var(--mono, monospace);
  padding: 5px 8px; border-radius: 8px; background: rgba(0, 0, 0, .72); color: #fff; border: 1px solid rgba(255, 255, 255, .25);
}
.clip-num.good { background: rgba(26, 140, 80, .9); border-color: var(--green); }
.clip-num.bad { background: rgba(170, 30, 45, .9); border-color: var(--red); }
.clip-num.mixed { background: rgba(170, 120, 20, .9); border-color: #ffb547; }
.thumb .clip-num { top: auto; bottom: 10px; right: auto; left: 10px; }
.note-box { padding: 8px 10px 10px; border-top: 1px solid var(--line); cursor: default; }
.note-row { display: flex; gap: 6px; flex-wrap: wrap; }
.note-v, .note-c {
  display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line2); background: none; color: var(--muted);
  border-radius: 99px; padding: 4px 10px; font-size: 12px; cursor: pointer; transition: .15s;
}
.note-v i, .note-c i { width: 13px; height: 13px; }
.note-v:hover, .note-c:hover { color: var(--text); border-color: var(--violet); }
.note-v.good.on { background: rgba(61, 220, 132, .16); color: var(--green); border-color: rgba(61, 220, 132, .55); }
.note-v.bad.on { background: rgba(255, 93, 108, .16); color: var(--red); border-color: rgba(255, 93, 108, .55); }
.note-c.has { color: var(--text); }
.note-body { margin-top: 8px; display: grid; gap: 6px; }
.note-body[hidden] { display: none; }
.note-item { display: flex; gap: 8px; align-items: baseline; font-size: 13px; background: rgba(255, 255, 255, .04); border-radius: 8px; padding: 6px 8px; }
.note-item span { flex: 1; white-space: pre-wrap; word-break: break-word; }
.note-item small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.note-item button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 0 2px; }
.note-item button:hover { color: var(--red); }
.note-add { display: flex; gap: 6px; align-items: flex-end; }
.note-add textarea {
  flex: 1; min-height: 40px; resize: vertical; font: inherit; font-size: 13px; color: var(--text); background: rgba(0, 0, 0, .25);
  border: 1px solid var(--line2); border-radius: 9px; padding: 7px 9px; outline: none;
}
.note-add textarea:focus { border-color: var(--violet); }
.ads-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.ad-card video { aspect-ratio: 9 / 16; object-fit: contain; max-height: 72vh; }
.ad-card .ad-wait { aspect-ratio: 9 / 16; display: grid; place-items: center; padding: 12px; text-align: center; max-height: 72vh; }
.ad-title { min-width: 0; display: grid; }
.ad-title b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb-dl i { width: 17px; height: 17px; }
.lb-bar { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: flex; gap: 8px; }
.lb-bar .btn { background: rgba(20, 22, 32, .85); backdrop-filter: blur(8px); }

/* ---------- automation ---------- */
.auto { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.wf { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.wf:last-child { border-bottom: 0; }
.wf-no { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .05); font-family: var(--mono); font-size: 13px; color: var(--muted); flex: none; }
.wf .t { flex: 1; min-width: 0; }
.wf .t b { display: block; font-weight: 500; font-size: 14px; }
.wf .t span { font-size: 12px; color: var(--muted); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--faint); font-weight: 500; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
.topic-list { max-height: 380px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.topic { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, .03); font-size: 14px; }
.topic span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row input[type=text], .row input[type=number], .row select {
  background: rgba(0, 0, 0, .25); border: 1px solid var(--line2); border-radius: 10px; padding: 8px 12px; outline: none; min-width: 0;
}
.row input[type=text] { flex: 1; }

/* ---------- auth ---------- */
.auth { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; }
.auth-card {
  width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line2); border-radius: 22px; padding: 30px 26px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); backdrop-filter: blur(16px); text-align: center;
}
.auth-card h2 { margin-top: 8px; }
.auth-card p { margin: 0; font-size: 14px; }
.auth-card input { background: rgba(0, 0, 0, .3); border: 1px solid var(--line2); border-radius: 12px; padding: 12px 14px; outline: none; text-align: center; }
.auth-card input:focus { border-color: var(--violet); }

/* ---------- toasts / lightbox ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel-solid); border: 1px solid var(--line2); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow);
  font-size: 14px; animation: slide .25s; display: flex; gap: 10px; align-items: center; max-width: 360px;
}
.toast.err { border-color: rgba(255, 93, 108, .5); }
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, .9); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .ov, .auto { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 40; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--line2); background: rgba(11, 13, 20, .92);
  }
  .side .brand, .side-foot { display: none; }
  #nav { flex-direction: row; justify-content: space-around; }
  #nav a { flex-direction: column; gap: 3px; font-size: 11px; padding: 7px 4px; flex: 1; }
  #nav a.on::before { left: 30%; right: 30%; top: -7px; bottom: auto; width: auto; height: 3px; }
  #nav em { position: absolute; top: 2px; right: 18%; margin: 0; }
  main { padding: 18px 16px calc(96px + env(safe-area-inset-bottom)); }
  h1 { font-size: 22px; }
  .gpus, .mac-body, .form-grid { grid-template-columns: 1fr; }
  .gpu { border-right: 0; border-bottom: 1px solid var(--line); }
  .gpu:last-child { border-bottom: 0; }
  .machine-head { flex-wrap: wrap; }
  .machine-head .right { margin-left: 0; width: 100%; justify-content: space-between; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 14px; }
  .tile p, .tile .flow-line { display: none; }
  .d-meta { grid-template-columns: 1fr 1fr; }
  .drawer-panel { padding-left: 16px; padding-right: 16px; }
  .d-head { margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
  .d-head h2 { font-size: 17px; }
  .d-close { min-height: 44px; min-width: 44px; padding: 8px 14px; font-size: 15px; }
  .d-close span { display: inline; }
  main { padding-top: calc(18px + env(safe-area-inset-top, 0px)); }
  .toasts { left: 16px; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); }
  .selbar { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .outs-wide { grid-template-columns: 1fr; }
  .outs-sm { grid-template-columns: 1fr 1fr; }
  .kpi b { font-size: 22px; }
}

/* n8n ล่าสุด: ซ้าย = งานผลิต/งานเว็บ, ขวา = 04 เช็คเครื่อง (แบ่งซ้ายขวาทุกขนาดจอ) */
.tl-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tl-split > div { min-width: 0; }
.tl-split > div + div { border-left: 1px solid var(--line); padding-left: 16px; }
.tl-split h3 { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tl-split .tl-row { grid-template-columns: 10px 1fr; grid-template-rows: auto auto; row-gap: 2px; column-gap: 8px; }
.tl-split .tl-row .dot { grid-row: 1 / span 2; }
.tl-split .tl-row small { grid-column: 2; }
@media (max-width: 760px) {
  .tl-split { gap: 10px; }
  .tl-split > div + div { padding-left: 10px; }
}

/* ---------- series -> episode videos ---------- */
.ep-opts { display: flex; flex-direction: column; gap: 14px; margin-bottom: 12px; }
.ep-row { display: flex; flex-direction: column; gap: 7px; }
.ep-row > label { font-size: 13px; color: var(--muted); }
.ep-inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.ep-inline input[type=number] {
  width: 70px; margin-left: 8px; background: rgba(0, 0, 0, .25); border: 1px solid var(--line2); border-radius: 9px; padding: 6px 8px; outline: none;
}
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  flex: 1 1 0; min-width: 96px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 10px;
  border-radius: 11px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .03); cursor: pointer; font-size: 14px; transition: .15s;
}
.seg button small { color: var(--faint); font-size: 11px; }
.seg button:hover { background: rgba(255, 255, 255, .07); }
.seg button.on { border-color: var(--pink); background: rgba(255, 111, 174, .12); box-shadow: 0 0 0 1px var(--pink) inset; }
.seg button.on small { color: var(--muted); }
.ar { display: inline-block; border: 2px solid currentColor; border-radius: 3px; margin-bottom: 3px; opacity: .8; }
.ar-h { width: 26px; height: 15px; }
.ar-v { width: 13px; height: 22px; }
.ep-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ep-foot .eta { color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.ep-list { display: flex; flex-direction: column; gap: 8px; }
.ep { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 13px; background: rgba(255, 255, 255, .025); border: 1px solid var(--line); }
.ep-no { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 111, 174, .14); color: var(--pink); font-family: var(--mono); font-weight: 600; }
.ep .t { min-width: 0; }
.ep .t b { display: block; font-weight: 500; font-size: 14px; }
.ep .t span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; color: var(--muted); }
.ep .bar { margin-top: 6px; height: 4px; }
.ep-act { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 760px) {
  .ep { grid-template-columns: 30px 1fr; }
  .ep-act { grid-column: 1 / -1; justify-content: flex-start; }
  .seg button { min-width: 0; }
}

/* ---------- settings ---------- */
.prov input[type=password] {
  background: rgba(0, 0, 0, .25); border: 1px solid var(--line2); border-radius: 11px; padding: 10px 12px; outline: none; width: 100%;
  font-family: var(--mono); font-size: 13px;
}
.prov input[type=password]:focus { border-color: var(--violet); }
.prov .field label { display: flex; justify-content: space-between; gap: 8px; }
.test-res { font-size: 13px; }
.test-res.ok { color: var(--green); }
.test-res.bad { color: var(--red); }
.usage { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.usage small { display: block; color: var(--muted); font-size: 12px; }
.usage b { font-family: var(--mono); font-size: 22px; }
.usage .bar { margin-top: 6px; }
.engine-pick select { border-color: rgba(48, 213, 200, .35); }
@media (max-width: 760px) { #nav a span { font-size: 10px; } }
.ep-engines { grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ep-engines select { background: rgba(0, 0, 0, .25); border: 1px solid var(--line2); border-radius: 10px; padding: 8px 10px; width: 100%; outline: none; }
@media (max-width: 760px) { .ep-engines { grid-template-columns: 1fr; } }
/* แท็บคลังผลงาน: บนมือถือเลื่อนซ้าย-ขวาได้ ไม่ล้นขอบจอ */
.tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; white-space: nowrap; }
@media (max-width: 760px) { .page-head .tabs { width: 100%; } }

/* ---------- ฟอร์ม: คำแนะนำ / ค่าจากงานเดิม / prompt ช่องใหญ่ ---------- */
.field .hint { color: var(--faint); font-size: 12px; line-height: 1.4; }
.field textarea.big { min-height: 150px; font-size: 15px; }
.prefill-note {
  display: flex; align-items: center; gap: 8px; margin: -4px 0 14px; padding: 9px 12px; border-radius: 10px; font-size: 13px;
  background: rgba(139, 123, 255, .12); border: 1px solid rgba(139, 123, 255, .3); color: #cfc8ff;
}
.drop i[data-i] { vertical-align: -3px; }

/* ---------- prompt ที่ใช้สร้างงาน ---------- */
.prompts { padding: 14px 16px; }
.prompts .phead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.prompts .phead b { font-weight: 600; font-size: 14px; }
.prows { display: flex; flex-direction: column; gap: 6px; }
.prow { display: grid; grid-template-columns: 150px 1fr; gap: 10px; font-size: 13px; align-items: start; }
.prow > span { color: var(--muted); }
.prow > div { min-width: 0; display: flex; gap: 6px; align-items: flex-start; }
.prow.long > div { flex-direction: column; }
.prompts pre {
  margin: 0; white-space: pre-wrap; word-break: break-word; font: 12.5px/1.55 var(--mono); color: #d3d7e6;
  background: rgba(0, 0, 0, .28); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; width: 100%;
  max-height: 260px; overflow: auto; user-select: text; -webkit-user-select: text;
}
.prompts details { margin-top: 12px; }
.prompts details > summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.plist { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.pitem { border-top: 1px solid var(--line); padding-top: 10px; }
.pitem .phead { margin-bottom: 2px; }
.pitem .phead b { font-size: 13px; font-weight: 500; flex: 1; }
.pitem small { display: block; font-size: 11.5px; margin-bottom: 6px; word-break: break-word; }
.btn.copy { padding: 4px 8px; gap: 4px; font-size: 12px; }
.btn.copy i { width: 15px; height: 15px; }
@media (max-width: 760px) { .prow { grid-template-columns: 1fr; gap: 3px; } }

/* ---------- พื้นที่ดิสก์ ---------- */
.disk-alert {
  display: flex; align-items: center; gap: 10px; margin: 0 0 16px; padding: 12px 16px; border-radius: 13px; font-size: 14px;
  background: rgba(255, 93, 108, .12); border: 1px solid rgba(255, 93, 108, .45); color: #ffc2c8;
}
.disk-alert i { color: var(--red); flex: none; }
.disk-m { padding: 10px 0; border-bottom: 1px solid var(--line); }
.disk-m:last-of-type { border-bottom: 0; }
.disk-mname { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.drive { margin: 8px 0; }
.drive-top { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 5px; flex-wrap: wrap; }
.drive-top .faint { font-size: 12px; flex: 1; min-width: 0; }
.drive .bar { height: 7px; }
.drive.warn .bar > span { background: linear-gradient(90deg, var(--amber), #ffcf7a); }
.drive-sub { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 5px; flex-wrap: wrap; }
.drive-sub b { color: var(--text); font-weight: 600; }
.drive-folders { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.t-bad { color: var(--red) !important; }
.t-warn { color: var(--amber) !important; }

/* ตัวละครประจำ (วิดีโอเด็กเล่าเรื่อง) */
.cast-pick-wrap { display: flex; flex-direction: column; gap: 8px; }
.cast-thumbs { display: flex; align-items: center; gap: 10px; min-height: 0; font-size: 13px; color: var(--muted, #9aa0b4); }
.cast-thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 12px; background: #fff; }

/* ระบบสมาชิก (webapp/members.py) */
.me-badge { display: grid; gap: 1px; text-align: left; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 10px; color: var(--text); font: inherit; cursor: pointer; }
.me-badge:hover { border-color: var(--violet); }
.me-badge b { font-size: 13px; font-weight: 600; }
.me-badge small { font-size: 11px; color: var(--muted); }
.note-v b { margin-left: 2px; }
.note-who { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.note-who .good { color: var(--green); }
.note-who .bad { color: var(--red); }
.note-item b { flex: none; font-size: 12px; color: var(--violet); }
.lib-filter { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -6px 0 14px; }
.lib-filter[hidden] { display: none; }
.lib-filter button { font: inherit; font-size: 12.5px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line2);
  background: transparent; color: var(--muted); cursor: pointer; }
.lib-filter button.on { background: var(--violet); border-color: var(--violet); color: #fff; }
.lib-filter .muted { font-size: 12px; margin-left: 4px; }
.lib-card[hidden], .outs > .out[hidden] { display: none; }
#page-members .card { margin-bottom: 16px; }
.mem-list { display: grid; gap: 8px; }
.mem { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 12px; background: rgba(255, 255, 255, .02); }
.mem.off { opacity: .55; }
.mem-who { display: grid; gap: 2px; min-width: 0; }
.mem-who b { font-weight: 600; }
.mem-who small { font-size: 12px; color: var(--muted); }
.mem select { font: inherit; font-size: 13px; color: var(--text); background: rgba(0, 0, 0, .25); border: 1px solid var(--line2);
  border-radius: 9px; padding: 6px 8px; }
.mem-act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.btn.danger { color: var(--red); }
.inv-out { margin-top: 12px; display: grid; gap: 6px; }
.inv-out .row { display: flex; gap: 6px; }
.inv-out input { flex: 1; min-width: 0; font: inherit; font-size: 13px; color: var(--text); background: rgba(0, 0, 0, .25);
  border: 1px solid var(--line2); border-radius: 9px; padding: 7px 10px; }
#inv-role { font: inherit; color: var(--text); background: rgba(0, 0, 0, .25); border: 1px solid var(--line2); border-radius: 9px; padding: 8px 10px; }
.lightbox.acct { cursor: default; }
.acct-card { width: min(420px, 100%); display: grid; gap: 10px; cursor: default; }
.acct-card input { font: inherit; color: var(--text); background: rgba(0, 0, 0, .25); border: 1px solid var(--line2); border-radius: 9px; padding: 9px 11px; }
@media (max-width: 760px) {
  .mem { grid-template-columns: 1fr; }
  .mem-act { justify-content: flex-start; }
}
