:root {
  color-scheme: light;
  --bg: #f3f6f7;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --surface-tint: #eef6f4;
  --ink: #17212b;
  --text: #26323f;
  --muted: #6d7a87;
  --line: #dce5e8;
  --line-strong: #c9d5da;
  --brand: #0f766e;
  --brand-strong: #0b5f59;
  --brand-soft: #e4f4f1;
  --blue: #2563eb;
  --amber: #b45309;
  --red: #b42318;
  --ok: #137547;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 16px 40px rgba(20, 36, 50, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

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

button {
  border: 0;
}

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

h1 {
  color: var(--ink);
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: 0;
}

h2 {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: 0;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

input::placeholder,
textarea::placeholder {
  color: #8a98a6;
  opacity: 1;
}

select[multiple] {
  height: auto;
  min-height: 172px;
  padding: 8px;
}

select option {
  padding: 8px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.primary-action,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 120ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.primary-action {
  padding: 0 16px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.primary-action:hover {
  background: var(--brand-strong);
}

.primary-action.wide {
  width: 100%;
}

.icon-button {
  min-width: 74px;
  padding: 0 13px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.icon-button.slim {
  min-width: 54px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 13px;
}

.icon-button.danger {
  border-color: #f3c8c4;
  background: #fff7f7;
  color: var(--red);
}

.text-button {
  white-space: nowrap;
}

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

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

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

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

.panel-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.panel-head.compact {
  margin-bottom: 14px;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--muted);
  font-size: 13px;
}

.check-row input {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--brand);
}

.status-pill,
.state-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #fde5c7;
  border-radius: 999px;
  background: #fff8ed;
  color: var(--amber);
  white-space: nowrap;
  font-size: 13px;
  font-weight: 650;
}

.status-pill.ok,
.state-chip[data-kind="ok"] {
  border-color: #c8eadc;
  background: #ebf8f2;
  color: var(--ok);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  min-width: 180px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #101827;
  color: #fff;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast[data-kind="warn"] {
  background: #7c2d12;
}

.app-shell {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(238, 246, 244, 0.8), rgba(243, 246, 247, 0) 360px),
    var(--bg);
}

.app-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
}

.app-brand {
  display: grid;
  gap: 10px;
  padding: 4px 6px 22px;
  border-bottom: 1px solid var(--line);
}

.app-brand span {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 7px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
}

.app-brand strong {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.25;
}

.app-nav {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.app-nav button,
.nav-logout {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  color: #4b5a68;
  cursor: pointer;
  text-align: left;
  font-weight: 650;
}

.app-nav button:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.app-nav button.active {
  background: #102a27;
  color: #fff;
  box-shadow: 0 12px 28px rgba(16, 42, 39, 0.16);
}

.nav-logout {
  margin-top: auto;
  border: 1px solid var(--line);
  background: #fff;
  text-align: center;
}

.nav-logout:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.app-main {
  min-width: 0;
  width: min(1360px, 100%);
  margin: 0 auto;
  padding: 30px;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.app-header p {
  margin-top: 8px;
  max-width: 640px;
  color: var(--muted);
  line-height: 1.65;
}

.metric-strip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.module-section {
  display: none;
  min-width: 0;
}

.module-section.active {
  display: block;
}

.app-main .panel {
  padding: 20px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.side-stack {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.batch-panel {
  min-height: 0;
}

.batch-panel textarea {
  min-height: 218px;
  border-color: #d6e0e4;
  background: #fbfdfd;
  font-family: Consolas, "SFMono-Regular", "Microsoft YaHei", monospace;
  line-height: 1.65;
}

#recipient-select {
  height: 178px;
  min-height: 178px;
}

.parsed-table-wrap,
.table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.parsed-table,
.member-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.parsed-table {
  min-width: 760px;
}

.member-table {
  min-width: 780px;
}

.parsed-table th,
.parsed-table td,
.member-table th,
.member-table td {
  padding: 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.parsed-table th,
.member-table th {
  background: #f5f8f9;
  color: #657482;
  font-size: 12px;
  font-weight: 800;
}

.parsed-table tr:last-child td,
.member-table tr:last-child td {
  border-bottom: 0;
}

.parsed-table td:first-child {
  width: 39%;
}

.parsed-table td:nth-child(2) {
  width: 15%;
}

.parsed-table td:nth-child(3) {
  width: 29%;
}

.parsed-table td:nth-child(4) {
  width: 10%;
  white-space: nowrap;
}

.parsed-table td:nth-child(5) {
  width: 7%;
  white-space: nowrap;
}

.parsed-table input,
.table-input {
  height: 36px;
  border-radius: 7px;
}

.status-ok {
  color: var(--ok);
  font-weight: 700;
}

.status-warn {
  color: var(--amber);
  font-weight: 700;
}

.action-panel {
  display: grid;
  gap: 12px;
  background: #102a27;
  color: #d6ebe7;
}

.action-panel h2 {
  color: #fff;
}

.action-panel .muted {
  color: #b7cbc8;
  font-size: 13px;
  line-height: 1.65;
}

.action-panel .primary-action {
  background: #ffffff;
  color: #102a27;
}

.action-panel .primary-action:hover {
  background: #e8f3f1;
}

.result-panel[hidden] {
  display: none;
}

.result-list {
  display: grid;
  gap: 10px;
}

.result-row {
  display: grid;
  gap: 4px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.result-row.ok {
  border-color: #bde7d2;
}

.result-row.fail {
  border-color: #f1c6a4;
}

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

.link-list {
  display: grid;
  gap: 7px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.link-list a {
  overflow: hidden;
  color: var(--brand);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.members-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.wide-panel {
  grid-column: 1 / -1;
}

.module-form {
  display: grid;
  gap: 14px;
}

.member-table td:first-child,
.member-table td:nth-child(2) {
  width: 220px;
}

.member-table td:nth-child(3) {
  min-width: 260px;
}

.member-table small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.member-table code {
  display: block;
  max-width: 390px;
  overflow: hidden;
  color: #4f6070;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-actions {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.followers-panel {
  background: #fbfdfd;
}

.followers-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  margin-top: 12px;
  padding-right: 4px;
}

.follower-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.follower-main {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.follower-main img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-soft);
}

.follower-main strong,
.follower-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.follower-main small {
  color: var(--muted);
  font-size: 12px;
}

.follower-row input {
  height: 36px;
  border-radius: 7px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.kv-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.kv-list div {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.kv-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.kv-list dt {
  color: var(--muted);
}

.kv-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.timeline-list {
  display: grid;
  gap: 10px;
}

.timeline-row {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, #eef7f5, #f5f7f8 55%, #f3f6f7),
    var(--bg);
}

.login-panel {
  width: min(420px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.brand-mark {
  width: fit-content;
  margin-bottom: 16px;
  padding: 6px 10px;
  border-radius: 7px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
}

.login-panel p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.65;
}

.login-form {
  display: grid;
  gap: 15px;
  margin-top: 24px;
}

.login-form .primary-action {
  width: 100%;
}

.form-error {
  min-height: 20px;
  color: var(--red) !important;
}

.login-hint {
  font-size: 13px;
}

.share-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.share-hero {
  display: grid;
  width: min(720px, 100%);
  gap: 16px;
}

.share-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 22px;
  min-height: 184px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.share-card h1 {
  font-size: 28px;
  line-height: 1.45;
}

.share-card p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 18px;
}

.share-thumb {
  width: 112px;
  height: 112px;
  border-radius: 8px;
  align-self: end;
  background-color: var(--surface-soft);
  background-position: center;
  background-size: cover;
}

.share-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.share-actions .primary-action {
  min-width: 136px;
}

@media (max-width: 1180px) {
  .workspace-grid,
  .members-grid,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .followers-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: static;
    min-height: auto;
    padding: 16px;
  }

  .app-brand {
    padding-bottom: 14px;
  }

  .app-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 14px;
  }

  .app-nav button {
    min-height: 40px;
    padding: 0 8px;
    text-align: center;
    font-size: 13px;
  }

  .nav-logout {
    margin-top: 12px;
  }

  .app-main {
    padding: 18px 12px 24px;
  }

  .app-header {
    flex-direction: column;
  }

  .metric-strip {
    justify-content: flex-start;
  }

  .panel-head {
    flex-direction: column;
  }

  .parsed-table,
  .member-table {
    min-width: 720px;
  }

  .share-card {
    grid-template-columns: minmax(0, 1fr) 88px;
    padding: 20px;
  }

  .share-card h1 {
    font-size: 24px;
  }

  .share-thumb {
    width: 88px;
    height: 88px;
  }

  .share-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
