:root {
  --bg: #f6f7f9; --card: #ffffff; --text: #1b1f24; --muted: #667085; --line: #e3e6ea;
  --accent: #06a85a; --accent-text: #ffffff; --warn: #b54708; --warn-bg: #fff4e5; --bad: #b42318; --ok: #067647;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171a; --card: #1d2125; --text: #e8eaed; --muted: #9aa3ad; --line: #2d333a; --accent: #1fbf75; --accent-text: #08130d; --warn: #f5b563; --warn-bg: #3a2c15; --bad: #ff8a80; --ok: #5dd39e; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", "Noto Sans Thai", "Sarabun", sans-serif; }
header { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; flex-wrap: wrap; }
header[hidden] { display: none; }
.brand { font-weight: 700; font-size: 18px; color: var(--accent); text-decoration: none; }
.spacer { flex: 1; }
main { max-width: 980px; margin: 0 auto; padding: 16px; }
h1 { font-size: 20px; margin: 4px 0 12px; }
h2 { font-size: 16px; margin: 20px 0 8px; }
.muted { color: var(--muted); font-size: 13px; }
button, select, input { font: inherit; color: inherit; }
button { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--accent); }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
select, input[type=text], input[type=password] { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.group-title { font-weight: 600; font-size: 16px; color: var(--text); text-decoration: none; }
.group-title:hover { text-decoration: underline; }
.stats { display: flex; gap: 16px; flex-wrap: wrap; margin: 6px 0 10px; font-size: 13px; color: var(--muted); }
.stats b { color: var(--text); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; border: 1px solid var(--line); }
.badge.ok { color: var(--ok); } .badge.error { color: var(--bad); border-color: var(--bad); } .badge.running { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.login { max-width: 340px; margin: 12vh auto 0; }
.login label { display: block; margin: 10px 0 4px; font-size: 13px; color: var(--muted); }
.login input { width: 100%; }
.login button { width: 100%; margin-top: 16px; padding: 9px; }
.error-text { color: var(--bad); margin-top: 10px; min-height: 1.4em; }
.tabs { display: flex; gap: 6px; margin: 12px 0; }
.tabs button[aria-pressed=true] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.summary-text { white-space: pre-wrap; margin: 6px 0; }
ul.plain { margin: 6px 0; padding-left: 20px; }
.links a, .task a { word-break: break-all; color: var(--accent); }
.task { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; }
.task.done .task-text { text-decoration: line-through; color: var(--muted); }
.task-text { font-weight: 500; }
.num { color: var(--muted); margin-right: 6px; font-variant-numeric: tabular-nums; }
.deadline.soon { color: var(--warn); font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 28px 0; }
#toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-size: 14px; max-width: 90vw; }
#toast[hidden] { display: none; }
@media (max-width: 560px) { main { padding: 12px; } .task { flex-direction: column; } }
.files { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 6px 0; }
.files .file, .card > .file { margin: 2px 0; word-break: break-word; }
.file.has-thumb { max-width: 200px; }
.thumb-link { display: block; margin-bottom: 4px; }
.thumb { display: block; max-width: 180px; max-height: 130px; width: auto; height: auto; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.file a { color: var(--accent); }
.file details { margin: 2px 0 6px 22px; }
.msg { padding: 8px 0; border-bottom: 1px solid var(--line); }
.msg:last-child { border-bottom: 0; }
.msg .summary-text { margin: 2px 0; }
.navlink { color: var(--text); text-decoration: none; padding: 6px 10px; border-radius: 8px; }
.navlink:hover { background: var(--bg); }
textarea { width: 100%; margin: 10px 0 6px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px; font: inherit; color: inherit; resize: vertical; }
textarea:disabled { opacity: .55; }
.note { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); font-size: 13px; }
label.row { margin: 12px 0 0; cursor: pointer; }
body.lb-open { overflow: hidden; }
.lightbox { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: rgba(8, 10, 12, .92); color: #fff; }
.lb-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.lb-caption { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-link { color: #fff; font-size: 13px; text-decoration: underline; white-space: nowrap; }
.lb-btn { background: rgba(255, 255, 255, .12); color: #fff; border: 0; border-radius: 999px; width: 40px; height: 40px; font-size: 22px; line-height: 1; cursor: pointer; flex: none; }
.lb-btn:hover:not(:disabled), .lb-btn:focus-visible { background: rgba(255, 255, 255, .28); }
.lb-btn[hidden] { display: none; }
.lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 4px 10px 14px; }
.lb-img { max-width: 100%; max-height: 100%; min-width: 0; object-fit: contain; border-radius: 6px; background: #fff; }
.lb-img.loading { opacity: .35; }
.lb-status { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; font-size: 14px; pointer-events: none; }
@media (max-width: 560px) { .lb-stage { gap: 4px; padding: 2px 4px 12px; } .lb-btn { width: 36px; height: 36px; } }
