* {
  box-sizing: border-box;
}


html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}


body {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Microsoft YaHei",
    Arial,
    sans-serif;

  background: #0f1117;

  color: #e8eaf0;
}


button,
input {
  font: inherit;
}


button {
  cursor: pointer;
}


.hidden {
  display: none !important;
}


/*
 * ============================
 * 页面
 * ============================
 */

.page {
  min-height: 100vh;
}


.login-page {
  display: flex;

  align-items: center;

  justify-content: center;

  padding: 24px;
}


/*
 * ============================
 * 登录
 * ============================
 */

.login-card {
  width: 100%;

  max-width: 420px;

  padding: 36px;

  background: #171a22;

  border: 1px solid #292e3a;

  border-radius: 14px;

  box-shadow:
    0 20px 50px
    rgba(0, 0, 0, 0.35);
}


.login-card h1 {
  margin: 0;

  font-size: 30px;

  font-weight: 700;

  text-align: center;
}


.login-subtitle {
  margin: 8px 0 28px;

  color: #9299a8;

  text-align: center;

  font-size: 14px;
}


/*
 * ============================
 * 顶部导航
 * ============================
 */

.topbar {
  position: sticky;

  top: 0;

  z-index: 50;

  display: flex;

  align-items: center;

  justify-content: space-between;

  padding: 16px 28px;

  background: rgba(
    15,
    17,
    23,
    0.94
  );

  border-bottom: 1px solid #292e3a;

  backdrop-filter: blur(12px);
}


.topbar-left h1 {
  margin: 0;

  font-size: 22px;
}


.topbar-right {
  display: flex;

  align-items: center;

  gap: 10px;
}


/*
 * ============================
 * 主内容
 * ============================
 */

.main-container {
  width: 100%;

  max-width: 1200px;

  margin: 0 auto;

  padding: 28px;
}


/*
 * ============================
 * Panel
 * ============================
 */

.panel {
  margin-bottom: 24px;

  background: #171a22;

  border: 1px solid #292e3a;

  border-radius: 12px;

  overflow: hidden;
}


.panel-header {
  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 20px;

  padding: 20px 22px;

  border-bottom: 1px solid #292e3a;
}


.panel-header h2 {
  margin: 0;

  font-size: 18px;

  font-weight: 650;
}


.panel-header p {
  margin: 5px 0 0;

  color: #8f96a5;

  font-size: 13px;
}


.task-list-header {
  align-items: center;
}


/*
 * ============================
 * 表单
 * ============================
 */

#create-task-form {
  padding: 22px;
}


.form-grid {
  display: grid;

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 18px;
}


.form-group {
  display: flex;

  flex-direction: column;

  gap: 8px;

  margin-bottom: 18px;
}


.form-group label {
  color: #cfd4df;

  font-size: 14px;

  font-weight: 550;
}


.form-group input {
  width: 100%;

  min-height: 42px;

  padding: 9px 12px;

  color: #eef0f5;

  background: #10131a;

  border: 1px solid #343a49;

  border-radius: 8px;

  outline: none;

  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}


.form-group input::placeholder {
  color: #666d7c;
}


.form-group input:focus {
  border-color: #68748a;

  box-shadow:
    0 0 0 3px
    rgba(104, 116, 138, 0.14);
}


.form-actions {
  display: flex;

  align-items: center;

  justify-content: flex-start;

  gap: 10px;
}


.form-message {
  min-height: 20px;

  margin-top: 10px;

  color: #62d68b;

  font-size: 13px;
}


.form-error {
  min-height: 20px;

  margin-top: 10px;

  color: #ff7272;

  font-size: 13px;

  text-align: center;
}


/*
 * ============================
 * 按钮
 * ============================
 */

.primary-button,
.secondary-button,
.danger-button {
  min-height: 38px;

  padding: 8px 15px;

  border-radius: 8px;

  font-size: 14px;

  font-weight: 550;

  transition:
    opacity 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}


.primary-button {
  color: #ffffff;

  background: #3d78d8;

  border: 1px solid #4a86e8;
}


.primary-button:hover {
  opacity: 0.9;
}


.secondary-button {
  color: #d9dde6;

  background: #20242e;

  border: 1px solid #363c4a;
}


.secondary-button:hover {
  background: #292e39;
}


.danger-button {
  color: #ffb5b5;

  background: #281b20;

  border: 1px solid #553039;
}


.danger-button:hover {
  background: #332026;
}


button:disabled {
  opacity: 0.5;

  cursor: not-allowed;
}


/*
 * ============================
 * 任务列表
 * ============================
 */

.tasks-container {
  padding: 18px;
}


.task-card {
  padding: 20px;

  margin-bottom: 14px;

  background: #11141b;

  border: 1px solid #2c3240;

  border-radius: 10px;
}


.task-card:last-child {
  margin-bottom: 0;
}


.task-card-header {
  display: flex;

  align-items: flex-start;

  justify-content: space-between;

  gap: 20px;

  margin-bottom: 16px;
}


.task-title-area {
  min-width: 0;

  display: flex;

  align-items: center;

  gap: 10px;

  flex-wrap: wrap;
}


.task-id {
  font-size: 14px;
}

.task-name {
  font-size: 14px;
}

.task-url {
  font-size: 14px;
}

.task-url-value {
  font-size: 14px;
}

.task-label {
  font-size: 13px;
}

.task-value {
  font-size: 14px;
}


/*
 * 保留当前绿色「运行中」
 * 标准大小：18px
 */

.status-on {
  color: #62d68b;

  font-size: 18px;
}


.status-off {
  color: #858c9b;
}


/*
 * ============================
 * 任务 URL
 * ============================
 */

.task-url {
  display: flex;

  align-items: flex-start;

  gap: 12px;

  padding: 12px 14px;

  margin-bottom: 16px;

  background: #181c25;

  border-radius: 8px;
}


.task-url-value {
  min-width: 0;

  color: #aeb5c2;

  word-break: break-all;
}


/*
 * 任务网址统一 17px
 */

.task-url .task-label {
  font-size: 17px;
}


.task-url .task-url-value {
  font-size: 17px;
}


/*
 * ============================
 * 任务信息
 * ============================
 */

.task-meta {
  display: grid;

  grid-template-columns:
    repeat(3, minmax(0, 1fr));

  gap: 12px;

  margin-bottom: 18px;
}


.task-meta-item {
  min-width: 0;

  padding: 12px;

  background: #181c25;

  border-radius: 8px;
}


.task-label {
  display: block;

  margin-bottom: 5px;

  color: #737b8a;

  font-size: 12px;
}


.task-value {
  color: #d7dbe4;

  font-size: 13px;

  word-break: break-word;
}


/*
 * 任务详细信息统一 16px
 */

.task-meta .task-label {
  font-size: 16px;
}


.task-meta .task-value {
  font-size: 16px;
}


/*
 * 最后结果
 */

.task-result-success {
  color: #62d68b;
}


.task-result-error {
  color: #ff7777;
}


.task-result-empty {
  color: #d7dbe4;
}


/*
 * ============================
 * 数据库同步
 * ============================
 */

.database-sync-container {
  display: grid;

  grid-template-columns:
    repeat(4, minmax(0, 1fr));

  gap: 12px;

  padding: 18px;
}


.database-sync-item {
  min-width: 0;

  padding: 14px;

  background: #181c25;

  border-radius: 8px;
}


.database-sync-label {
  display: block;

  margin-bottom: 6px;

  color: #737b8a;

  font-size: 14px;
}


.database-sync-value {
  display: block;

  color: #d7dbe4;

  font-size: 15px;

  word-break: break-word;
}


.database-sync-result-success {
  color: #62d68b;
}


.database-sync-result-error {
  color: #ff7777;
}


.database-sync-result-empty {
  color: #858c9b;
}


/*
 * ============================
 * 任务操作
 * ============================
 */

.task-actions {
  display: flex;

  align-items: center;

  justify-content: flex-end;

  gap: 8px;

  padding-top: 16px;

  border-top: 1px solid #292e39;
}


/*
 * ============================
 * 空状态
 * ============================
 */

.empty-state {
  padding: 36px 20px;

  color: #737b8a;

  text-align: center;

  font-size: 14px;
}


/*
 * ============================
 * 日志
 * ============================
 */

.logs-container {
  max-height: 520px;

  min-height: 100px;

  padding: 8px 0;

  overflow-y: auto;

  font-family:
    "Cascadia Code",
    "Consolas",
    "SFMono-Regular",
    monospace;

  scrollbar-width: thin;
}


.log-entry {
  display: flex;

  align-items: flex-start;

  gap: 12px;

  padding: 8px 18px;

  border-bottom: 1px solid
    rgba(255, 255, 255, 0.035);

  font-size: 13px;

  line-height: 1.5;
}


.log-entry:last-child {
  border-bottom: none;
}


.log-time {
  flex-shrink: 0;

  color: #626a79;

  white-space: nowrap;
}


.log-message {
  min-width: 0;

  color: #cbd0da;

  word-break: break-word;
}


.log-error .log-message {
  color: #ff7777;
}


/*
 * ============================
 * 滚动条
 * ============================
 */

.logs-container::-webkit-scrollbar {
  width: 8px;
}


.logs-container::-webkit-scrollbar-track {
  background: #11141b;
}


.logs-container::-webkit-scrollbar-thumb {
  background: #363c49;

  border-radius: 999px;
}


.logs-container::-webkit-scrollbar-thumb:hover {
  background: #454c5b;
}


/*
 * ============================
 * Modal
 * ============================
 */

.modal {
  position: fixed;

  inset: 0;

  z-index: 100;

  display: flex;

  align-items: center;

  justify-content: center;

  padding: 20px;
}


.modal-backdrop {
  position: absolute;

  inset: 0;

  background:
    rgba(0, 0, 0, 0.68);
}


.modal-dialog {
  position: relative;

  z-index: 1;

  width: 100%;

  max-width: 560px;

  max-height: calc(100vh - 40px);

  overflow-y: auto;

  padding: 22px;

  background: #171a22;

  border: 1px solid #303644;

  border-radius: 12px;

  box-shadow:
    0 24px 70px
    rgba(0, 0, 0, 0.45);
}


.modal-header {
  display: flex;

  align-items: flex-start;

  justify-content: space-between;

  gap: 20px;

  margin-bottom: 22px;
}


.modal-header h2 {
  margin: 0;

  font-size: 19px;
}


.modal-header p {
  margin: 5px 0 0;

  color: #858c9b;

  font-size: 13px;
}


.modal-close-button {
  width: 34px;

  height: 34px;

  flex-shrink: 0;

  padding: 0;

  color: #aab1bf;

  background: #20242d;

  border: 1px solid #343a47;

  border-radius: 8px;

  font-size: 24px;

  line-height: 30px;
}


.modal-close-button:hover {
  background: #292e38;

  color: #ffffff;
}


#edit-task-form {
  padding: 0;
}


.modal-actions {
  display: flex;

  align-items: center;

  justify-content: flex-end;

  gap: 8px;

  padding-top: 6px;
}


/*
 * ============================
 * 响应式
 * ============================
 */

@media (
  max-width: 800px
) {

  .main-container {
    padding: 18px;
  }


  .topbar {
    padding: 14px 18px;
  }


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


  .task-meta {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }


  .database-sync-container {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

}


@media (
  max-width: 600px
) {

  .login-card {
    padding: 26px 20px;
  }


  .main-container {
    padding: 12px;
  }


  .panel-header {
    padding: 16px;
  }


  #create-task-form {
    padding: 16px;
  }


  .tasks-container {
    padding: 12px;
  }


  .task-card {
    padding: 16px;
  }


  .task-card-header {
    flex-direction: column;

    gap: 10px;
  }


  .task-meta {
    grid-template-columns: 1fr;
  }


  .database-sync-container {
    grid-template-columns: 1fr;
  }


  .task-actions {
    flex-wrap: wrap;

    justify-content: flex-start;
  }


  .log-entry {
    flex-direction: column;

    gap: 2px;
  }


  .log-time {
    font-size: 11px;
  }


  .modal {
    padding: 10px;
  }


  .modal-dialog {
    max-height:
      calc(100vh - 20px);

    padding: 18px;
  }

}
