.viewer-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.viewer-toolbar {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.file-meta-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.file-title {
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.file-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  flex-shrink: 0;
}

.tab-group {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.tab-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.tab-btn:last-child {
  border-right: none;
}

.tab-btn.active {
  background: var(--accent-bg);
  color: var(--accent-ink);
}

.viewer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.viewer-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  background: var(--bg);
}

/* Technical X-Ray Inspector (Right Pane when file is open) */
.inspector-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.inspector-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.inspector-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ins-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ins-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--ink-muted);
  text-transform: uppercase;
}

.ins-pill {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--accent-bg);
  color: var(--accent-ink);
}

.ins-code-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  font-size: 11.5px;
  word-break: break-all;
}

.ins-kv {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.ins-kv:last-child {
  border-bottom: none;
}

.ins-k {
  color: var(--ink-muted);
}

.ins-v {
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

.entropy-bar {
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.entropy-fill {
  height: 100%;
  background: var(--ink);
  width: 0%;
  transition: width 0.25s ease;
}

/* Data, Code, Hex & Media Viewers */
.code-pre {
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}

.data-table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th,
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: left;
}

.data-table th {
  background: var(--surface);
  font-weight: 700;
  position: sticky;
  top: 0;
}

.media-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.media-stage {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
}

.media-stage.ratio-21 {
  aspect-ratio: 2 / 1;
}

.media-stage.bg-checker {
  background-image:
    linear-gradient(45deg, var(--checker-a) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checker-a) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker-a) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checker-a) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
  background-color: var(--checker-b);
}

.media-stage.bg-white { background: #FFFFFF; }
.media-stage.bg-black { background: #0A0A0A; }

.media-stage img,
.media-stage video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.hex-table {
  font-size: 12px;
  line-height: 1.55;
  white-space: pre;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.hex-offset { color: var(--ink-muted); }

.md-rendered h1, .md-rendered h2, .md-rendered h3 {
  margin: 14px 0 8px;
  line-height: 1.3;
}
.md-rendered p { margin-bottom: 10px; }
.md-rendered ul, .md-rendered ol { padding-left: 20px; margin-bottom: 10px; }
.md-rendered code {
  background: var(--surface-2);
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, monospace;
  font-size: 12px;
}
.md-rendered pre {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px;
  overflow-x: auto;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.parser-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.zip-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}

.zip-item:last-child { border-bottom: none; }

.eml-header-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 12px;
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
