:root { color-scheme: dark; font-family: system-ui, Avenir, Helvetica, Arial, sans-serif; line-height: 1.5; color: rgba(255,255,255,.87); background-color: #242424; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button { font-family: inherit; font-weight: 500; }

#app { max-width: 1280px; margin: 0 auto; padding: 2rem; text-align: center; }
.card { padding: 2em; }
@media (max-width: 600px) { #app { padding: 1rem; } .card { padding: 1em 0; } }

button:focus-visible, .dd-trigger:focus-visible, .f-input:focus-visible, .f-select:focus-visible { outline: 2px solid #f76902; outline-offset: 2px; }

/* ---------- Filter panel ---------- */
.srcdp { max-width: 900px; margin: 0 auto; padding: 16px; border: 1px solid #2a2a2a; border-radius: 8px; background: #161616; text-align: left; font-family: sans-serif; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 14px; font-size: .88rem; color: #aaa; }
.match { display: flex; align-items: center; gap: 8px; }
.toolbar-actions { display: flex; gap: 14px; }
.link-btn { background: none; border: none; padding: 2px 0; color: #aaa; cursor: pointer; font-size: .85rem; text-decoration: underline; }
.link-btn:hover { color: #f76902; }

.seg { display: inline-flex; border: 1px solid #444; border-radius: 4px; overflow: hidden; }
.seg-btn { padding: 5px 14px; background: transparent; color: #ccc; border: none; cursor: pointer; font-size: .85rem; }
.seg-btn + .seg-btn { border-left: 1px solid #444; }
.seg-btn:hover { background: #222; }
.seg-btn.on { background: #f76902; color: #fff; }

#filters { display: flex; flex-direction: column; gap: 10px; }
#filters:empty::before { content: 'No filters \2014  showing all files.'; color: #777; font-size: .88rem; padding: 6px 0; }
.filter-row { display: grid; grid-template-columns: minmax(150px, 1.1fr) 150px minmax(200px, 2fr) auto; gap: 8px; align-items: start; }
.f-field { min-width: 0; }
.f-value { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; min-height: 40px; }
.f-to { color: #888; font-size: .85rem; }
.f-err { grid-column: 1 / -1; color: #ff6b6b; font-size: .8rem; }
.f-err:empty { display: none; }
@media (max-width: 720px) {
  .filter-row { grid-template-columns: 1fr auto; }
  .f-field, .filter-row > .f-op, .f-value { grid-column: 1; }
  .filter-remove-btn { grid-column: 2; grid-row: 1; }
}

.f-input, .f-select { box-sizing: border-box; padding: 9px 10px; background: #111; color: #e0e0e0; border: 1px solid #444; border-radius: 4px; font-family: sans-serif; font-size: .95rem; min-width: 0; }
.f-input { flex: 1 1 110px; }
.f-select { width: 100%; cursor: pointer; }
.pg-size .f-select { width: auto; padding: 5px 8px; }
.f-input:focus, .f-select:focus { border-color: #f76902; outline: none; }
.f-input:disabled, .f-select:disabled { opacity: .5; cursor: not-allowed; }
.f-input::placeholder { color: #777; }

.chip { padding: 5px 12px; background: transparent; color: #ccc; border: 1px solid #444; border-radius: 999px; cursor: pointer; font-size: .85rem; transition: background-color .15s, border-color .15s; }
.chip:hover { border-color: #f76902; }
.chip[aria-pressed="true"] { background: #f76902; border-color: #f76902; color: #fff; }

.filter-remove-btn { padding: 8px 12px; background: transparent; color: #888; border: 1px solid #444; border-radius: 4px; cursor: pointer; font-size: 16px; line-height: 1.3; transition: color .2s, border-color .2s; }
.filter-remove-btn:hover { color: #ff4444; border-color: #ff4444; }

.action-bar { margin-top: 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.add-filter-btn { padding: 8px 16px; background: transparent; color: #f76902; border: 1px dashed #f76902; border-radius: 4px; cursor: pointer; font-family: sans-serif; font-size: .88rem; display: flex; align-items: center; gap: 6px; transition: background-color .2s; }
.add-filter-btn:hover { background: rgba(247,105,2,.1); }
.add-filter-btn__icon { font-size: 16px; line-height: 1; }
.note { color: #999; font-size: .82rem; }

/* ---------- Searchable dropdown ---------- */
.dd { position: relative; font-family: sans-serif; }
.dd-trigger { display: block; width: 100%; box-sizing: border-box; padding: 9px 30px 9px 10px; background: #111; color: #e0e0e0; border: 1px solid #444; border-radius: 4px; cursor: pointer; font-size: .95rem; font-weight: 400; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
.dd-trigger::after { content: '\25BE'; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #888; }
.dd-trigger.placeholder { color: #888; }
.dd-trigger:hover { border-color: #666; }
.dd-menu { position: absolute; top: calc(100% + 4px); left: 0; min-width: 100%; width: 280px; border: 1px solid #444; border-radius: 4px; background: #111; z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,.5); overflow: hidden; }
.dd-search { width: 100%; padding: 9px 10px; box-sizing: border-box; background: #1e1e1e; color: #e0e0e0; border: none; border-bottom: 1px solid #333; font-size: .9rem; }
.dd-search:focus { outline: none; border-bottom-color: #f76902; }
.dd-list { max-height: 220px; overflow-y: auto; }
.dd-item { padding: 9px 10px; cursor: pointer; text-transform: capitalize; }
.dd-item:hover, .dd-item.active { background: #f76902; color: #fff; }
.dd-none { padding: 10px; color: #999; }

/* ---------- Results ---------- */
#out { transition: opacity .15s; }
#out.loading .results { opacity: .55; }
.results { margin: 20px 0; border-radius: 8px; border: 1px solid #2a2a2a; font-family: monospace; font-size: .88rem; background: #111; color: #e0e0e0; width: 100%; text-align: left; position: relative; }
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: #f76902; border-radius: 7px 7px 0 0; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: #f0f0f0; }
.results-empty { padding: 28px; text-align: center; color: #666; }
.cols-wrap { position: relative; }
.cols-btn { padding: 4px 10px; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.6); border-radius: 4px; cursor: pointer; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.cols-btn:hover { background: rgba(255,255,255,.15); }
.cols-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 200px; max-height: 320px; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; background: #1a1a1a; border: 1px solid #333; border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.5); color: #e0e0e0; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: .85rem; }
.cols-pop label { cursor: pointer; text-transform: capitalize; white-space: nowrap; }
.cols-pop .link-btn { text-align: left; margin-top: 4px; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: #1a1a1a; border-bottom: 1px solid #2a2a2a; text-align: left; white-space: nowrap; }
.data-table th button { all: unset; box-sizing: border-box; display: block; width: 100%; padding: 10px 14px; cursor: pointer; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: #999; }
.data-table th button:hover { color: #f0f0f0; }
.data-table th button:focus-visible { outline: 2px solid #f76902; outline-offset: -2px; }
.data-table th[aria-sort="ascending"] button, .data-table th[aria-sort="descending"] button { color: #f76902; }
.sort { display: inline-block; min-width: 1em; margin-left: 4px; font-size: .7rem; }
.th-chev, .td-chev { width: 32px; padding: 0; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid #1e1e1e; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #ccc; }
.data-table td:nth-child(2) { color: #f0f0f0; font-weight: 500; }
.data-table .num { text-align: right; }
.data-row { cursor: pointer; transition: background-color .15s; }
.data-row:hover { background: #1f1f1f; }
.data-row.open { background: #1a1a1a; }
.td-chev { text-align: center; }
.row-toggle { all: unset; cursor: pointer; padding: 10px 12px; opacity: .7; transition: transform .15s; display: inline-block; }
.row-toggle:focus-visible { outline: 2px solid #f76902; outline-offset: -2px; }
.data-row.open .row-toggle { transform: rotate(90deg); }
.detail-row { background: #0d0d0d; }
.detail-row > td { max-width: none; white-space: normal; padding: 0; }

.results dl { display: grid; margin: 0; padding: 14px 16px 18px 46px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 24px; }
.results dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: #888; }
.results dd { margin: 0; color: #ccc; overflow-wrap: anywhere; }
.results .wide { grid-column: 1 / -1; }
.results dd a { color: #1a73e8; text-decoration: none; }
.results dd a:hover { text-decoration: underline; }
.results dd img { display: block; max-width: 100%; max-height: 160px; border-radius: 4px; margin-bottom: 6px; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; background: #161616; border-top: 1px solid #2a2a2a; border-radius: 0 0 7px 7px; font-size: .82rem; color: #aaa; }
.pg-btn { padding: 5px 12px; background: transparent; color: #f0f0f0; border: 1px solid #444; border-radius: 4px; cursor: pointer; font-size: .82rem; }
.pg-btn:hover:not(:disabled) { border-color: #f76902; color: #f76902; }
.pg-btn:disabled { opacity: .4; cursor: not-allowed; }
.pg-info { margin: 0 12px; }