@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,600;8..60,700&display=swap');

:root {
  --as-ink: #132033;
  --as-muted: #5b6b7c;
  --as-line: #e2e8f0;
  --as-soft: #f4f7fa;
  --as-card: #ffffff;
  --as-side: #102033;
  --as-side-2: #16324a;
  --as-accent: #0f6e56;
  --as-accent-2: #1a5f7a;
  --as-accent-soft: rgba(15, 110, 86, 0.12);
  --as-danger: #b42318;
  --as-ok: #067647;
  --as-font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --as-display: "Source Serif 4", "Noto Serif SC", serif;
  --as-radius: 14px;
  --as-shadow: 0 14px 40px rgba(16, 32, 51, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--as-font);
  color: var(--as-ink);
  background: var(--as-soft);
  -webkit-font-smoothing: antialiased;
}

.auth-shell {
  display: flex;
  min-height: 100vh;
  background:
    radial-gradient(900px 380px at 0% 0%, rgba(15, 110, 86, 0.07), transparent 55%),
    radial-gradient(700px 320px at 100% 0%, rgba(26, 95, 122, 0.08), transparent 50%),
    var(--as-soft);
}

.auth-sidebar {
  width: 248px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  color: #dce7f0;
  background:
    linear-gradient(180deg, var(--as-side-2) 0%, var(--as-side) 55%, #0c1826 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  position: sticky;
  top: 0;
  height: 100vh;
}

.auth-brand {
  padding: 26px 20px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.auth-brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(145deg, var(--as-accent-2), var(--as-accent));
  box-shadow: 0 10px 22px rgba(15, 110, 86, 0.28);
}
.auth-brand-title {
  font-family: var(--as-display);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  color: #fff;
  letter-spacing: 0.01em;
}
.auth-brand small {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 400;
  color: #8fa3b8;
  line-height: 1.5;
}

.auth-nav {
  padding: 16px 12px;
  flex: 1;
  overflow: auto;
}
.auth-nav-label {
  padding: 4px 12px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #7f93a8;
  text-transform: uppercase;
}
.auth-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  color: #c5d4e3;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  transition: background .15s, color .15s, transform .15s;
}
.auth-nav a::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4b647a;
  flex: 0 0 auto;
}
.auth-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.auth-nav a.active {
  background: linear-gradient(90deg, rgba(15, 110, 86, 0.35), rgba(26, 95, 122, 0.2));
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.auth-nav a.active::before {
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
}

.auth-side-foot {
  padding: 14px 18px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: #7f93a8;
  line-height: 1.55;
}

.auth-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.auth-topbar {
  height: 64px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--as-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.auth-topbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--as-ink);
}
.auth-topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}
.auth-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px 0 8px;
  border-radius: 999px;
  background: #eef3f7;
  color: #334155;
  font-size: 13px;
  font-weight: 500;
}
.auth-user-chip i {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--as-accent-2), var(--as-accent));
  color: #fff;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
}

.auth-content {
  flex: 1;
  overflow: auto;
}

/* 微调 pg-* 在授权后台的观感 */
.auth-content .pg-card {
  border-radius: var(--as-radius);
  box-shadow: var(--as-shadow);
  border-color: #e8eef4;
}
.auth-content .pg-breadcrumb {
  color: var(--as-muted);
}
.auth-content .pg-btn-primary {
  background: linear-gradient(135deg, var(--as-accent-2), var(--as-accent)) !important;
  border: 0 !important;
}
.auth-content .pg-tag-success { background: #ecfdf3; color: var(--as-ok); }
.auth-content .pg-tag-info { background: #eff8ff; color: #175cd3; }

.flash-ok {
  background: #ecfdf3;
  color: var(--as-ok);
  border: 1px solid #abefc6;
  padding: 11px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
}
.flash-err {
  background: #fef3f2;
  color: var(--as-danger);
  border: 1px solid #fecdca;
  padding: 11px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
}

.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 8px;
}
.perm-group { margin-bottom: 16px; }
.perm-group-title {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 8px;
}

.as-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.as-stat-grid-2 {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 16px;
}
@media (max-width: 860px) {
  .as-stat-grid,
  .as-stat-grid-2 { grid-template-columns: 1fr; }
}
.as-stat {
  padding: 18px 18px 16px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #f8fafc);
  border: 1px solid #e8eef4;
}
.as-stat-label {
  font-size: 13px;
  color: var(--as-muted);
  font-weight: 500;
}
.as-stat-value {
  margin-top: 8px;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--as-ink);
}
.as-stat-value.is-ok { color: var(--as-ok); }
.as-stat-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--as-muted);
  line-height: 1.5;
}

/* 登录页 */
.auth-login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: #0f1c2a;
}
.auth-login-hero {
  position: relative;
  padding: 56px 56px 48px;
  color: #e8eef4;
  overflow: hidden;
  background:
    radial-gradient(700px 420px at 20% 10%, rgba(15, 110, 86, 0.35), transparent 60%),
    radial-gradient(600px 360px at 80% 80%, rgba(26, 95, 122, 0.35), transparent 55%),
    linear-gradient(160deg, #102033 0%, #0c1826 100%);
}
.auth-login-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, #000 20%, transparent 90%);
  pointer-events: none;
}
.auth-login-hero-inner { position: relative; z-index: 1; max-width: 460px; }
.auth-login-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #9fb5c8;
  margin-bottom: 28px;
}
.auth-login-kicker span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18);
}
.auth-login-hero h1 {
  margin: 0;
  font-family: var(--as-display);
  font-size: 34px;
  line-height: 1.35;
  font-weight: 700;
  color: #fff;
}
.auth-login-hero p {
  margin: 18px 0 0;
  font-size: 15px;
  line-height: 1.8;
  color: #a9bccf;
  max-width: 400px;
}
.auth-login-points {
  margin: 36px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}
.auth-login-points li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  color: #c5d4e3;
}
.auth-login-points li::before {
  content: "";
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 6px;
  flex: 0 0 auto;
  background:
    linear-gradient(#0f6e56, #0f6e56) center/8px 2px no-repeat,
    linear-gradient(#0f6e56, #0f6e56) center/2px 8px no-repeat,
    rgba(15, 110, 86, 0.25);
}

.auth-login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 28px;
  background:
    radial-gradient(500px 280px at 80% 0%, rgba(15, 110, 86, 0.08), transparent 60%),
    #f4f7fa;
}
.auth-login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid #e8eef4;
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(16, 32, 51, 0.1);
  padding: 32px 28px 28px;
}
.auth-login-card h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.auth-login-card .sub {
  margin: 8px 0 24px;
  font-size: 13px;
  color: var(--as-muted);
  line-height: 1.6;
}
.auth-login-card .pg-field { margin-bottom: 14px; }
.auth-login-card .pg-btn-primary {
  width: 100%;
  height: 44px;
  margin-top: 8px;
  background: linear-gradient(135deg, var(--as-accent-2), var(--as-accent)) !important;
  border: 0 !important;
  border-radius: 10px !important;
  font-weight: 600;
}
.auth-login-foot {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: #8a9aab;
}

@media (max-width: 960px) {
  .auth-shell { flex-direction: column; }
  .auth-sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
  .auth-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .auth-nav a { margin: 0; }
  .as-stat-grid { grid-template-columns: 1fr; }
  .auth-login-wrap { grid-template-columns: 1fr; }
  .auth-login-hero { padding: 36px 24px; min-height: auto; }
  .auth-login-hero h1 { font-size: 26px; }
}

.perm-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.perm-group-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.perm-item {
  padding: 8px 10px !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px !important;
  background: #fff;
}
.pg-tag-warning { background: #fffaeb; color: #b54708; }


/* 短剧智能体提示词 */
.pg-agent-prompt {
    white-space: pre-wrap;
    word-break: break-word;
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 12px;
    line-height: 1.55;
    color: #334155;
    margin: 8px 0 0;
    max-height: 420px;
    overflow: auto;
}

/* 短剧智能体 Tab 管理 */
.ai-agent-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 12px;
  border-bottom: 1px solid var(--as-line, #e2e8f0);
  padding-bottom: 10px;
}
.ai-agent-tabs .pg-tab {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--as-muted, #5b6b7c);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
}
.ai-agent-tabs .pg-tab:hover {
  background: rgba(15, 110, 86, 0.06);
  color: var(--as-ink, #132033);
}
.ai-agent-tabs .pg-tab-active {
  background: var(--as-accent-soft, rgba(15, 110, 86, 0.12));
  color: var(--as-accent, #0f6e56);
  border-color: rgba(15, 110, 86, 0.25);
  font-weight: 600;
}
.ai-agent-textarea {
  width: 100%;
  min-height: 280px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.ai-agent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}
.ai-agent-style-box { margin-bottom: 8px; }
.ai-agent-form .pg-section { margin-top: 8px; }

.pg-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  min-height: 40px;
  align-items: center;
}
.pg-radio-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #334155;
  cursor: pointer;
  user-select: none;
}
.pg-radio-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #1e3a5f;
}
.llm-test-result {
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
}
.llm-test-result.is-ok { color: #067647; }
.llm-test-result.is-err { color: #b42318; }
