:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f0f2f5;
  --text: #1d1d1f;
  --muted: #70737a;
  --line: #e4e6eb;
  --blue: #0071e3;
  --xhs: #ff335f;
  --dy: #111318;
  --green: #24a148;
  --orange: #ff9f0a;
  --shadow: 0 16px 44px rgba(25, 28, 33, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

.login-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 30% 20%, rgba(0, 113, 227, 0.12), transparent 32%),
    radial-gradient(circle at 70% 80%, rgba(255, 51, 95, 0.12), transparent 28%),
    var(--bg);
  z-index: 10;
}

.login-screen.hidden {
  display: none;
}

.login-card {
  width: min(100%, 460px);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 30px 90px rgba(20, 24, 32, 0.12);
  backdrop-filter: blur(24px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-logo {
  width: 58px;
  height: 46px;
  object-fit: contain;
}

.login-brand h1 {
  font-size: 30px;
  color: #052f7f;
}

.login-brand p,
.login-copy p,
.login-error {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.login-copy {
  margin: 30px 0 22px;
}

.login-copy h2 {
  margin-bottom: 10px;
  font-size: 22px;
}

.login-actions {
  display: grid;
  gap: 10px;
}

.wecom-login,
.dev-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 700;
}

.wecom-login {
  background: #1aad19;
  color: #fff;
}

.dev-login {
  background: var(--surface-soft);
  color: var(--text);
}

.login-error {
  min-height: 22px;
  margin-top: 14px;
  color: var(--orange);
}

.shell.locked {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
}

.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 64px 1fr;
  min-height: 100vh;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 22px;
  background: rgba(255, 255, 255, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 198px;
}

.brand-logo {
  width: 48px;
  height: 34px;
  object-fit: contain;
  object-position: left center;
  flex: 0 0 auto;
}

.brand strong {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
  color: #052f7f;
}

.platform-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.nav-tab,
.side-item,
.ghost,
.chip,
.login-btn {
  min-height: 36px;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.nav-tab {
  padding: 0 14px;
}

.nav-tab.active {
  background: #fff0f4;
  color: var(--xhs);
  box-shadow: inset 0 0 0 1px rgba(255, 51, 95, 0.12);
}

.login-btn {
  padding: 0 14px;
  background: var(--surface-soft);
  color: var(--text);
}

.side {
  grid-row: 2;
  padding: 18px 12px;
  background: #fff;
  border-right: 1px solid var(--line);
}

.side-item {
  width: 100%;
  text-align: left;
  padding: 0 14px;
  margin-bottom: 8px;
}

.side-item.active {
  background: var(--xhs);
  color: #fff;
  box-shadow: 0 10px 24px rgba(255, 51, 95, 0.22);
}

.main {
  grid-column: 2;
  grid-row: 2;
  padding: 26px;
  min-width: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 16px;
}

.page-head p,
.panel-head p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.status-pill,
.platform-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.platform-badge.xhs {
  color: var(--xhs);
  background: #fff0f4;
  border-color: rgba(255, 51, 95, 0.18);
}

.platform-badge.douyin {
  color: #fff;
  background: var(--dy);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card,
.panel,
.setting-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 18px;
}

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

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.two-col,
.studio-grid,
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.panel {
  overflow: hidden;
}

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

.ghost,
.chip {
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.primary {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  background: var(--xhs);
  color: #fff;
  font-weight: 700;
}

.primary.dark {
  background: var(--dy);
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px auto;
  gap: 12px;
  padding: 18px;
  margin-bottom: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}

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

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

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.chip.active {
  color: var(--xhs);
  background: #fff0f4;
  border-color: rgba(255, 51, 95, 0.2);
}

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

.result-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.result-cover {
  display: grid;
  place-items: center;
  height: 122px;
  background: linear-gradient(135deg, #f8f9fb, #eef1f5);
  color: var(--muted);
  font-weight: 800;
}

.result-card.douyin .result-cover {
  background: linear-gradient(135deg, #111318, #2b6de9);
  color: #fff;
}

.result-body {
  padding: 14px;
}

.result-body h3 {
  min-height: 44px;
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 12px;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.score {
  color: var(--green);
  font-weight: 800;
}

.item-list {
  padding: 12px;
}

.item-list.large {
  padding: 0;
}

.list-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 13px;
  border-radius: 14px;
  background: #f9fafb;
  margin-bottom: 10px;
}

.list-row strong {
  display: block;
  font-size: 14px;
}

.list-row span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.config-list {
  padding: 14px;
}

.config-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.config-row:last-child {
  border-bottom: 0;
}

.ok {
  color: var(--green);
}

.missing {
  color: var(--orange);
}

.materials-layout {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 18px;
}

.library-tabs {
  display: grid;
  align-content: start;
  gap: 8px;
}

.library-tabs button {
  min-height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  text-align: left;
}

.library-tabs button.active {
  background: var(--text);
  color: #fff;
}

.form-stack {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.form-stack label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.draft-box {
  min-height: 320px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  white-space: pre-wrap;
  font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: #fbfcfd;
}

.setting-card {
  padding: 18px;
}

.setting-card code {
  display: inline-block;
  margin: 12px 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f1f3f6;
  color: var(--muted);
  font-size: 12px;
}

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

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

  .side {
    display: none;
  }

  .main {
    grid-column: 1;
  }

  .brand {
    width: auto;
  }

  .stats-grid,
  .results-grid,
  .two-col,
  .studio-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    height: auto;
    flex-direction: column;
    padding: 14px;
  }

  .main {
    padding: 16px;
  }

  .page-head,
  .search-panel {
    grid-template-columns: 1fr;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .materials-layout {
    grid-template-columns: 1fr;
  }
}
