/* 任务配置台的样式。
   配色取自这个游戏的海岛主题：暖沙底、深海绿作唯一强调色。
   强调色只用在三处——当前选中项、启用开关、主按钮，别的地方一律留白。 */

:root {
  --bg:        #f7f5f1;
  --panel:     #fffefc;
  --panel-2:   #f2efe9;
  --input:     #ffffff;
  --line:      #e6e1d8;
  --line-soft: #efebe4;
  --ink:       #1f1e1b;
  --ink-2:     #56524a;
  --muted:     #8b857a;
  --accent:    #1f6b55;
  --accent-2:  #e6f1ec;
  --accent-ink:#ffffff;
  --ok:        #1f6b55;
  --warn:      #8a5a12;
  --err:       #a33a30;
  --r:   10px;
  --r-sm: 7px;
  --shadow: 0 1px 2px rgba(31,30,27,.04), 0 1px 1px rgba(31,30,27,.03);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #141416;
    --panel:     #1c1c1f;
    --panel-2:   #232327;
    --input:     #121214;
    --line:      #2e2e33;
    --line-soft: #26262a;
    --ink:       #ece9e3;
    --ink-2:     #b5b0a7;
    --muted:     #858077;
    --accent:    #5fbf97;
    --accent-2:  #17302a;
    --accent-ink:#0f221b;
    --ok:        #5fbf97;
    --warn:      #d9a05b;
    --err:       #e08b82;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  --bg:#141416; --panel:#1c1c1f; --panel-2:#232327; --input:#121214; --line:#2e2e33;
  --line-soft:#26262a; --ink:#ece9e3; --ink-2:#b5b0a7; --muted:#858077;
  --accent:#5fbf97; --accent-2:#17302a; --accent-ink:#0f221b;
  --ok:#5fbf97; --warn:#d9a05b; --err:#e08b82;
  --shadow: 0 1px 2px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI",
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.grow { flex: 1; }
.mono, code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: .88em;
}

/* ───────── 登录 ───────── */

.login { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
.login form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px 30px;
  width: 100%; max-width: 380px;
}
.login h1 {
  margin: 0 0 6px; font-size: 21px; font-weight: 650; letter-spacing: -.01em;
}
.login .hint { color: var(--muted); font-size: 13.5px; margin: 0 0 20px; }
.login input { width: 100%; }
.login button { width: 100%; margin-top: 14px; }

/* ───────── 框架 ───────── */

header {
  display: flex; align-items: center; gap: 14px;
  height: 56px; padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand {
  font-weight: 650; letter-spacing: -.01em; white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}
.brand::before { content: "⚓"; font-size: 15px; opacity: .8; }

header select {
  max-width: 200px; padding: 5px 28px 5px 10px; font-size: 14px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  appearance: none;
}

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px; border-radius: 999px;
  background: var(--panel-2); color: var(--ink-2);
  font-size: 12.5px; white-space: nowrap;
}
.pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted); flex: none;
}
.pill.running { background: var(--accent-2); color: var(--accent); }
.pill.running::before { background: var(--ok); }
.pill.error { background: color-mix(in srgb, var(--err) 12%, transparent); color: var(--err); }
.pill.error::before { background: var(--err); }

main { display: grid; grid-template-columns: 248px minmax(0, 1fr); align-items: start; }

/* ───────── 任务列表 ───────── */

nav {
  border-right: 1px solid var(--line);
  height: calc(100vh - 56px); position: sticky; top: 56px;
  overflow-y: auto; padding: 8px 0 24px;
  background: var(--panel);
}
.group {
  padding: 16px 20px 6px; font-size: 11px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: .07em;
}
.item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 7px 20px;
  border: 0; border-left: 2px solid transparent; background: none;
  color: var(--ink-2); font: inherit; font-size: 14.5px;
  text-align: left; cursor: pointer;
}
.item:hover { background: var(--panel-2); color: var(--ink); }
.item[aria-current="true"] {
  background: var(--accent-2); border-left-color: var(--accent);
  color: var(--ink); font-weight: 600;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line); flex: none; }
.item[aria-current="true"] .dot,
.item:hover .dot { background: color-mix(in srgb, var(--muted) 60%, transparent); }
.dot.on, .item .dot.on { background: var(--ok); box-shadow: 0 0 0 2.5px var(--accent-2); }
.item .name { white-space: nowrap; }
.item .key {
  margin-left: auto; min-width: 0; font-size: 11px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .75;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ───────── 详情 ───────── */

section#detail { padding: 28px 40px 72px; }
/* 内容列有自己的宽度上限并居中：正文超过 ~75 字就不好读了，
   而侧栏是贴边的，不居中的话宽屏上内容会全堆在左边。 */
.sheet { max-width: 720px; margin: 0 auto; }
.empty { color: var(--muted); }

.head { margin-bottom: 22px; }
.head h2 { margin: 0 0 4px; font-size: 22px; font-weight: 650; letter-spacing: -.015em; }
.head .desc { color: var(--ink-2); margin: 0; font-size: 14.5px; }
.head .tag {
  display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 5px;
  background: var(--panel-2); color: var(--muted); font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  vertical-align: 3px; font-weight: 400;
}

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow);
  padding: 4px 20px; margin-bottom: 16px;
}
.card > .card-title {
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  padding: 16px 0 4px;
}

.field { padding: 14px 0; border-top: 1px solid var(--line-soft); }
.card > .card-title + .field,
.card > .field:first-child { border-top: 0; }
.field > label { display: block; font-weight: 550; margin-bottom: 3px; font-size: 14.5px; }
.field label.param {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13.5px; font-weight: 600;
}
.field .note { color: var(--muted); font-size: 13px; margin: 0 0 9px; line-height: 1.5; }
.field .note:last-child { margin-bottom: 0; }

/* 开关行：控件在右，说明在左，视线不用来回跳 */
.field.switch { display: flex; align-items: flex-start; gap: 16px; }
.field.switch .body { flex: 1; min-width: 0; }
.field.switch .body .note { margin-bottom: 0; }

.toggle { position: relative; flex: none; width: 40px; height: 23px; margin-top: 2px; }
.toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.toggle .track {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--line); transition: background .15s ease; pointer-events: none;
}
.toggle .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 17px; height: 17px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s ease;
}
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(17px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

input[type=text], input[type=number], input[type=password], select, textarea {
  width: 100%; padding: 8px 11px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--input); color: var(--ink);
  font: inherit; font-size: 14px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }
input:hover:not(:disabled), textarea:hover, select:hover { border-color: var(--muted); }
input:disabled { background: var(--panel-2); color: var(--muted); }
textarea {
  min-height: 78px; resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.field.narrow input { max-width: 200px; }

button {
  padding: 8px 18px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: var(--accent); color: var(--accent-ink);
  font: inherit; font-size: 14px; font-weight: 550; cursor: pointer;
  transition: filter .12s ease;
}
button:hover:not(:disabled) { filter: brightness(1.08); }
button.ghost {
  background: none; color: var(--ink-2); border-color: var(--line);
}
button.ghost:hover:not(:disabled) { background: var(--panel-2); filter: none; }
button:disabled { opacity: .45; cursor: default; }

.actions {
  display: flex; gap: 12px; align-items: center;
  margin-top: 20px; padding-top: 4px;
}
.actions .note { color: var(--muted); font-size: 13px; }

/* ───────── 执行历史 ───────── */

h3 { margin: 32px 0 10px; font-size: 13px; font-weight: 600;
     color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.runs { background: var(--panel); border: 1px solid var(--line);
        border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 14px; vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px;
     background: var(--panel-2); border-bottom: 1px solid var(--line); }
tbody tr + tr td { border-top: 1px solid var(--line-soft); }
td.when { color: var(--ink-2); white-space: nowrap;
          font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
td.why { color: var(--ink-2); }
td.trig { color: var(--muted); white-space: nowrap;
          font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 550; white-space: nowrap;
}
.badge.success { background: var(--accent-2); color: var(--ok); }
.badge.skipped { background: var(--panel-2); color: var(--muted); }
.badge.failed  { background: color-mix(in srgb, var(--err) 12%, transparent); color: var(--err); }

.err { color: var(--err); min-height: 1.2em; margin: 10px 0 0; font-size: 13.5px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  padding: 9px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 500; z-index: 30;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
}
.toast.bad { background: var(--err); color: #fff; }

/* ───────── 登录 / 注册切换 ───────── */

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* 分段控件：两个页签共处一个浅底槽里，才看得出是「二选一」而不是两个按钮。 */
.tabs {
  display: flex; gap: 3px; margin: 0 0 18px; padding: 3px;
  background: var(--panel-2); border-radius: 9px;
}
.tab {
  flex: 1; padding: 7px 0; border-radius: var(--r-sm);
  background: none; border: 0; color: var(--ink-2);
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
.tab:hover:not([aria-current="true"]) { color: var(--ink); filter: none; }
.tab[aria-current="true"] { background: var(--panel); box-shadow: var(--shadow); }
.tab[aria-current="true"] { color: var(--accent); font-weight: 600; }
.login input { margin-bottom: 10px; }
.login #g-invite-row input { letter-spacing: .08em; font-family: ui-monospace, Menlo, monospace; }

/* ───────── 顶栏右侧 ───────── */

.who { color: var(--muted); font-size: 13.5px; white-space: nowrap; }
header button.ghost { padding: 6px 12px; font-size: 13.5px; }

/* ───────── 弹层 ───────── */

.modal {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(31, 30, 27, .32);
  display: grid; place-items: center; padding: 24px;
  overflow-y: auto;
}
.sheet-box {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 8px 32px rgba(0, 0, 0, .16);
  padding: 26px 28px; width: 100%; max-width: 460px;
}
.sheet-box h2 { margin: 0 0 4px; font-size: 19px; font-weight: 650; letter-spacing: -.01em; }
.sheet-box h3 {
  margin: 26px 0 8px; font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.sheet-box > .note { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; }

.acc-list { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.acc {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; background: var(--panel);
}
.acc + .acc { border-top: 1px solid var(--line-soft); }
.acc .body { flex: 1; min-width: 0; }
.acc .toggle { flex: none; }
.acc .name { font-weight: 550; font-size: 14.5px; }
.acc .note { margin: 0; font-size: 12.5px; color: var(--muted); }
.acc-list .empty { padding: 16px 14px; margin: 0; font-size: 14px; }

.acc-form .field { padding: 10px 0; border-top: 1px solid var(--line-soft); }
.acc-form .field:first-child { border-top: 0; }
.acc-form .field label { display: block; font-weight: 550; font-size: 14px; margin-bottom: 3px; }

button.danger { color: var(--err); border-color: var(--line); }
button.danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--err) 10%, transparent);
  border-color: color-mix(in srgb, var(--err) 35%, transparent);
}

/* ───────── 多选器 ───────── */

.multi { display: flex; flex-direction: column; gap: 8px; }
.multi .tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 24px; }
.multi .tags .note { margin: 0; }
.tag {
  padding: 3px 9px; border-radius: 999px;
  background: var(--accent-2); color: var(--accent);
  border: 0; font-size: 13px; font-weight: 550; line-height: 1.4;
}
.tag:hover { filter: none; background: color-mix(in srgb, var(--err) 12%, transparent); color: var(--err); }
.multi-search { width: 100%; }
.multi-list {
  display: flex; flex-wrap: wrap; gap: 5px;
  max-height: 150px; overflow-y: auto;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel-2);
}
.multi-list .note { margin: 0; }
.opt {
  padding: 3px 9px; border-radius: 999px;
  background: var(--panel); color: var(--ink-2);
  border: 1px solid var(--line); font-size: 13px; font-weight: 400; line-height: 1.4;
}
.opt:hover { filter: none; background: var(--accent-2); color: var(--accent); border-color: transparent; }

/* ───────── 窄屏 ─────────
   放在文件末尾，不是挨着 main 写：下面的 nav 规则同权重且更靠后，
   写在前面会被它整条盖掉——侧栏还是 sticky、还压在详情上面。 */

@media (max-width: 760px) {
  main { grid-template-columns: 1fr; }
  nav {
    position: static; height: auto; max-height: 40vh;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  section#detail { padding: 22px 16px 64px; }
  header { padding: 0 14px; gap: 10px; }
  header select { max-width: 120px; }
  .brand { font-size: 15px; }
  td.trig { display: none; }
  th:last-child { display: none; }
  .modal { padding: 12px; align-items: start; }
  .sheet-box { padding: 20px 18px; }
  .who { display: none; }
}

/* ───────── 超宽屏 ─────────
   1500px 往上，表单只占左栏、执行历史挪到右栏：
   改完参数就能对着右边看上几次跑成什么样，不用来回滚。 */

@media (min-width: 1500px) {
  .sheet {
    max-width: 1380px;
    display: grid;
    grid-template-columns: minmax(0, 700px) minmax(0, 620px);
    gap: 0 44px;
    align-items: start;
  }
  .sheet > .head { grid-column: 1 / -1; }
  .sheet > form  { grid-column: 1; }
  .sheet > .side { grid-column: 2; }
  /* 两栏并排时右栏要和左栏第一张卡片对齐，h3 那 32px 上边距得去掉。 */
  .sheet > .side h3 { margin-top: 0; }
}
