:root {
  --blue: #2f6fec;
  --blue-strong: #1f5ed8;
  --bg: #eef3fb;
  --surface: #ffffff;
  --line: #dfe5ef;
  --muted: #687386;
  --text: #171b26;
  --danger: #d93a3a;
  --ok: #14804a;
  --radius: 6px;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

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

button {
  border: 0;
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: linear-gradient(135deg, #1f5ed8, #3c7af3 45%, #eff5ff 45%);
}

.login-brand {
  padding: 80px 72px;
  color: #fff;
}

.login-brand h1 {
  margin: 0 0 16px;
  font-size: 40px;
  letter-spacing: 0;
}

.login-brand p {
  width: 520px;
  max-width: 100%;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.82);
}

.login-panel {
  align-self: center;
  justify-self: center;
  width: min(420px, calc(100vw - 40px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 16px 36px rgba(31, 94, 216, 0.14);
}

.login-panel h2 {
  margin: 0 0 24px;
  font-size: 24px;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  color: #fff;
  background: var(--blue);
}

.brand {
  font-size: 18px;
  font-weight: 700;
}

.nav {
  display: flex;
  gap: 4px;
}

.nav button {
  height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.84);
  background: transparent;
}

.nav button.active,
.nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.form-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  margin-bottom: 12px;
}

.form-section-head {
  min-height: 46px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-section-head h3 {
  margin: 0;
  font-size: 15px;
}

.form-section-body {
  padding: 14px;
}

.card-head {
  min-height: 56px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.card-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

.card-body {
  padding: 16px 18px;
}

.stat {
  padding: 16px 18px;
}

.stat .value {
  margin-top: 6px;
  font-size: 28px;
  font-weight: 700;
}

.stat .label {
  color: var(--muted);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field label {
  font-size: 13px;
  color: #303847;
}

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

.row.stretch > * {
  flex: 1 1 180px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
  background: #f8fafd;
  color: var(--text);
  font-size: 13px;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.btn {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  background: #edf2fb;
  color: #1d3156;
  font-size: 13px;
  white-space: nowrap;
}

.btn.primary {
  color: #fff;
  background: var(--blue);
}

.btn.primary:hover {
  background: var(--blue-strong);
}

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

.btn.ghost {
  background: transparent;
  color: var(--blue);
}

.btn.small {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.btn.compact {
  min-height: 30px;
  padding: 0 14px;
  border-radius: 3px;
}

.icon-btn {
  width: 34px;
  min-width: 34px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 0 3px 3px 0;
  color: #475467;
  background: #fff;
  font-size: 16px;
  line-height: 1;
}

.link-btn {
  min-height: auto;
  padding: 0;
  border-radius: 0;
  color: #1d6fff;
  background: transparent;
  font-size: 12px;
}

.danger-link {
  color: #d93a3a;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 9px 8px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-weight: 600;
  background: #f8fafd;
  font-size: 12px;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  color: #1f5ed8;
  background: #eaf1ff;
  font-size: 12px;
}

.pill.ok {
  color: var(--ok);
  background: #e9f7f0;
}

.pill.warn {
  color: #a66600;
  background: #fff2d8;
}

.split {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 12px;
}

.project-workspace {
  overflow: hidden;
  border: 1px solid #e6ebf2;
  background: #fff;
}

.project-tabs {
  display: flex;
  gap: 28px;
  height: 46px;
  padding: 0 18px;
  border-bottom: 1px solid #e5eaf1;
  background: #fff;
}

.project-tabs button {
  position: relative;
  height: 46px;
  padding: 0;
  color: #4a5568;
  background: transparent;
  font-size: 16px;
  font-weight: 600;
}

.project-tabs button.active {
  color: #1d6fff;
}

.project-tabs button.active::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  content: "";
  background: #1d6fff;
}

.project-search-band {
  height: 58px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid #e9edf3;
  background: #fff;
}

.project-search {
  display: flex;
  width: 256px;
}

.project-search input {
  border-radius: 3px 0 0 3px;
  background: #fff;
}

.project-table-card {
  margin: 14px 18px 20px;
  border: 1px solid #e6ebf2;
  background: #fff;
}

.project-settings-panel {
  min-height: 360px;
  padding: 18px;
  background: #f7f9fc;
}

.settings-section {
  max-width: 760px;
  border: 1px solid #e6ebf2;
  background: #fff;
}

.settings-section h3 {
  height: 48px;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0 16px;
  border-bottom: 1px solid #e6ebf2;
  font-size: 16px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid #e6ebf2;
}

.settings-grid > div {
  min-height: 64px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 0 16px;
  border-right: 1px solid #eef2f6;
  border-bottom: 1px solid #eef2f6;
}

.settings-grid span {
  color: #667085;
  font-size: 12px;
}

.settings-grid strong {
  color: #1f2937;
  font-size: 14px;
}

.settings-section > .btn {
  margin: 14px 16px 16px;
}

.project-toolbar {
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid #e6ebf2;
}

.project-management-table th,
.project-management-table td {
  height: 48px;
  padding: 10px 12px;
  border-right: 1px solid #eef2f6;
}

.project-management-table th {
  color: #303847;
  background: #fbfcfe;
  font-weight: 600;
}

.project-management-table tr:hover td {
  background: #fbfdff;
}

.check-cell {
  width: 44px;
  text-align: center !important;
}

.check-cell input {
  width: 14px;
  min-height: 14px;
}

.project-name-cell {
  min-width: 260px;
  font-weight: 600;
}

.number-cell {
  text-align: center !important;
}

.action-cell {
  width: 112px;
  white-space: nowrap;
}

.action-cell .link-btn + .link-btn {
  margin-left: 12px;
}

.empty-row {
  height: 120px !important;
  text-align: center !important;
}

.modal-backdrop,
.batch-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.28);
}

.project-modal {
  width: min(980px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  border: 1px solid #dfe5ef;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(20, 35, 66, 0.18);
}

.modal-head,
.batch-head {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid #e6ebf2;
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  width: 28px;
  height: 28px;
  color: #98a2b3;
  background: transparent;
  font-size: 24px;
  line-height: 1;
}

.modal-body {
  overflow: auto;
  padding: 24px 16px 18px;
}

.modal-foot {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 16px;
  border-top: 1px solid #e6ebf2;
  background: #fbfcfe;
}

.project-form-row {
  display: grid;
  grid-template-columns: 120px minmax(260px, 360px);
  align-items: start;
  gap: 16px;
  margin-bottom: 22px;
}

.project-form-row label,
.account-mode-row > span {
  padding-top: 7px;
  color: #303847;
}

.project-form-row input,
.project-form-row textarea {
  border-radius: 0;
  background: #fff;
}

.project-form-row textarea {
  min-height: 64px;
}

.account-mode-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: start;
  gap: 16px;
  margin-bottom: 24px;
}

.segmented {
  display: inline-flex;
  width: fit-content;
  border: 1px solid #d6dde8;
  border-radius: 3px;
  overflow: hidden;
}

.segmented button {
  min-width: 112px;
  height: 32px;
  padding: 0 14px;
  border-right: 1px solid #d6dde8;
  color: #344054;
  background: #fff;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  color: #0f62fe;
  background: #eaf2ff;
  box-shadow: inset 0 0 0 1px #0f62fe;
}

.account-picker-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 260px;
  gap: 16px;
  margin-left: 120px;
}

.account-panel,
.selected-panel {
  border: 1px solid #dfe5ef;
  background: #fff;
}

.panel-title,
.selected-head {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid #dfe5ef;
  color: #1f2937;
}

.account-search-row {
  display: grid;
  grid-template-columns: 82px 1fr 34px 34px;
  gap: 0;
  padding: 10px 10px 8px;
}

.account-search-row select,
.account-search-row input {
  border-radius: 0;
  background: #fff;
}

.account-search-row .batch {
  border-radius: 0;
  border-left: 0;
  border-right: 0;
}

.account-list {
  height: 310px;
  overflow: auto;
  padding: 4px 10px 10px;
}

.account-message {
  min-height: 260px;
  display: grid;
  place-items: center;
  color: #98a2b3;
  font-size: 13px;
}

.account-message.error {
  color: #d93a3a;
  text-align: center;
  line-height: 1.7;
}

.account-option {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #344054;
  font-size: 13px;
}

.account-option input {
  width: 14px;
  min-height: 14px;
}

.account-option em {
  margin-left: auto;
  color: #98a2b3;
  font-style: normal;
  font-size: 12px;
}

.account-option.disabled {
  color: #98a2b3;
}

.selected-list {
  height: 358px;
  overflow: auto;
  padding: 10px;
}

.selected-account {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #edf1f7;
}

.selected-account span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.selected-account small {
  color: #98a2b3;
  font-size: 12px;
}

.empty-state,
.empty.slim {
  height: 100%;
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: #98a2b3;
}

.empty.slim {
  min-height: 260px;
  border: 0;
}

.empty-icon {
  color: #d0d5dd;
  font-size: 42px;
  line-height: 1;
}

.batch-layer {
  z-index: 70;
  align-items: flex-start;
  padding-top: 58px;
  background: rgba(15, 23, 42, 0.18);
}

.batch-modal {
  width: min(640px, calc(100vw - 48px));
  border: 1px solid #dfe5ef;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(20, 35, 66, 0.18);
}

.batch-tip {
  height: 36px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid #e6ebf2;
  color: #667085;
  font-size: 13px;
}

.batch-tip span {
  color: #0f62fe;
}

.batch-editor {
  display: grid;
  grid-template-columns: 34px 1fr;
  min-height: 360px;
}

.line-number {
  padding-top: 14px;
  text-align: center;
  color: #98a2b3;
  border-right: 1px solid #e6ebf2;
  background: #fbfcfe;
}

.batch-editor textarea {
  min-height: 360px;
  border: 0;
  border-radius: 0;
  background: #fff;
  resize: none;
  padding: 14px 16px;
}

.batch-foot {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 12px;
  border-top: 1px solid #e6ebf2;
}

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

.list-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
}

.list-item.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px #dbe8ff;
}

.condition-row,
.action-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.15fr) 92px 110px minmax(120px, 1fr) 30px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.action-row {
  grid-template-columns: minmax(140px, 1fr) minmax(130px, 1fr) 92px minmax(120px, 1fr) 30px;
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 6px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: 6px;
  color: #fff;
  background: #172033;
  box-shadow: 0 12px 30px rgba(23, 32, 51, 0.2);
  z-index: 20;
}

pre {
  margin: 0;
  max-width: 320px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  color: #344054;
}

.card + .card {
  margin-top: 12px !important;
}

.hidden {
  display: none;
}

@media (max-width: 900px) {
  .login-shell,
  .grid.cols-4,
  .grid.cols-2,
  .split {
    grid-template-columns: 1fr;
  }

  .topbar {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }

  .nav {
    overflow-x: auto;
    width: 100%;
  }

  .page {
    padding: 16px;
  }

  .condition-row,
  .action-row {
    grid-template-columns: 1fr;
  }

  .project-form-row,
  .account-mode-row,
  .account-picker-grid {
    grid-template-columns: 1fr;
    margin-left: 0;
  }

  .project-management-table {
    min-width: 980px;
  }

  .project-table-card {
    overflow-x: auto;
  }

  .segmented {
    width: 100%;
  }

  .segmented button {
    min-width: 0;
    flex: 1;
  }
}
