:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --line: #d9dee7;
  --text: #1f2933;
  --muted: #667085;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --success: #16803c;
  --warn: #b54708;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button.primary,
.worker-link {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.link-button {
  border: 0;
  min-height: 24px;
  padding: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
}

.link-button:hover {
  text-decoration: underline;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 22px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin-bottom: 4px;
  font-size: 24px;
}

.topbar p {
  margin-bottom: 0;
  color: var(--muted);
}

.worker-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
  padding: 18px;
}

.tabs {
  display: grid;
  align-content: start;
  gap: 8px;
  position: sticky;
  top: 18px;
}

.tab {
  justify-content: flex-start;
  text-align: left;
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.view {
  display: none;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.view.active {
  display: block;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.dialog-form > .actions {
  justify-content: flex-end;
}

.dialog-form > .actions button {
  flex: 0 1 auto;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(150px, 220px) repeat(3, auto);
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.actions.full {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  background: #f1f4f8;
  color: #344054;
  font-weight: 600;
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #edf2f7;
  color: #344054;
  font-size: 12px;
  white-space: nowrap;
}

.tag.success {
  background: #dcfae6;
  color: var(--success);
}

.tag.warn {
  background: #fef0c7;
  color: var(--warn);
}

.tag.danger {
  background: #fee4e2;
  color: var(--danger);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.group-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.group-note-field {
  grid-column: 1 / -1;
}

.group-clear-deadline {
  align-self: end;
  min-height: 36px;
}

.big-input {
  min-height: 220px;
  margin-bottom: 12px;
  font-family: Consolas, "Microsoft YaHei", monospace;
}

.result-box {
  min-height: 44px;
  padding: 12px;
  background: #101828;
  color: #d1fadf;
  border-radius: 8px;
  overflow: auto;
  white-space: pre-wrap;
}

.filters {
  margin-bottom: 12px;
}

.hint {
  color: var(--muted);
}

.logs {
  display: grid;
  gap: 8px;
}

.log-line {
  display: grid;
  grid-template-columns: 160px 120px 1fr;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  font-size: 13px;
}

dialog {
  width: min(560px, calc(100vw - 30px));
  max-width: calc(100vw - 30px);
  max-height: calc(100vh - 30px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0;
}

.wide-dialog {
  width: min(920px, 100%);
}

.dialog-form {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  padding: 18px;
  overflow-x: hidden;
}

.dialog-form h3 {
  margin-bottom: 0;
}

.group-dialog-summary {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.check input {
  width: auto;
  min-height: auto;
}

#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: none;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #101828;
  color: #fff;
  box-shadow: var(--shadow);
  z-index: 10;
}

.worker-body {
  display: grid;
  place-items: center;
  padding: 18px;
}

.worker-shell {
  width: min(560px, 100%);
}

.auto-shell {
  width: min(1180px, 100%);
}

.worker-panel {
  display: grid;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.worker-panel h1 {
  margin-bottom: 0;
  font-size: 24px;
}

.worker-panel p {
  color: var(--muted);
  line-height: 1.65;
}

.auto-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.auto-log {
  max-height: 220px;
}

.auto-records {
  max-height: 460px;
  overflow: auto;
}

.auto-records table {
  min-width: 1060px;
}

.claim-box {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

.hidden {
  display: none;
}

.claim-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#countdown {
  color: var(--warn);
  font-weight: 700;
}

.task-card {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

@media (max-width: 820px) {
  .topbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .tabs {
    position: static;
    grid-template-columns: repeat(2, 1fr);
  }

  .metrics,
  .form-grid,
  .toolbar,
  .group-edit-grid {
    grid-template-columns: 1fr;
  }

  .group-note-field {
    grid-column: auto;
  }

  .log-line {
    grid-template-columns: 1fr;
  }
}
