:root {
  --ink: #172033;
  --muted: #657184;
  --line: #d8e0ea;
  --panel: #ffffff;
  --page: #f3f6f9;
  --navy: #121a2a;
  --teal: #0f766e;
  --blue: #2563eb;
  --red: #be123c;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(18, 26, 42, 0.1), rgba(243, 246, 249, 0) 260px),
    var(--page);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.app-header {
  color: #fff;
  background: var(--navy);
  border-bottom: 4px solid var(--teal);
}

.header-inner {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.header-inner h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  font-weight: 700;
  letter-spacing: 0;
}

.header-inner p {
  margin: 5px 0 0;
  color: rgba(255, 255, 255, 0.72);
}

.header-actions,
.viewer-actions,
.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  border-radius: 6px;
  font-weight: 600;
}

.btn-primary {
  background: var(--teal);
  border-color: var(--teal);
}

.btn-primary:hover,
.btn-primary:focus {
  background: #0b5f59;
  border-color: #0b5f59;
}

.toolbar-panel,
.file-panel,
.structure-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.toolbar-panel {
  min-height: 70px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.file-summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.file-summary span,
.panel-title span,
.help-box span {
  color: var(--muted);
  font-size: 0.9rem;
}

.file-summary strong {
  font-size: 1.7rem;
  line-height: 1;
}

.viewer-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.file-panel,
.structure-panel {
  padding: 18px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title h2 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 700;
}

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

.file-item {
  width: 100%;
  min-height: 76px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #f8fafc;
  text-align: left;
}

.file-item:hover,
.file-item.active {
  border-color: var(--teal);
  background: rgba(15, 118, 110, 0.08);
}

.file-name {
  max-width: 100%;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.help-box {
  margin-top: 16px;
  padding: 14px;
  display: grid;
  gap: 6px;
  border-radius: 8px;
  background: #eef6f5;
  border: 1px solid rgba(15, 118, 110, 0.16);
}

.main-viewer-shell {
  position: relative;
  min-height: 620px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #101827;
}

.main-viewer {
  position: absolute;
  inset: 0;
}

.viewer-status {
  position: absolute;
  left: 16px;
  bottom: 16px;
  max-width: calc(100% - 32px);
  padding: 8px 12px;
  color: #dbeafe;
  background: rgba(15, 23, 42, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  font-size: 0.9rem;
  pointer-events: none;
}

.viewer-status.error {
  color: #ffe4e6;
  background: rgba(127, 29, 29, 0.82);
}

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

  .main-viewer-shell {
    min-height: 540px;
  }
}

@media (max-width: 680px) {
  .app-header .container-fluid,
  main.container-fluid {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  .header-inner,
  .toolbar-panel,
  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-inner {
    padding: 16px 0;
  }

  .main-viewer-shell {
    min-height: 430px;
  }
}
