/* 奕境 DMS · PC 固定外壳 */
html,
body.pc-shell-host {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg-page);
  color: var(--text-primary);
}

body.pc-shell-host {
  --dms-shell-topbar-height: 48px;
  --dms-shell-sidebar-width: 224px;
  --dms-prd-width: 420px;
  font-family: var(--font-family-base);
}

.pc-shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-columns: var(--dms-shell-sidebar-width) minmax(480px, 1fr) 8px var(--dms-prd-width);
  grid-template-rows: var(--dms-shell-topbar-height) minmax(0, 1fr);
  background: var(--bg-page);
}

body.pc-shell-prd-collapsed .pc-shell {
  grid-template-columns: var(--dms-shell-sidebar-width) minmax(480px, 1fr) 0 0;
}

.pc-shell-sidebar {
  grid-column: 1;
  grid-row: 1 / 3;
  width: var(--dms-shell-sidebar-width);
  min-width: var(--dms-shell-sidebar-width);
  height: 100vh;
  overflow: hidden;
  border-right: 1px solid var(--border-light);
  background: var(--sidebar-bg);
}

.pc-shell-sidebar .sidebar-brand {
  border-bottom: 1px solid var(--border-light);
}

.pc-shell-sidebar-search {
  padding: 12px 12px 8px;
  border-bottom: 1px solid var(--border-light);
}

.pc-shell-sidebar-search .topbar-search {
  width: 100%;
  height: 34px;
  background: var(--bg-input);
}

.pc-shell-sidebar .sidebar-menu {
  height: calc(100vh - var(--dms-shell-topbar-height) - 55px);
}

.pc-shell-main {
  grid-column: 2;
  grid-row: 1 / 3;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: var(--dms-shell-topbar-height) minmax(0, 1fr) 32px;
}

.pc-shell-topbar {
  grid-row: 1;
  height: var(--dms-shell-topbar-height);
  min-height: var(--dms-shell-topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  box-sizing: border-box;
}

.pc-shell-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
}

.pc-shell-title strong {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-shell-title .muted {
  max-width: 520px;
  overflow: hidden;
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-regular);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-shell-tools {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pc-shell-tools .topbar-search {
  width: 240px;
}

.pc-shell-tools .topbar-icon {
  width: 32px;
  border: 1px solid transparent;
  box-sizing: border-box;
}

.pc-shell-tools .topbar-icon.active,
.pc-shell-tools .pc-shell-prd-toggle.active {
  border-color: rgba(134, 27, 47, 0.18);
  background: var(--sidebar-active-bg);
  color: var(--brand-primary);
}

.pc-shell-prd-toggle {
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.pc-shell-prd-toggle:hover {
  border-color: rgba(134, 27, 47, 0.24);
  color: var(--brand-primary);
}

.pc-shell-prd-toggle.active {
  border-color: rgba(134, 27, 47, 0.28);
  background: var(--sidebar-active-bg);
  color: var(--brand-primary);
}

.pc-shell-preview {
  position: relative;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-page);
}

.pc-shell-frame {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: var(--bg-page);
  opacity: 1;
  transition: opacity 120ms ease;
}

.pc-shell-frame.is-loading {
  opacity: 0;
}

.pc-shell-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  display: none;
  min-width: 112px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  box-shadow: var(--shadow-sm);
  transform: translate(-50%, -50%);
  z-index: 10;
}

.pc-shell-preview.is-loading .pc-shell-loading {
  display: inline-flex;
}

.pc-shell-prd {
  grid-column: 4;
  grid-row: 1 / 3;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-card);
  border-left: 1px solid var(--border-light);
}

body.pc-shell-prd-collapsed .pc-shell-prd {
  display: none;
}

.pc-shell-prd-resizer {
  grid-column: 3;
  grid-row: 1 / 3;
  position: relative;
  cursor: col-resize;
  background: var(--bg-card);
  border-left: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  z-index: 5;
}

.pc-shell-prd-resizer::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--border-default);
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.15s, background 0.15s;
}

.pc-shell-prd-resizer:hover::after,
body.pc-shell-resizing .pc-shell-prd-resizer::after {
  background: var(--brand-primary);
  opacity: 1;
}

body.pc-shell-prd-collapsed .pc-shell-prd-resizer {
  display: none;
}

body.pc-shell-resizing,
body.pc-shell-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.pc-shell-prd .dms-prd-panel {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-left: 0;
  flex-basis: auto;
  background: var(--bg-card);
  color: var(--text-primary);
}

.pc-shell-prd .dms-prd-resizer {
  display: none;
}

.pc-shell-prd .dms-prd-head {
  min-height: var(--dms-shell-topbar-height);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title badge"
    "tabs current";
  gap: 8px 12px;
  align-items: center;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-card);
  box-sizing: border-box;
}

.pc-shell-prd .dms-prd-head > div:first-child {
  grid-area: title;
  min-width: 0;
}

.pc-shell-prd .dms-prd-eyebrow {
  margin-bottom: 4px;
  color: var(--brand-primary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
}

.pc-shell-prd .dms-prd-title {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  line-height: 1.25;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-shell-prd .dms-prd-badge {
  grid-area: badge;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border-radius: var(--radius-full);
  background: var(--bg-page);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}

.pc-shell-prd .dms-prd-tabs {
  grid-area: tabs;
  display: inline-flex;
  justify-self: start;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
}

.pc-shell-prd .dms-prd-tabs button {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--font-size-sm);
  cursor: pointer;
}

.pc-shell-prd .dms-prd-tabs button.active {
  background: var(--bg-card);
  color: var(--brand-primary);
  font-weight: var(--font-weight-semibold);
  box-shadow: 0 1px 3px rgba(20, 27, 39, 0.08);
}

.pc-shell-prd .dms-prd-current {
  grid-area: current;
  justify-self: end;
  align-self: center;
  max-width: 46%;
  overflow: hidden;
  color: var(--text-tertiary);
  font-size: var(--font-size-xs);
  line-height: 1.45;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-shell-prd .dms-prd-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 24px;
  background: var(--bg-page);
}

.pc-shell-prd .dms-prd-meta {
  margin-bottom: 12px;
  padding: 12px;
  display: grid;
  gap: 7px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  line-height: 1.5;
}

.pc-shell-prd .dms-prd-meta p {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-shell-prd .dms-prd-meta strong {
  color: var(--text-primary);
  font-weight: var(--font-weight-semibold);
}

.pc-shell-prd .dms-prd-empty,
.pc-shell-prd .prd-feature-empty {
  padding: 22px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-secondary);
  text-align: center;
  font-size: var(--font-size-sm);
}

.pc-shell-prd .dms-prd-doc {
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  line-height: 1.72;
}

.pc-shell-prd .prd-md h1,
.pc-shell-prd .prd-md h2,
.pc-shell-prd .prd-md h3,
.pc-shell-prd .prd-md h4 {
  margin: 18px 0 8px;
  color: var(--text-primary);
  font-weight: var(--font-weight-semibold);
  line-height: 1.3;
  letter-spacing: 0;
}

.pc-shell-prd .prd-md h1:first-child,
.pc-shell-prd .prd-md h2:first-child,
.pc-shell-prd .prd-md h3:first-child {
  margin-top: 0;
}

.pc-shell-prd .prd-md h1 { font-size: var(--font-size-xl); }
.pc-shell-prd .prd-md h2 { font-size: var(--font-size-lg); }
.pc-shell-prd .prd-md h3 { font-size: var(--font-size-md); }
.pc-shell-prd .prd-md h4 { font-size: var(--font-size-base); }

.pc-shell-prd .prd-md p,
.pc-shell-prd .prd-md ul,
.pc-shell-prd .prd-md ol,
.pc-shell-prd .prd-md blockquote,
.pc-shell-prd .prd-md .prd-md-table-wrap,
.pc-shell-prd .prd-md .prd-md-diagram,
.pc-shell-prd .prd-md .prd-md-code {
  margin: 8px 0;
}

.pc-shell-prd .prd-md p {
  color: var(--text-secondary);
}

.pc-shell-prd .prd-md ul,
.pc-shell-prd .prd-md ol {
  padding-left: 18px;
  color: var(--text-secondary);
}

.pc-shell-prd .prd-md li + li {
  margin-top: 4px;
}

.pc-shell-prd .prd-md blockquote {
  padding: 10px 12px;
  border-left: 3px solid var(--brand-primary);
  border-radius: var(--radius-md);
  background: var(--brand-50, #fdf3f3);
  color: var(--text-secondary);
}

.pc-shell-prd .prd-md code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--bg-page);
  color: var(--func-id-color);
  font-family: var(--font-mono);
  font-size: 12px;
}

.pc-shell-prd .prd-md .prd-md-code {
  overflow-x: auto;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.5;
}

.pc-shell-prd .prd-md .prd-md-table-wrap,
.pc-shell-prd .prd-feature-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.pc-shell-prd .prd-md table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.pc-shell-prd .prd-md th,
.pc-shell-prd .prd-md td {
  padding: 8px 9px;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.pc-shell-prd .prd-md th {
  background: var(--bg-table-header);
  color: var(--text-primary);
  font-weight: var(--font-weight-semibold);
}

.pc-shell-prd .prd-md tr:last-child td {
  border-bottom: none;
}

.pc-shell-prd .prd-md .prd-md-diagram {
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-page);
}

.pc-shell-prd .prd-md .prd-md-diagram-title {
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.pc-shell-prd .prd-feature-doc {
  display: grid;
  gap: 12px;
}

.pc-shell-prd .prd-feature-intro {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-left: 3px solid var(--brand-primary);
  border-radius: var(--radius-sm);
  background: var(--brand-50, #fdf3f3);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.6;
}

.pc-shell-prd .prd-feature-intro strong {
  color: var(--text-primary);
}

.pc-shell-prd .prd-feature-card {
  padding: 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.pc-shell-prd .prd-feature-card.is-located {
  border-color: var(--brand-primary);
  background: var(--brand-50, #fdf3f3);
  box-shadow: 0 0 0 2px rgba(134, 27, 47, 0.08);
}

.pc-shell-prd .prd-feature-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.pc-shell-prd .prd-feature-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.pc-shell-prd .prd-feature-seq {
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: #ff6700ba;
  color: #ffffff;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  flex-shrink: 0;
}

.pc-shell-prd .prd-feature-level {
  color: var(--brand-primary);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  flex-shrink: 0;
}

.pc-shell-prd .prd-feature-card h3,
.pc-shell-prd .prd-feature-meta h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pc-shell-prd .prd-feature-back {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
}

.pc-shell-prd .prd-feature-back:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.pc-shell-prd .prd-feature-summary {
  margin: 8px 0 12px;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.65;
}

.pc-shell-prd .prd-feature-groups {
  display: grid;
  gap: 12px;
}

.pc-shell-prd .prd-feature-group h4 {
  margin: 0 0 6px;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  line-height: 1.4;
}

.pc-shell-prd .prd-feature-group summary {
  min-height: 34px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  color: var(--text-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  list-style: none;
}

.pc-shell-prd .prd-feature-group summary::-webkit-details-marker {
  display: none;
}

.pc-shell-prd .prd-feature-group ul {
  margin: 0;
  padding: 0 0 0 18px;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.65;
}

.pc-shell-prd .prd-feature-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  line-height: 1.5;
  table-layout: fixed;
}

.pc-shell-prd .prd-feature-table th,
.pc-shell-prd .prd-feature-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  text-align: left;
  word-break: break-word;
}

.pc-shell-prd .prd-feature-table th {
  background: var(--bg-table-header);
  color: var(--text-primary);
  font-weight: var(--font-weight-semibold);
}

.pc-shell-prd .prd-feature-table th + th,
.pc-shell-prd .prd-feature-table td + td {
  border-left: 1px solid var(--border-light);
}

.pc-shell-prd .prd-feature-table tbody tr:last-child td {
  border-bottom: 0;
}

.pc-shell-prd .prd-feature-field-table th:first-child,
.pc-shell-prd .prd-feature-field-table td:first-child {
  width: 96px;
  color: var(--text-primary);
  font-weight: var(--font-weight-semibold);
}

.pc-shell-prd .prd-feature-field-table th:last-child,
.pc-shell-prd .prd-feature-field-table td:last-child {
  width: 96px;
  color: var(--text-tertiary);
}

.pc-shell-locator-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  pointer-events: none;
}

.pc-shell-locator-layer.show {
  display: block;
}

.pc-shell-locator-layer .prd-locator-dot {
  position: absolute;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  background: #ff6700ba;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(20, 27, 39, 0.22);
  cursor: pointer;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}

.pc-shell-locator-layer .prd-locator-dot.is-action {
  background: #ff6700ba;
}

.prd-target-flash {
  outline: 2px solid var(--brand-primary) !important;
  outline-offset: 3px;
  transition: outline-color 0.2s ease;
}

.pc-shell-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
}

/* Bottom open-tabs bar */
.pc-shell-main > .bottom-tabbar {
  grid-row: 3;
  height: 32px;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  background: var(--bg-card);
  border-top: 1px solid var(--border-light);
}

.pc-shell-main > .bottom-tabbar .open-tab {
  appearance: none;
  border: 0;
  border-right: 1px solid var(--border-light);
  font: inherit;
  font-size: var(--font-size-sm);
  flex: 0 0 auto;
  min-width: 100px;
  max-width: 180px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--text-secondary);
  background: var(--bg-card);
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, color 0.12s;
}

.pc-shell-main > .bottom-tabbar .open-tab:hover {
  background: var(--bg-page);
}

.pc-shell-main > .bottom-tabbar .open-tab.active {
  background: var(--brand-primary);
  color: #fff;
}

.pc-shell-main > .bottom-tabbar .open-tab-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-shell-main > .bottom-tabbar .open-tab-close {
  width: 18px;
  height: 18px;
  margin-left: 2px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  display: inline-grid;
  place-items: center;
  background: transparent;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  flex: 0 0 auto;
}

.pc-shell-main > .bottom-tabbar .open-tab-close:hover {
  background: rgba(93, 101, 114, 0.12);
  opacity: 1;
}

.pc-shell-main > .bottom-tabbar .open-tab.active .open-tab-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.pc-shell-main > .bottom-tabbar .open-tab-close .dms-icon {
  width: 14px;
  height: 14px;
}

@media (max-width: 1280px) {
  body.pc-shell-host {
    --dms-shell-sidebar-width: 208px;
    --dms-prd-width: 380px;
  }

  .pc-shell-tools .topbar-search {
    width: 200px;
  }
}
