/* Source Files Explorer — CSS */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #0c0c12; color: #e1d9eb; font-family: 'IBM Plex Sans', system-ui, sans-serif; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* ═══ HEADER ═══ */
.site-bar { display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: #111119; border-bottom: 2px solid #3a3a50; flex-shrink: 0; z-index: 100; }
.site-bar a { text-decoration: none; }
.bar-brand { font-family: 'IBM Plex Mono', monospace; font-size: 16px; font-weight: 700; color: #ff5545; letter-spacing: 5px; }
.bar-sep { color: #3a3a50; }
.bar-section { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: #b0b0b0; letter-spacing: 2px; text-transform: uppercase; }
.bar-nav { margin-left: auto; display: flex; gap: 10px; }
.bar-link { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: #a0a0a0; letter-spacing: 1px; text-decoration: none; padding: 5px 12px; border: 1px solid #3a3a50; border-radius: 4px; transition: all 0.15s; }
.bar-link:hover { color: #fff; border-color: #ff5545; }

/* ═══ APP LAYOUT ═══ */
.app-layout { flex: 1; display: flex; overflow: hidden; }

/* ═══ SIDEBAR ═══ */
.sidebar { width: 220px; flex-shrink: 0; background: #111119; border-right: 1px solid #2a2a3c; display: flex; flex-direction: column; overflow-y: auto; padding: 12px 0; }
.sidebar-title { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: #707070; letter-spacing: 3px; text-transform: uppercase; padding: 8px 16px 12px; }
.sidebar-divider { font-family: 'IBM Plex Mono', monospace; font-size: 9px; color: #4a4a5a; letter-spacing: 2px; padding: 14px 16px 4px; }
.sidebar-btn { display: block; width: 100%; text-align: left; padding: 9px 16px; background: none; border: none; border-left: 3px solid transparent; color: #a0a0a0; font-size: 13px; cursor: pointer; transition: all 0.1s; font-family: inherit; }
.sidebar-btn:hover { background: #1a1a28; color: #e1d9eb; }
.sidebar-btn.active { background: #1a1a28; color: #ff5545; border-left-color: #ff5545; font-weight: 600; }

/* ═══ MAIN CONTENT ═══ */
.main-content { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.view { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.view.active { display: flex; }
.view-inner { padding: 30px; overflow-y: auto; flex: 1; }
.view-title { font-size: 24px; font-weight: 600; color: #fff; margin-bottom: 10px; }
.view-desc { font-size: 14px; color: #b0b0b0; line-height: 1.6; margin-bottom: 16px; max-width: 800px; }
.view-desc strong { color: #ffb732; }

/* ═══ HERO CARDS ═══ */
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 24px 0; }
.hero-card { background: #161622; border: 2px solid #2a2a3c; border-radius: 8px; padding: 28px; text-align: left; cursor: pointer; transition: all 0.15s; font-family: inherit; color: inherit; }
.hero-card:hover { border-color: #ff5545; background: #1a1a2e; }
.hero-icon { font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 700; color: #ff5545; background: #ff554520; display: inline-block; padding: 4px 10px; border-radius: 4px; margin-bottom: 12px; letter-spacing: 2px; }
.hero-title { font-size: 20px; font-weight: 600; color: #fff; margin-bottom: 6px; }
.hero-stat { font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: #ffb732; margin-bottom: 10px; }
.hero-desc { font-size: 13px; color: #a0a0a0; line-height: 1.5; }

.stat-bar { display: flex; flex-wrap: wrap; gap: 20px; padding: 16px 0; border-top: 1px solid #2a2a3c; margin-top: 10px; }
.stat-item { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: #707070; }
.stat-num { color: #e1d9eb; font-weight: 600; }

/* ═══ ZIP DOWNLOAD GRID ═══ */
/* Single-column rows — each card is a full-width source-package row with
   click-to-copy SHA-256 and a primary download + OTS proof button. */
.zip-grid { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.zip-card {
  display: flex; align-items: stretch; gap: 14px;
  padding: 14px 16px; background: #161622;
  border: 1px solid #3a3a50; border-radius: 6px;
  color: inherit; transition: all 0.15s;
}
.zip-card:hover { border-color: #a77bdb; background: #1c1c2e; }
.zip-icon {
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 700;
  color: #b990e6; background: #a77bdb20; border: 1px solid #a77bdb40;
  padding: 4px 8px; border-radius: 3px; letter-spacing: 1px; flex-shrink: 0; align-self: flex-start; margin-top: 2px;
}
.zip-info {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px;
}
.zip-titlerow {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.zip-name { font-family: 'IBM Plex Mono', monospace; font-size: 14px; font-weight: 600; color: #e1d9eb; }
.zip-sub { font-size: 13px; color: #a0a0a0; line-height: 1.4; }
.zip-sub strong { color: #ffb732; }
.zip-size { font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: #b990e6; font-weight: 600; flex-shrink: 0; }
.zip-hash {
  font-family: 'IBM Plex Mono', monospace; font-size: 12px;
  color: #4eecc8; cursor: pointer; transition: color 0.15s;
  word-break: break-all; align-self: flex-start;
}
.zip-hash:hover { color: #f0f0f0; }
.zip-hash.copied { color: #ffb732; }
.zip-actions {
  display: flex; flex-direction: column; gap: 6px; align-items: stretch;
  flex-shrink: 0; min-width: 110px;
}
.zip-dl {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; background: #b990e6; color: #0c0c12;
  text-decoration: none; font-family: 'IBM Plex Mono', monospace;
  font-size: 12px; font-weight: 700; letter-spacing: 1px;
  border-radius: 4px; transition: all 0.15s;
}
.zip-dl:hover { background: #cba8ee; transform: translateY(-1px); }
.zip-dl-arrow { font-size: 14px; line-height: 1; font-weight: 700; }
.zip-dl-label { font-size: 11px; }
.zip-ots {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 5px 10px; background: transparent;
  color: #b990e6; border: 1px solid #a77bdb40; border-radius: 4px;
  text-decoration: none; font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  transition: all 0.15s;
}
.zip-ots:hover { background: #a77bdb20; border-color: #b990e6; color: #f0f0f0; }
@media (max-width: 700px) {
  .zip-card { flex-wrap: wrap; }
  .zip-actions { flex-direction: row; min-width: 0; width: 100%; margin-top: 4px; }
  .zip-dl { flex: 1; }
  .zip-ots { padding: 9px 14px; }
}

/* ═══ FILTER BAR ═══ */
.filter-bar { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; padding: 12px 16px; background: #111119; border-bottom: 1px solid #2a2a3c; flex-shrink: 0; }
.filter-group { display: flex; flex-direction: column; gap: 2px; }
.filter-group label { font-family: 'IBM Plex Mono', monospace; font-size: 9px; color: #707070; letter-spacing: 2px; text-transform: uppercase; }
.filter-group select, .filter-group input { background: #1a1a28; border: 1px solid #3a3a50; border-radius: 3px; color: #e1d9eb; padding: 6px 8px; font-family: 'IBM Plex Mono', monospace; font-size: 12px; outline: none; }
.filter-group select:focus, .filter-group input:focus { border-color: #ff5545; }
.filter-group select { min-width: 110px; }
.filter-search { flex: 1; min-width: 180px; }
.filter-search input { width: 100%; }
.filter-stats { font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: #ff5545; padding: 6px 0; white-space: nowrap; }

/* ═══ TABLE ═══ */
.table-wrap { flex: 1; overflow: hidden; }
.tabulator { background: #0c0c12; border: none; font-size: 13px; }
.tabulator .tabulator-header { background: #161622; border-bottom: 2px solid #3a3a50; }
.tabulator .tabulator-col { background: #161622; border-right: 1px solid #1e1e2e; }
.tabulator .tabulator-col .tabulator-col-title { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: #a0a0a0; letter-spacing: 1px; text-transform: uppercase; font-weight: 600; }
.tabulator .tabulator-row { background: #0e0e16; color: #e1d9eb; border-bottom: 1px solid #1a1a22; cursor: pointer; }
.tabulator .tabulator-row.tabulator-row-even { background: #121218; }
.tabulator .tabulator-row:hover { background: #1e1e30 !important; }
.tabulator .tabulator-row .tabulator-cell { border-right: 1px solid #1a1a22; padding: 8px 10px; font-size: 12px; }
.tabulator .tabulator-footer { background: #111119; border-top: 1px solid #3a3a50; }
.tabulator .tabulator-footer .tabulator-page { color: #a0a0a0; background: #1a1a28; border: 1px solid #3a3a50; }
.tabulator .tabulator-footer .tabulator-page.active { color: #ff5545; border-color: #ff5545; }

.cell-badge { display: inline-block; padding: 2px 8px; border-radius: 3px; font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 700; }
.badge-cr { background: #ff554520; color: #ff6b5a; }
.badge-mh { background: #2de0b620; color: #4eecc8; }
.badge-gc { background: #ffb73220; color: #ffc44d; }
.badge-other { background: #a77bdb20; color: #b990e6; }
.cell-cluster { color: #ffb732; font-weight: 600; }

/* ═══ DOCUMENT VIEWER ═══ */
.doc-bar { display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: #111119; border-bottom: 1px solid #3a3a50; flex-shrink: 0; }
.doc-back { background: #1a1a28; border: 1px solid #3a3a50; border-radius: 4px; color: #e1d9eb; padding: 6px 14px; cursor: pointer; font-family: 'IBM Plex Mono', monospace; font-size: 12px; transition: all 0.15s; }
.doc-back:hover { border-color: #ff5545; color: #ff5545; }
.doc-title { flex: 1; font-family: 'IBM Plex Mono', monospace; font-size: 13px; color: #ffb732; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-dl { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: #4eecc8; text-decoration: none; padding: 6px 14px; border: 1px solid #2de0b640; border-radius: 4px; }
.doc-dl:hover { border-color: #2de0b6; background: #2de0b610; }

.doc-split { flex: 1; display: flex; overflow: hidden; position: relative; }
.doc-left { flex: 1; min-width: 100px; background: #0a0a10; position: relative; overflow: hidden; }
.doc-left embed, .doc-left img { width: 100%; height: 100%; object-fit: contain; }
.doc-left .left-toggle { position: absolute; top: 10px; right: 10px; background: #111119ee; border: 2px solid #ff5545; border-radius: 5px; color: #ff5545; padding: 8px 18px; cursor: pointer; font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 600; z-index: 5; letter-spacing: 1px; }
.doc-left .left-toggle:hover { background: #ff554530; color: #fff; }

/* Drag overlay — covers iframes/embeds during splitter drag */
.drag-overlay { display: none; position: fixed; inset: 0; z-index: 9999; cursor: col-resize; }
.drag-overlay.active { display: block; }

/* Draggable splitter */
.doc-splitter { width: 6px; background: #2a2a3c; cursor: col-resize; flex-shrink: 0; position: relative; z-index: 10; transition: background 0.1s; }
.doc-splitter:hover, .doc-splitter.dragging { background: #ff5545; }
.doc-splitter::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 2px; height: 40px; background: #707070; border-radius: 1px; }

.doc-right { width: 440px; flex-shrink: 0; overflow-y: auto; overflow-x: auto; background: #0e0e16; padding: 0; min-width: 200px; }

/* Minimize button — sits at top of right panel */
.doc-minimize {
  display: block; width: 100%; text-align: left;
  padding: 10px 16px; background: #161622;
  border: none; border-bottom: 1px solid #2a2a3c;
  color: #a0a0a0; cursor: pointer;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 1px;
  transition: all 0.1s; flex-shrink: 0;
}
.doc-minimize:hover { background: #1e1e30; color: #ff5545; }

/* Minimized PDF state */
.doc-left.minimized { flex: none; width: 320px; height: 280px; position: absolute; top: 0; left: 0; z-index: 8; border: 2px solid #3a3a50; border-radius: 0 0 8px 0; resize: both; overflow: hidden; }
.doc-left.minimized + .doc-splitter { display: none; }
.doc-split.pdf-minimized .doc-right { flex: 1; width: auto; }

/* ═══ META CARDS ═══ */
.meta-card { border-bottom: 1px solid #2a2a3c; }
.meta-card-header { display: flex; align-items: center; padding: 12px 16px; cursor: pointer; background: #161622; user-select: none; transition: background 0.1s; }
.meta-card-header:hover { background: #1e1e30; }
.meta-card-arrow { color: #707070; font-size: 10px; margin-right: 10px; transition: transform 0.15s; width: 12px; }
.meta-card.open .meta-card-arrow { transform: rotate(90deg); }
.meta-card-title { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: #e1d9eb; letter-spacing: 1px; text-transform: uppercase; font-weight: 600; }
.meta-card-count { margin-left: auto; font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: #707070; }
.meta-card-body { display: none; padding: 12px 16px; }
.meta-card.open .meta-card-body { display: block; }

/* Props */
.prop-row { display: flex; padding: 5px 0; border-bottom: 1px solid #1a1a22; font-size: 12px; }
.prop-label { color: #707070; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; width: 130px; flex-shrink: 0; font-family: 'IBM Plex Mono', monospace; padding-top: 2px; }
.prop-value { color: #e1d9eb; word-break: break-all; font-family: 'IBM Plex Mono', monospace; font-size: 12px; }
.prop-value.red { color: #ff5545; }
.prop-value.gold { color: #ffb732; }
.prop-value.green { color: #4eecc8; }
.prop-value a { color: #3a86ba; text-decoration: none; }
.prop-value a:hover { color: #fff; text-decoration: underline; }

/* Objects grid */
.obj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.obj-card { background: #161622; border: 1px solid #2a2a3c; border-radius: 4px; padding: 6px; text-align: center; cursor: pointer; transition: all 0.1s; }
.obj-card:hover { border-color: #ff5545; }
.obj-card img { max-width: 100%; max-height: 100px; object-fit: contain; border-radius: 2px; display: block; margin: 0 auto; }
.obj-card .obj-label { font-family: 'IBM Plex Mono', monospace; font-size: 9px; color: #707070; margin-top: 4px; }

/* JSON tree */
.jtree { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: #e1d9eb; line-height: 1.6; max-height: 600px; overflow-y: auto; }
.jtoggle { display: inline-block; cursor: pointer; color: #3a86ba; font-size: 11px; width: 18px; height: 18px; line-height: 18px; text-align: center; font-weight: 700; user-select: none; border-radius: 3px; border: 1px solid #3a86ba50; background: #3a86ba15; transition: all 0.1s; vertical-align: middle; margin-right: 2px; }
.jtoggle:hover { background: #3a86ba30; border-color: #3a86ba; color: #fff; }
.jtoggle.open { color: #3a86ba; border-color: #3a86ba40; background: #3a86ba10; }
.jcount { font-size: 10px; color: #707070; margin-left: 6px; }
.jbody { padding-left: 20px; border-left: 1px solid #2a2a3c; margin-left: 8px; }
.jbody.collapsed { display: none; }
.jrow { padding: 1px 0; }
.json-key { color: #ff6b5a; }
.json-string { color: #4eecc8; }
.json-number { color: #ffc44d; }
.json-bool { color: #b990e6; }
.json-null { color: #707070; }

/* Legacy pre for fallback */
.meta-card-body pre { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: #e1d9eb; white-space: pre-wrap; word-break: break-all; line-height: 1.5; max-height: 500px; overflow-y: auto; }

/* Related links */
.related-links { padding-top: 8px; }
.related-links a { display: block; color: #3a86ba; font-size: 11px; margin: 4px 0; text-decoration: none; font-family: 'IBM Plex Mono', monospace; }
.related-links a:hover { color: #fff; }

/* File list for generic views */
.file-list-wrap { max-height: calc(100vh - 250px); overflow-y: auto; }
.fl-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid #1e1e2e; font-size: 13px; }
.fl-row:hover { background: #1a1a28; }
.fl-name { flex: 1; font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: #e1d9eb; word-break: break-all; }
.fl-btn { font-family: 'IBM Plex Mono', monospace; font-size: 10px; padding: 4px 10px; border: 1px solid #3a3a50; border-radius: 3px; background: #1a1a28; color: #a0a0a0; cursor: pointer; text-decoration: none; transition: all 0.1s; }
.fl-btn:hover { border-color: #ff5545; color: #ff5545; }
.fl-search { width: 100%; padding: 8px 12px; background: #1a1a28; border: 1px solid #3a3a50; border-radius: 4px; color: #e1d9eb; font-family: 'IBM Plex Mono', monospace; font-size: 12px; margin-bottom: 12px; outline: none; }
.fl-search:focus { border-color: #ff5545; }

/* Object image viewer in left pane */
.obj-viewer { display: none; width: 100%; height: 100%; flex-direction: column; background: #0a0a10; position: relative; }
.obj-viewer { display: flex; }
.obj-nav { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #111119; border-bottom: 1px solid #2a2a3c; flex-shrink: 0; }
.obj-nav-btn { background: #1a1a28; border: 1px solid #3a3a50; border-radius: 4px; color: #e1d9eb; width: 36px; height: 30px; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.obj-nav-btn:hover { border-color: #ff5545; color: #ff5545; }
.obj-nav-info { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: #a0a0a0; min-width: 60px; text-align: center; }
.obj-zoom-btn { background: #1a1a28; border: 1px solid #3a3a50; border-radius: 4px; color: #e1d9eb; padding: 4px 10px; font-family: 'IBM Plex Mono', monospace; font-size: 12px; cursor: pointer; }
.obj-zoom-btn:hover { border-color: #ffb732; color: #ffb732; }
.obj-img-wrap { flex: 1; overflow: auto; display: flex; align-items: flex-start; justify-content: flex-start; padding: 10px; }
.obj-img { image-rendering: pixelated; image-rendering: crisp-edges; max-width: 100%; max-height: 100%; object-fit: contain; transition: transform 0.1s; }

/* Image modal */
.img-modal { display: none; position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,0.92); justify-content: center; align-items: center; cursor: pointer; }
.img-modal.open { display: flex; }
.img-modal img { max-width: 90vw; max-height: 90vh; object-fit: contain; }

/* Filing rows (parent docket child list) */
.filing-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-bottom: 1px solid #1a1a22;
  cursor: pointer; font-family: 'IBM Plex Mono', monospace; font-size: 12px;
  transition: background 0.1s;
}
.filing-row:hover { background: #1e1e30; }
.filing-row.filing-active { background: rgba(255,85,69,0.12); border-left: 3px solid #ff5545; }
.filing-row.filing-active .filing-date { color: #ff5545; }
.filing-row.filing-active .filing-type { color: #ffffff; }
.filing-date { color: #a0a0a0; min-width: 90px; flex-shrink: 0; }
.filing-sep { color: #2a2a3c; }
.filing-type { color: #e1d9eb; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filing-size { color: #707070; min-width: 65px; text-align: right; flex-shrink: 0; font-size: 11px; }

/* Loading */
.loading { padding: 30px; text-align: center; color: #707070; font-size: 13px; }

/* ═══ SPLIT MODE — LOCKED CURATED VIEWER ═══ */
body.split-mode .sidebar { display: none; }
body.split-mode .main-content { margin-left: 0; }

#view-split { display: none; flex-direction: column; height: 100%; }
#view-split.active { display: flex; }

.split-header {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px;
  background: #111119; border-bottom: 1px solid #3a3a50;
  flex-shrink: 0;
}
.split-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px; color: #ff5545; font-weight: 700;
  white-space: nowrap;
}
.split-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px; color: #b0b0b0; letter-spacing: 0.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.split-body {
  display: flex; flex: 1; overflow: hidden;
}
.split-table {
  width: 50%; min-width: 300px; overflow: auto;
  border-right: 1px solid #3a3a50;
  display: flex; flex-direction: column;
}
.split-table .tabulator { flex: 1; }
.split-divider {
  width: 6px; cursor: col-resize; flex-shrink: 0;
  background: #1a1a28; border-left: 1px solid #3a3a50; border-right: 1px solid #3a3a50;
  transition: background 0.15s;
}
.split-divider:hover, .split-divider.dragging { background: #ff5545; }
.split-viewer {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}
.split-viewer .doc-bar { flex-shrink: 0; }
.split-viewer .doc-split { flex: 1; }

/* Active row highlight in split table */
.split-table .tabulator-row.split-active { background: #1e1e30 !important; border-left: 3px solid #ff5545; }
.split-table .tabulator-row { cursor: pointer; }
