/**
 * 制作台 · 顶栏/品牌/小说上下文（P-css-n：自 shell.css 再外置；原 P-css-l）
 * 加载：须在 ink-gag-studio-shell.css 之后。
 */

/* ========== 社区智能体回跳 Tab（顶栏下） ========== */
.igs-agent-tabs {
  display: block;
  border-bottom: 1px solid var(--igs-line, rgba(26, 46, 40, 0.12));
  background: color-mix(in srgb, var(--igs-accent, #1f6b58) 6%, #fffef8);
  padding: 0.28rem 0.75rem 0.35rem;
  position: sticky;
  top: var(--igs-top-sticky-offset, 3.1rem);
  z-index: 39;
}
.igs-agent-tabs[hidden] {
  display: none !important;
}
.igs-agent-tabs__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.4rem;
  max-width: 100%;
}
.igs-agent-tabs__chip {
  display: inline-flex;
  align-items: stretch;
  max-width: min(16rem, 72vw);
  border-radius: 0.45rem;
  border: 1px solid color-mix(in srgb, var(--igs-line, #c5d0ca) 90%, transparent);
  background: #fff;
  overflow: hidden;
}
.igs-agent-tabs__tab {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.28rem 0.55rem;
  border: 0;
  background: transparent;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  line-height: 1.2;
}
.igs-agent-tabs__tab.is-active {
  background: color-mix(in srgb, var(--igs-accent, #1f6b58) 14%, #fff);
  font-weight: 650;
  border-radius: 0.45rem;
  border: 1px solid color-mix(in srgb, var(--igs-accent, #1f6b58) 35%, transparent);
}
button.igs-agent-tabs__tab.is-active {
  padding: 0.32rem 0.7rem;
}
.igs-agent-tabs__lab {
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 12rem;
}
.igs-agent-tabs__sub {
  font-size: 0.65rem;
  font-style: normal;
  color: var(--igs-muted, #5a6b64);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 12rem;
}
.igs-agent-tabs__x {
  flex: 0 0 auto;
  border: 0;
  border-left: 1px solid color-mix(in srgb, var(--igs-line, #c5d0ca) 80%, transparent);
  background: transparent;
  color: var(--igs-muted, #5a6b64);
  padding: 0 0.4rem;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
}
.igs-agent-tabs__x:hover {
  color: #a33;
  background: color-mix(in srgb, #a33 8%, #fff);
}
.igs-agent-tabs__hint {
  margin: 0.2rem 0 0;
  font-size: 0.62rem;
  color: var(--igs-muted, #5a6b64);
}
@media (max-width: 720px) {
  .igs-agent-tabs__hint {
    display: none;
  }
  .igs-agent-tabs {
    top: var(--igs-top-sticky-offset-mobile, 2.75rem);
  }
}

/* ========== P-css-l · 顶栏/品牌/小说上下文（自主 CSS 迁入） ========== */
.igs-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--igs-line);
  background: rgba(255, 252, 246, 0.94);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 40;
}
.igs-top--slim {
  padding: 0.4rem 0.85rem;
}
.igs-brand { display: flex; gap: 0.55rem; align-items: center; min-width: 0; }
.igs-mark {
  width: 2.15rem; height: 2.15rem; border-radius: 0.55rem;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #2a8a70, var(--igs-accent));
  color: #f7fff9;
  font-family: var(--igs-serif); font-weight: 700; font-size: 1.1rem;
  box-shadow: 0 4px 12px rgba(31, 107, 88, 0.28);
  flex-shrink: 0;
}
.igs-brand__copy { min-width: 0; }
.igs-brand__row {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
  flex-wrap: nowrap;
}
.igs-brand h1,
.igs-brand #igsBrandTitle {
  margin: 0;
  font-family: var(--igs-serif);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.igs-brand__novel {
  display: inline-block;
  min-width: 0;
  max-width: min(18rem, 32vw);
  margin: 0;
  padding: 0.08rem 0.4rem;
  border-radius: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--igs-muted, #5a6b64);
  background: color-mix(in srgb, var(--igs-ink, #1a2e28) 5%, #fff);
  border: 1px solid color-mix(in srgb, var(--igs-line, rgba(0,0,0,.1)) 80%, transparent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: baseline;
}
.igs-brand__novel[hidden] { display: none !important; }
.igs-brand p { margin: 0.1rem 0 0; color: var(--igs-muted); font-size: 0.72rem; }
.igs-brand__season { display: none !important; }
/* 小说切换已迁至流水线行 · .igs-pipe-project */
.igs-novel-ctx {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem 1rem;
  margin: 0 0 0.65rem;
  padding: 0.45rem 0.7rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(40, 36, 30, 0.1);
  background: linear-gradient(180deg, rgba(247, 243, 234, 0.95), rgba(255, 255, 255, 0.72));
}
.igs-novel-ctx-lead {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  flex: 1 1 14rem;
  max-width: 22rem;
  padding: 0.14rem 0.25rem 0.14rem 0.5rem;
  border-radius: 0.6rem;
  border: 1px solid color-mix(in srgb, var(--igs-accent) 18%, var(--igs-line));
  background: rgba(255, 255, 255, 0.72);
}
.igs-novel-ctx-lab {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.1rem 0.38rem;
  border-radius: 0.35rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #1a5c45;
  background: rgba(31, 107, 88, 0.12);
  white-space: nowrap;
}
.igs-novel-ctx-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  font-size: 0.78rem;
}
.igs-novel-ctx-meta strong {
  font-family: var(--igs-serif);
  font-size: 0.95rem;
}
.igs-novel-ctx-meta code {
  font-size: 0.72rem;
  padding: 0.1rem 0.35rem;
  border-radius: 0.35rem;
  background: rgba(31, 107, 88, 0.08);
}
.igs-project-select--ctx {
  flex: 1 1 auto;
  width: auto;
  min-width: 8rem;
  max-width: 17rem;
}
.igs-rel-page > .igs-novel-ctx,
.igs-page > .igs-novel-ctx,
.igs-hub-chrome > .igs-novel-ctx {
  margin-top: 0.15rem;
}
.igs-rel-page > .igs-novel-ctx {
  grid-column: 1 / -1;
}
.igs-top-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.igs-auth-pill {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.22rem 0.5rem;
  border-radius: 999px;
  background: #d8efe4;
  color: #1a5c45;
  white-space: nowrap;
}
.igs-auth-pill.is-locked {
  background: #f0e6d8;
  color: #6b4e2e;
}
.igs-top-actions > input,
.igs-top-more-panel input {
  border: 1px solid var(--igs-line); border-radius: 0.4rem;
  padding: 0.4rem 0.6rem; background: #fff; font-size: 0.85rem;
}
#igsGlobalSearch { min-width: 11rem; flex: 1; max-width: 18rem; }
.igs-top-more { position: relative; }
.igs-top-more > summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--igs-line);
  border-radius: 0.4rem;
  padding: 0.38rem 0.65rem;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--igs-ink);
}
.igs-top-more > summary::-webkit-details-marker { display: none; }
.igs-top-more-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.3rem);
  z-index: 50;
  min-width: 14rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.65rem;
  background: #fff;
  border: 1px solid var(--igs-line);
  border-radius: 0.6rem;
  box-shadow: 0 12px 28px rgba(20, 32, 28, 0.14);
}
.igs-top-more-panel label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.72rem;
  color: var(--igs-muted);
  font-weight: 600;
}
.igs-top-more-panel input { width: 100%; box-sizing: border-box; }
.igs-top-more-panel { min-width: 16.5rem; }
.igs-top-more-panel:has(.igs-ai-ed) {
  min-width: min(40rem, 96vw);
  max-width: min(46rem, 96vw);
  max-height: min(88vh, 54rem);
  overflow: auto;
  padding: 0.75rem 0.8rem 0.85rem;
  gap: 0.55rem;
}
.igs-top-more-hr {
  border: 0;
  border-top: 1px solid var(--igs-line);
  margin: 0.15rem 0;
}
