:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary2: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
}

* {
  box-sizing: border-box;
}

body {
  font-family: Arial, "Microsoft YaHei", sans-serif;
  margin: 0;
  padding: 18px;
  background: var(--bg);
  color: var(--text);
}

.auth {
  background: var(--bg);
}

.hidden {
  display: none !important;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* 登录后主界面加宽，表格随内容扩展并在窄屏横向滚动 */
body.auth .container {
  max-width: min(1680px, calc(100vw - 32px));
  width: 100%;
  padding: 0 8px;
  box-sizing: border-box;
}

body.auth #panel-tasks,
body.auth #panel-users-submit,
body.auth #panel-users-task,
body.auth #panel-history {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

body.auth #panel-tasks table,
body.auth #panel-users-submit table,
body.auth #panel-users-task table,
body.auth #panel-history table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

body.auth #panel-tasks th,
body.auth #panel-tasks td,
body.auth #panel-users-submit th,
body.auth #panel-users-submit td,
body.auth #panel-users-task th,
body.auth #panel-users-task td,
body.auth #panel-history th,
body.auth #panel-history td {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  vertical-align: middle;
}

/* 任务列表：长链接/备注省略，悬停 title 看全文（覆盖 body.auth 下表格 nowrap） */
body.auth #panel-tasks #tasksTable td.cell-ellipsis {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

body.auth #panel-tasks #tasksTable td.col-baidu_link {
  max-width: 170px;
}

body.auth #panel-tasks #tasksTable td.col-task_note {
  max-width: 130px;
}

body.auth #panel-tasks #tasksTable td.col-target_link {
  max-width: 170px;
}

body.auth #panel-tasks #tasksTable td.col-status {
  white-space: nowrap;
  vertical-align: middle;
}

body.auth #panel-tasks #tasksTable td.col-display-status {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.ds-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  border: 1px solid transparent;
}

.ds-badge.ds-pending {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}

.ds-badge.ds-claimed {
  background: #ffedd5;
  color: #c2410c;
  border-color: #fdba74;
}

.ds-badge.ds-done {
  background: #d1fae5;
  color: #047857;
  border-color: #6ee7b7;
}

.ds-badge.ds-expired {
  background: #f3f4f6;
  color: #4b5563;
  border-color: #d1d5db;
}

.ds-badge.ds-confirming {
  background: #ede9fe;
  color: #5b21b6;
  border-color: #c4b5fd;
}

.ds-badge.ds-other {
  background: #e0e7ff;
  color: #4338ca;
  border-color: #a5b4fc;
}

.topbar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.brand {
  font-weight: 800;
  font-size: 16px;
}

.topbar .meta {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

label.metaLabel {
  color: var(--muted);
  font-size: 13px;
  margin-right: 6px;
  white-space: nowrap;
}

input,
button,
select {
  padding: 9px 10px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

button {
  cursor: pointer;
}

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

/* 用户列表：提交端 / 任务端分表，第二列类型说明着色 */
#usersSubmitTable tbody tr.userRowNormal td:nth-child(2) {
  color: #2563eb;
  font-weight: 600;
}
#usersTaskTable tbody tr.userRowTasker td:nth-child(2) {
  color: #c2410c;
  font-weight: 600;
}
#usersSubmitTable tbody tr.userRowBoth td:nth-child(2),
#usersTaskTable tbody tr.userRowBoth td:nth-child(2) {
  color: #7c3aed;
  font-weight: 600;
}

button.primary:hover {
  background: var(--primary2);
  border-color: var(--primary2);
}

.navRow {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.navAuthWrap {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.navRow button {
  background: var(--card);
}

.navRow button.active {
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

/* 登录页：中间列登录（视口居中），左列装饰图靠右贴近登录 */
body:not(.auth) {
  padding: 0;
  min-height: 100vh;
  background: linear-gradient(140deg, #e8f2ff 0%, #d6ecff 45%, #f3fbff 100%);
}

body:not(.auth) .container {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0;
}

/* 三列网格：左列放装饰（靠右对齐贴近登录），中列为登录卡片（视口水平居中），右列留白对称 */
body:not(.auth) #loginShell {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 36px;
  min-height: 100vh;
  padding: 34px 24px;
  box-sizing: border-box;
}

body.auth #loginShell {
  display: none;
}

#loginIllustration {
  grid-column: 1;
  justify-self: end;
  width: min(420px, 38vw);
  max-width: 100%;
  height: 520px;
  min-height: 420px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.45) 0%, rgba(59, 130, 246, 0) 52%),
    radial-gradient(circle at 70% 25%, rgba(99, 102, 241, 0.32) 0%, rgba(99, 102, 241, 0) 55%),
    radial-gradient(circle at 55% 70%, rgba(16, 185, 129, 0.18) 0%, rgba(16, 185, 129, 0) 55%),
    linear-gradient(135deg, rgba(37, 99, 235, 0.22) 0%, rgba(37, 99, 235, 0.08) 55%, rgba(37, 99, 235, 0.0) 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 18px 46px rgba(37, 99, 235, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.18);
}

#loginIllustration::before {
  content: "";
  position: absolute;
  inset: -60px;
  background:
    radial-gradient(circle at 30% 70%, rgba(16, 185, 129, 0.28) 0%, rgba(16, 185, 129, 0) 52%),
    radial-gradient(circle at 70% 62%, rgba(59, 130, 246, 0.48) 0%, rgba(59, 130, 246, 0) 48%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 45%);
  filter: blur(2px);
  z-index: 0;
}

#loginIllustration::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.65) 0%, rgba(255, 255, 255, 0) 44%),
    repeating-linear-gradient(
      115deg,
      rgba(255, 255, 255, 0.75) 0px,
      rgba(255, 255, 255, 0.75) 2px,
      rgba(255, 255, 255, 0) 2px,
      rgba(255, 255, 255, 0) 18px
    );
  opacity: 0.11;
  z-index: 0;
}

#loginIllustration svg {
  position: absolute;
  inset: 0;
  z-index: 1;
}

#panel-login {
  grid-column: 2;
  justify-self: center;
  width: 410px;
  max-width: calc(100vw - 36px);
  border-radius: 16px;
  padding: 26px 22px;
  margin: 0;
  box-shadow: 0 18px 50px rgba(2, 6, 23, 0.12);
  border: 1px solid rgba(229, 231, 235, 0.8);
}

#panel-login h3 {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 12px 0;
}

#loginMsg {
  margin-top: 10px;
}

body:not(.auth) .topbar {
  display: none;
}

/* 业务页正常 card 间距 */
.card {
  margin-bottom: 14px;
}

/* 登录表单：纵向排版，避免横向挤压 */
#panel-login .row {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 0;
}

#panel-login .fieldGrow {
  min-width: 0;
}

#panel-login button.primary {
  width: 100%;
}

@media (max-width: 860px) {
  body:not(.auth) #loginShell {
    grid-template-columns: 1fr;
    column-gap: 0;
    row-gap: 18px;
    padding: 24px 18px;
    align-content: center;
  }
  /* 小屏纵向排列时：登录在上、装饰在下 */
  body:not(.auth) #panel-login {
    grid-column: 1;
    order: -1;
    width: 100%;
    max-width: none;
  }
  #loginIllustration {
    grid-column: 1;
    justify-self: stretch;
    width: 100%;
    height: 260px;
    min-height: 0;
  }
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.error {
  color: var(--danger);
  font-weight: 700;
  font-size: 13px;
  margin-top: 8px;
}

.success {
  color: var(--success);
  font-weight: 700;
  font-size: 13px;
  margin-top: 8px;
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.row > * {
  flex: none;
}

.fieldGrow {
  flex: 1 1 auto;
  min-width: 220px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  overflow: auto;
}

th,
td {
  border: 1px solid var(--border);
  padding: 8px;
  font-size: 13px;
  vertical-align: top;
  word-break: break-all;
  text-align: left;
}

th {
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr:nth-child(even) td {
  background: #fcfcfd;
}

tbody tr:hover td {
  background: #eff6ff;
}

tbody tr.clickable {
  cursor: pointer;
}

.btnRow {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.summary {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.summaryItem {
  font-size: 13px;
  color: var(--muted);
}
.summaryItem b {
  color: var(--text);
}

.loading {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

textarea {
  width: 100%;
  height: 120px;
  padding: 10px;
  font-size: 13px;
}

.modalBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal {
  width: min(900px, 100%);
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 14px 16px;
}

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

.modalHeader h3 {
  margin: 0;
  font-size: 16px;
}

.modalClose {
  padding: 8px 10px;
}

.detailGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}

.detailItem {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}

.detailItem .k {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.detailItem .v {
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 720px) {
  .detailGrid {
    grid-template-columns: 1fr;
  }
}

