:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #1d2320;
  --muted: #646d68;
  --line: #dfddd5;
  --accent: #17614d;
  --accent-ink: #ffffff;
  --accent-soft: #e2efe9;
  --danger: #a93226;
  --danger-soft: #f8e7e4;
  --radius: 8px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151917;
    --surface: #1e2421;
    --ink: #ecefed;
    --muted: #a0a9a4;
    --line: #333b37;
    --accent: #5cc4a4;
    --accent-ink: #0d1f19;
    --accent-soft: #1f3a31;
    --danger: #ef8c80;
    --danger-soft: #3d2320;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

a { color: var(--accent); }
h1 { font-size: 24px; line-height: 1.3; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }

.muted { color: var(--muted); }
.meta { color: var(--muted); font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.nav { display: flex; gap: 4px; margin-right: auto; }
.nav a, .filters a {
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
}
.nav a:hover, .filters a:hover { color: var(--ink); }
.nav a[aria-current], .filters a[aria-current] {
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 600;
}

.page { max-width: 1080px; margin: 0 auto; padding: 28px 24px 64px; }
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-bottom: 20px;
}

.tally { display: flex; gap: 20px; margin: 0; }
.tally div { display: flex; align-items: baseline; gap: 6px; }
.tally dt { color: var(--muted); font-size: 13px; }
.tally dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.button:hover { border-color: var(--muted); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button.primary:hover { filter: brightness(1.08); }
.button.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.button.quiet:hover { color: var(--ink); }
.button.danger:hover { color: var(--danger); }
.button.wide { width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.flash {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--accent-soft);
}
.flash.error { background: var(--danger-soft); color: var(--danger); }

.panel {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; }
.stack label.check { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-narrow { max-width: 560px; }
.row { display: flex; align-items: center; gap: 8px; }

input:not([type="checkbox"]), textarea, select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}
textarea { resize: vertical; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }

.employee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.employee-card {
  display: flex;
  gap: 12px;
  height: 100%;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
}
.employee-card:hover { border-color: var(--accent); }
.employee-card.paused { opacity: .65; }
.employee-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-weight: 700;
  color: #fff;
}
.avatar.large { width: 56px; height: 56px; font-size: 22px; }
.tone-0 { background: #17614d; }
.tone-1 { background: #9a5b13; }
.tone-2 { background: #2d5f8b; }
.tone-3 { background: #8a3f5c; }
.tone-4 { background: #55621f; }

.tag {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--line);
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
  vertical-align: middle;
}

.section { margin-top: 28px; min-width: 0; }
.page-head + .split .section { margin-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; }
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 0 24px;
  align-items: start;
}

.profile { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.profile-text { flex: 1 1 200px; min-width: 0; }

.details { white-space: pre-wrap; }

.task-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.task {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}
.task:first-child { border-top: 0; }
.task-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.task-main .details { margin-top: 4px; font-size: 14px; color: var(--muted); }
.task.done .task-main strong { color: var(--muted); text-decoration: line-through; font-weight: 500; }
.task-actions { display: flex; align-items: flex-start; gap: 4px; flex: none; }
.status-form select { width: 96px; }

.filters { display: flex; flex-wrap: wrap; gap: 4px; }

.task-title { color: inherit; text-decoration: none; }
.task-title:hover { text-decoration: underline; }
.run-state { font-size: 13px; font-weight: 600; }
.run-state.running { color: var(--accent); }
.run-state.ok { color: var(--accent); }
.run-state.failed { color: var(--danger); }
.run { margin-bottom: 12px; }
.run .meta { margin-bottom: 8px; }
.run .flash { margin-bottom: 0; }
.disconnect { margin-top: 8px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 0;
}
.stats dt { color: var(--muted); font-size: 13px; }
.stats dd { margin: 2px 0 0; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.table-wrap { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; border-top: 1px solid var(--line); text-align: left; font-size: 14px; }
thead th { border-top: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.usage-note { margin-top: 20px; }

.inline-form { display: inline-block; margin-left: 8px; }
.row.wrap { flex-wrap: wrap; }
.review { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: 8px; }
.split-even { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 8px; }
.article h2, .article h3 { margin: 18px 0 8px; }
.article > h2:first-child { margin-top: 0; }
.article p, .article ul { margin: 0 0 12px; }
.article ul { list-style: disc; padding-left: 20px; }
.code-line { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font-family: Consolas, Menlo, monospace; font-size: 13px; }
@media (max-width: 760px) {
  .review, .split-even { grid-template-columns: minmax(0, 1fr); }
}

.empty {
  padding: 40px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
}
.empty h2 { margin-bottom: 4px; }
.empty .button { margin-top: 14px; }
.empty.small { padding: 24px 16px; }

body.auth { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.auth-card > p { margin: 6px 0 18px; }
.auth-card .flash { margin-bottom: 14px; }

@media (max-width: 760px) {
  .topbar { padding: 10px 16px; }
  .brand { width: 100%; }
  .page { padding: 20px 16px 48px; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .task { flex-direction: column; gap: 10px; }
}

.due-list { list-style: none; margin: 8px 0 0; }
.due-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.publish-steps { margin-top: 8px; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 12px; }
.steps li { line-height: 1.8; }
