:root {
  --bg: #edf2f8;
  --panel: #fff;
  --panel-soft: #f6f8fb;
  --text: #2f3b4a;
  --muted: #7b8794;
  --line: #e4e8ef;
  --primary: #409eff;
  --success: #27c2a0;
  --danger: #f56c6c;
  --sidebar: #304156;
  --sidebar-active: #263445;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: #edf2f8;
}

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

button {
  border: 0;
  cursor: pointer;
}

.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #2d3a4b 0%, #243247 55%, #172130 100%);
  color: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 64px;
  align-items: center;
  padding: 64px min(8vw, 110px);
}

.login-copy h1 {
  font-size: 34px;
  margin: 0 0 18px;
}

.login-copy h2 {
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1.15;
  margin: 0 0 24px;
}

.login-copy p {
  color: #d6e2ef;
  font-size: 17px;
  line-height: 2;
  margin: 0;
}

.login-card {
  background: rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 6px;
  padding: 36px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .26);
}

.login-card h3 {
  margin: 0 0 24px;
  text-align: center;
  font-size: 26px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

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

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  min-height: 40px;
  padding: 9px 12px;
  background: #fff;
  color: var(--text);
}

.field textarea {
  min-height: 78px;
  resize: vertical;
}

.login-card input {
  background: rgba(0, 0, 0, .12);
  border-color: rgba(255,255,255,.12);
  color: #fff;
  min-height: 48px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 4px;
  background: #e8edf5;
  color: var(--text);
}

.btn.primary { background: var(--primary); color: #fff; }
.btn.success { background: var(--success); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.full { width: 100%; min-height: 46px; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
}

.app-shell.flow-workbench {
  grid-template-columns: 14px minmax(0, 1fr);
}

.flow-workbench .sidebar {
  padding: 0;
  overflow: hidden;
}

.flow-workbench .brand,
.flow-workbench .nav-item,
.flow-workbench .topbar {
  display: none;
}

.flow-workbench .content {
  padding: 18px 18px 0;
}

.flow-workbench .metric-cards {
  gap: 14px;
  margin-bottom: 18px;
}

.flow-workbench .stat-card {
  min-height: 78px;
}

.sidebar {
  background: var(--sidebar);
  color: #bfcbd9;
  padding: 0;
}

.brand {
  color: #fff;
  font-size: 0;
  font-weight: 700;
  height: 0;
  padding: 0;
}

.nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 0 22px;
  color: #bfcbd9;
  background: transparent;
  text-align: left;
  font-size: 15px;
}

.nav-item::before {
  content: "■";
  color: #fff;
  font-size: 10px;
}

.nav-item.active,
.nav-item:hover {
  background: var(--sidebar-active);
  color: #409eff;
}

.main {
  min-width: 0;
}

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

.topbar::before {
  content: "|||";
  margin-right: 22px;
  color: #111;
  font-weight: 800;
  letter-spacing: 2px;
}

.content {
  padding: 16px 18px;
}

.app-shell:not(.flow-workbench) .content {
  padding: 0 16px 24px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric-cards {
  gap: 18px;
}

.stat-card,
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(18, 34, 66, .04);
}

.stat-card {
  min-height: 72px;
  padding: 14px 16px;
}

.stat-card p {
  margin: 0 0 6px;
  color: #94a0b2;
  font-size: 12px;
  font-weight: 600;
}

.stat-card strong {
  font-size: 25px;
  line-height: 1;
  color: #2f3b4a;
}

.panel {
  padding: 0;
}

.data-panel {
  padding: 0;
  overflow: hidden;
}

.table-panel {
  margin-bottom: 18px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 0;
  flex-wrap: wrap;
  padding: 12px 12px 10px;
  background: #fff;
}

.toolbar input {
  width: 184px;
  border: 1px solid var(--line);
  border-radius: 4px;
  min-height: 32px;
  padding: 6px 10px;
}

.toolbar select,
.toolbar a.btn {
  border: 1px solid var(--line);
  border-radius: 4px;
  min-height: 36px;
  padding: 7px 10px;
  color: var(--text);
  background: #fff;
  text-decoration: none;
}

.filterbar input { width: 200px; }

.table-wrap {
  overflow-x: auto;
}

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

.flow-table {
  min-width: 1460px;
}

.info-table,
.form-table,
.compact-table {
  min-width: 0;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 8px 9px;
  text-align: left;
  font-size: 12px;
  white-space: nowrap;
}

th {
  background: #f6f8fb;
  color: #64748b;
  font-weight: 600;
}

.flow-table th,
.flow-table td {
  line-height: 1.2;
}

.flow-table th:first-child,
.flow-table td:first-child {
  padding-left: 16px;
}

.flow-table td:nth-child(7),
.flow-table td:nth-child(8),
.flow-table td:nth-child(9),
.flow-table td:nth-child(10),
.flow-table td:nth-child(11) {
  text-align: center;
}

.info-table th,
.form-table th {
  width: 160px;
  background: #f7f9fc;
  color: #566276;
  text-align: right;
}

.info-table td,
.form-table td {
  min-width: 220px;
  white-space: normal;
  line-height: 1.7;
}

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

.form-table textarea {
  min-height: 72px;
  resize: vertical;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 7px;
  border-radius: 9px;
  background: #ecf5ff;
  color: #409eff;
  font-size: 11px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 31px;
  height: 17px;
  background: #dce1ea;
  border-radius: 9px;
  vertical-align: middle;
}

.switch.on { background: #409eff; }
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  background: #fff;
  border-radius: 50%;
  transition: left .15s ease;
}
.switch.on::after { left: 16px; }

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  font-size: 12px;
  background: #f0f2f5;
  color: #6b7280;
}

.status.ok {
  background: #e8f7f2;
  color: #159a7b;
}

.status.off {
  background: #fef0f0;
  color: #d94848;
}

.linkish {
  color: #4d9cff;
  cursor: pointer;
  font-size: 12px;
}

.flow-table td:last-child .linkish,
.flow-table td:nth-last-child(2) .linkish {
  margin-right: 8px;
}

.detail-hero {
  margin: 0 0 12px;
  padding: 28px 26px 20px;
  border-radius: 0;
  min-height: 250px;
  box-shadow: 0 2px 8px rgba(18, 34, 66, .12);
}

.detail-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.detail-title-row h2 {
  margin: 0 8px 0 0;
  font-size: 24px;
  color: #1f2937;
}

.detail-title-row h2 span {
  color: #9aa3af;
  font-size: 17px;
  margin-left: 2px;
  font-weight: 400;
}

.share-links p {
  margin: 0 0 11px;
  font-size: 13px;
}

.share-links a {
  color: #168bff;
  text-decoration: none;
}

.share-links span {
  color: #a5adb8;
}

.copy-mini {
  cursor: pointer;
  color: #697386 !important;
}

.small-note {
  font-size: 12px;
  margin: 10px 0 0;
}

.member-board {
  padding: 10px 12px 12px;
  border-radius: 0;
  box-shadow: none;
}

.member-filter,
.member-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.member-filter input,
.member-filter select {
  width: 190px;
  min-height: 42px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  padding: 0 14px;
  color: #606266;
  background: #fff;
}

.member-filter select {
  width: 210px;
}

.filter-spacer {
  flex: 1;
}

.member-actions {
  gap: 18px;
  margin-bottom: 12px;
}

.btn.soft-success {
  color: #67c23a;
  background: #f0f9eb;
  border: 1px solid #c2e7b0;
}

.btn.soft-warning {
  color: #e6a23c;
  background: #fdf6ec;
  border: 1px solid #f5dab1;
}

.btn.soft-danger {
  color: #f56c6c;
  background: #fef0f0;
  border: 1px solid #fbc4c4;
}

.btn.primary.light {
  background: #ecf5ff;
  color: #409eff;
  border: 1px solid #b3d8ff;
}

.member-table-wrap {
  width: 1080px;
  max-width: 100%;
  overflow-x: auto;
}

.member-table {
  min-width: 1080px;
  border: 1px solid #ebeef5;
}

.member-table th,
.member-table td {
  border-right: 1px solid #ebeef5;
  text-align: center;
  color: #606266;
  font-size: 14px;
  padding: 14px 10px;
  white-space: normal;
  line-height: 1.5;
}

.member-table th {
  color: #909399;
  background: #fff;
  font-weight: 600;
}

.member-table input[type="checkbox"] {
  width: 14px;
  height: 14px;
}

.member-url {
  color: #606266;
  word-break: break-all;
  max-width: 240px;
}

.enabled-text {
  color: #20b642;
}

.pager {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #606266;
  font-size: 13px;
  padding: 10px 0 0;
}

.pager select,
.pager input {
  height: 28px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  padding: 0 8px;
  color: #606266;
  background: #fff;
}

.pager input {
  width: 46px;
  text-align: center;
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal {
  width: min(720px, calc(100vw - 28px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #fff;
  border-radius: 6px;
}

.modal.member-modal {
  width: min(1560px, calc(100vw - 80px));
  min-height: 450px;
  border-radius: 2px;
  position: relative;
}

.modal.wide { width: min(920px, calc(100vw - 28px)); }
.modal.xl { width: min(1120px, calc(100vw - 28px)); }

.modal header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}

.member-modal header {
  padding: 20px 18px;
  border-bottom: 0;
  font-size: 16px;
  color: #303133;
  font-weight: 500;
}

.modal-x {
  position: absolute;
  right: 18px;
  top: 16px;
  background: transparent;
  color: #b4bac4;
  font-size: 24px;
}

.modal .body {
  padding: 20px;
}

.member-form {
  padding: 10px 58px 90px !important;
}

.batch-row,
.member-line {
  display: grid;
  grid-template-columns: 80px 220px 440px 120px;
  align-items: start;
  gap: 18px;
  margin-bottom: 20px;
}

.batch-row label,
.member-line label {
  text-align: right;
  color: #606266;
  line-height: 36px;
  font-size: 14px;
}

.member-line label span {
  color: #f56c6c;
}

.batch-row input,
.member-line input,
.batch-row textarea {
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  min-height: 36px;
  padding: 0 12px;
  color: #606266;
}

.batch-row textarea {
  height: 48px;
  padding: 8px 12px;
  resize: vertical;
}

.round-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}

.round-btn.danger {
  background: #f56c6c;
}

.round-btn.add {
  background: #409eff;
  margin-left: 140px;
}

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

.span-2 { grid-column: span 2; }

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

.check-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.modal footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
}

.member-modal footer {
  position: absolute;
  right: 18px;
  bottom: 18px;
  border-top: 0;
  padding: 0;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel-title {
  margin: 0 0 14px;
  font-weight: 700;
  color: #2f3b4a;
}

.compact-table {
  min-width: 560px;
}

.inline-input {
  width: 150px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 8px;
}

.wide-input { width: 360px; }
.mini-input { width: 72px; }

.target-add input:nth-child(2) { width: 360px; }
.target-add input:nth-child(3) { width: 80px; }

.detail-list p {
  margin: 0 0 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.narrow-form {
  max-width: 360px;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 24px 10px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.muted { color: var(--muted); }
.linkish { color: #4d9cff; cursor: pointer; font-size: 12px; }
.danger-text { color: var(--danger); }
.error { color: var(--danger); margin-top: 12px; min-height: 20px; }

@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; padding: 28px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: flex; overflow-x: auto; padding: 0; }
  .brand { display: none; }
  .nav-item { white-space: nowrap; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .home-grid { grid-template-columns: 1fr; }
  .info-table th,
  .form-table th {
    width: 110px;
  }
}
