* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f6f8;
  color: #1f2937;
}

.container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0 0 6px 0;
}

.subtitle {
  margin: 0;
  color: #6b7280;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 20px;
}

.panel {
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08);
}

.panel h2 {
  margin-top: 0;
}

.list-area {
  margin-top: 10px;
}

.item {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  background: #fff;
  cursor: pointer;
}

.item:hover {
  background: #f8fbff;
}

.item.active {
  border-color: #2563eb;
  background: #eff6ff;
}

.item-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.item-subtitle {
  font-size: 13px;
  color: #6b7280;
}

.file-row {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}

.file-row.clean {
  border-left: 5px solid #2563eb;
}

.file-row.debug {
  border-left: 5px solid #9ca3af;
  background: #fafafa;
}

.file-name {
  font-weight: 700;
  margin-bottom: 8px;
}

.file-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button,
.file-actions a,
#downloadBtn {
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  background: #e5e7eb;
  color: #111827;
  text-decoration: none;
  cursor: pointer;
  font-size: 14px;
}

button:hover,
.file-actions a:hover,
#downloadBtn:hover {
  background: #d1d5db;
}

button:disabled,
.disabled-link {
  opacity: 0.5;
  pointer-events: none;
}

.panel {
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08);
}

.viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.viewer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.viewer-meta {
  margin: 8px 0 12px;
  color: #6b7280;
  font-size: 14px;
}

.viewer-box {
  white-space: pre-wrap;
  word-wrap: break-word;
  background: #f5f7fa;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 26px;
  margin: 0;
  font-size: 16px;
  line-height: 1.8;
  color: #1f2937;
  min-height: 500px;
  overflow: visible;
}

.badge {
  display: inline-block;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
}

.badge.clean {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge.debug {
  background: #e5e7eb;
  color: #4b5563;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: auto;
  }
}

.defect-divider {
  height: 1px;
  background: #cbd5e1;
  margin: 24px 0;
}