/**
 * Author: Faysal Alibrahim
 * GitHub: https://github.com/FAYSAL-Q8
 */

:root {
  --bg: #f8fafc;
  --bg-gradient: none;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --border: #cbd5e1;
  --border-focus: #3b82f6;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-text: #ffffff;
  --accent-glow: rgba(37, 99, 235, 0.2);
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --info: #0284c7;
  --info-light: #f0f9ff;
  --radius: 8px;
  --radius-lg: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Dark Theme Palette Tokens */
[data-theme="dark"], body.dark {
  --rekoner-bg: #0d0f14;
  --rekoner-bg-gradient: radial-gradient(circle at 50% 0%, rgba(0, 229, 153, 0.08) 0%, transparent 65%), linear-gradient(180deg, #161a23 0%, #0d0f14 100%);
  --rekoner-card-bg: rgba(22, 26, 35, 0.88);
  --rekoner-card-solid: #161a23;
  --rekoner-border: rgba(255, 255, 255, 0.1);
  --rekoner-border-subtle: rgba(255, 255, 255, 0.05);
  --rekoner-text: #f1f5f9;
  --rekoner-text-muted: #94a3b8;
  --rekoner-text-dim: #64748b;
  --rekoner-accent: #00e599;
  --rekoner-accent-glow: rgba(0, 229, 153, 0.35);
  --rekoner-accent-blue: #38bdf8;
  --rekoner-accent-amber: #f59e0b;
  --rekoner-accent-red: #f43f5e;
  --rekoner-accent-purple: #a855f7;
  --rekoner-input-bg: rgba(13, 16, 22, 0.85);
  --rekoner-input-border: rgba(255, 255, 255, 0.14);

  --bg: var(--rekoner-bg);
  --bg-gradient: var(--rekoner-bg-gradient);
  --surface: var(--rekoner-card-bg);
  --surface-subtle: rgba(255, 255, 255, 0.05);
  --border: var(--rekoner-border);
  --border-focus: var(--rekoner-accent);
  --text-main: var(--rekoner-text);
  --text-muted: var(--rekoner-text-muted);
  --text-dim: var(--rekoner-text-dim);
  --primary: var(--rekoner-accent);
  --primary-hover: #00ffaa;
  --primary-light: rgba(0, 229, 153, 0.12);
  --primary-text: #090c12;
  --accent-glow: var(--rekoner-accent-glow);
  --input-bg: var(--rekoner-input-bg);
  --input-border: var(--rekoner-input-border);
  --danger: var(--rekoner-accent-red);
  --danger-light: rgba(244, 63, 94, 0.15);
  --success: var(--rekoner-accent);
  --success-light: rgba(0, 229, 153, 0.15);
  --warning: var(--rekoner-accent-amber);
  --warning-light: rgba(245, 158, 11, 0.15);
  --info: var(--rekoner-accent-blue);
  --info-light: rgba(56, 189, 248, 0.15);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 8px;
  font-size: 13px;
  line-height: 1.4;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.app-container {
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.app-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-icon {
  width: 22px;
  height: 22px;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-icon svg {
  width: 100%;
  height: 100%;
}

.app-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.theme-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.theme-btn svg {
  width: 15px;
  height: 15px;
}

/* Card */
.card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Dropzone */
.har-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 12px;
  text-align: center;
  cursor: pointer;
  background: var(--surface-subtle);
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.har-dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.har-dropzone svg {
  width: 32px;
  height: 32px;
  color: var(--text-muted);
}

/* Toolbar & View Modes */
.view-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.segmented-group {
  display: flex;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
  gap: 2px;
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 5px 8px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
}

.seg-btn.active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* Filter Strip */
.filter-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 4px;
}

.search-input {
  flex: 2;
  min-width: 140px;
  padding: 6px 9px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  font-size: 12px;
  outline: none;
  background: var(--input-bg);
  color: var(--text-main);
}

.filter-select {
  flex: 1;
  min-width: 85px;
  padding: 6px 6px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  font-size: 11.5px;
  outline: none;
  background: var(--input-bg);
  color: var(--text-main);
}

/* Category Pills */
.category-pills {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 2px 0;
}

.cat-pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 500;
  transition: all 0.12s;
}

.cat-pill.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}

/* Metrics Row */
.metrics-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  padding: 5px 8px;
  background: var(--surface-subtle);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 11.5px;
}

.metric-item {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}

.metric-item b {
  color: var(--text-main);
  font-family: var(--font-mono);
}

/* Group Controls Bar */
.group-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

.group-summary-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
  background: var(--surface-subtle);
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.group-control-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.group-search-input {
  max-width: 170px;
  padding: 4px 8px !important;
  font-size: 11px !important;
  border-radius: var(--radius);
}

.group-sort-select {
  padding: 4px 6px !important;
  font-size: 11px !important;
  border-radius: var(--radius);
}

/* Group Accordion & Cards */
.group-section {
  flex-shrink: 0;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.group-section:hover {
  border-color: rgba(37, 99, 235, 0.45);
}

[data-theme="dark"] .group-section {
  background: var(--rekoner-card-solid);
  border-color: var(--rekoner-border);
  box-shadow: none;
}

[data-theme="dark"] .group-section:hover {
  border-color: var(--rekoner-accent);
  box-shadow: 0 0 10px rgba(0, 229, 153, 0.15);
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #ffffff;
  cursor: pointer;
  user-select: none;
  font-size: 12.5px;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  gap: 8px;
  transition: background 0.15s ease;
}

.group-header:hover {
  background: #f8fafc;
}

[data-theme="dark"] .group-header {
  background: rgba(22, 26, 35, 0.95);
}

[data-theme="dark"] .group-header:hover {
  background: rgba(0, 229, 153, 0.06);
}

.group-section.expanded .group-header {
  border-bottom-color: var(--border);
}

[data-theme="dark"] .group-section.expanded .group-header {
  border-bottom-color: var(--rekoner-border);
}

.group-title-box {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  min-width: 0;
  flex: 1;
}

.group-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.group-section.expanded .group-arrow {
  transform: rotate(90deg);
}

.group-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
  flex-shrink: 0;
}

.group-name {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-badges {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.group-count {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 12px;
  background: var(--border);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-weight: 600;
}

.group-err-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 12px;
  background: var(--danger-light);
  color: var(--danger);
  font-family: var(--font-mono);
  font-weight: 700;
}

.group-size-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.group-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.group-content {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.02);
  border-left: 3px solid var(--primary);
}

[data-theme="dark"] .group-content {
  background: rgba(0, 0, 0, 0.25);
  border-left-color: var(--rekoner-accent);
}

.group-section.expanded .group-content {
  display: flex;
}

/* Request Items */
.requests-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 220px;
  max-height: calc(100vh - 270px);
  max-height: calc(100dvh - 270px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.request-item {
  flex-shrink: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.request-item:hover {
  border-color: var(--primary);
  background: var(--surface-subtle);
}

.method-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 4px;
  min-width: 38px;
  text-align: center;
}

.method-GET { background: rgba(56, 189, 248, 0.15); color: #0284c7; }
.method-POST { background: rgba(0, 229, 153, 0.15); color: #059669; }
.method-PUT, .method-PATCH { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.method-DELETE { background: rgba(244, 63, 94, 0.15); color: #dc2626; }
.method-OPTIONS, .method-HEAD { background: rgba(148, 163, 184, 0.15); color: #64748b; }

.status-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  min-width: 28px;
  text-align: center;
}

.status-2xx { background: var(--success-light); color: var(--success); }
.status-3xx { background: var(--info-light); color: var(--info); }
.status-4xx { background: var(--warning-light); color: var(--warning); }
.status-5xx { background: var(--danger-light); color: var(--danger); }
.status-0 { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); }

.req-url-box {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.req-path {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.req-host {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.req-meta-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  min-width: 55px;
}

.del-req-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}

.del-req-btn:hover {
  color: var(--danger);
  background: var(--danger-light);
}

/* Detail Modal */
.detail-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(13, 15, 20, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 6px;
  z-index: 1000;
}

.detail-modal.active {
  display: flex;
}

.detail-card {
  max-width: 860px;
  width: 100%;
  max-height: 94vh;
  max-height: 94dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-subtle);
}

.detail-title {
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-tabs {
  display: flex;
  gap: 2px;
  padding: 4px 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.detail-tab-btn {
  border: none;
  background: transparent;
  padding: 5px 9px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.detail-tab-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.detail-body {
  padding: 8px 10px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* In-Viewer Code Search Toolbar */
.code-search-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 11px;
}

.code-search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.code-search-count {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.code-view {
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 8px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-main);
  max-height: 380px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: text;
}

mark.code-match {
  background: rgba(0, 229, 153, 0.45);
  color: inherit;
  border-radius: 2px;
}

mark.code-match.current {
  background: #f59e0b;
  color: #000;
}

/* Tables */
.key-value-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.key-value-table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-break: break-all;
}

.key-value-table td.key {
  font-weight: 600;
  color: var(--text-muted);
  width: 32%;
  font-family: var(--font-mono);
}

.key-value-table td.val {
  color: var(--text-main);
  font-family: var(--font-mono);
}

/* Interactive Records Table */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  max-height: 420px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.records-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  font-family: var(--font-mono);
}

.records-table th {
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-weight: 700;
  text-align: left;
  padding: 6px 10px;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: relative;
}

.th-resizer {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  user-select: none;
}

.records-table td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.records-table tr:hover td {
  background: var(--surface-subtle);
  cursor: pointer;
}

.drawer-row td {
  background: var(--surface-subtle);
  white-space: normal;
  max-width: none;
  padding: 8px 12px;
}

/* Column Exclusion Dropdown */
.col-selector-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  padding: 6px;
  z-index: 50;
  min-width: 190px;
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.col-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-main);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.col-checkbox-label:hover {
  background: var(--surface-subtle);
}

/* HTML Replay Iframe */
.replay-frame {
  width: 100%;
  height: 380px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

/* Tree Diagram Visualization */
.diagram-canvas {
  width: 100%;
  min-height: 480px;
  max-height: calc(100vh - 250px);
  max-height: calc(100dvh - 250px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
}

.diagram-tree {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tree-domain-node {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-subtle);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tree-domain-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tree-path-branch {
  margin-left: 14px;
  padding-left: 10px;
  border-left: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tree-path-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.tree-req-leaves {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tree-req-leaf {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  padding: 3px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s;
}

.tree-req-leaf:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* Detail Footer */
.detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
  gap: 6px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 9px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
  transition: all 0.12s;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
  font-weight: 600;
  box-shadow: 0 2px 6px var(--accent-glow);
}

.btn-sm {
  padding: 3px 7px;
  font-size: 11px;
}

.empty-state {
  text-align: center;
  padding: 24px 10px;
  color: var(--text-muted);
  font-size: 12px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

/* Footer */
.app-footer {
  margin-top: auto;
  padding: 14px 0 6px;
  text-align: center;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.app-footer a,
.footer-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.app-footer a:hover,
.footer-link:hover {
  text-decoration: underline;
  color: var(--primary-hover);
  opacity: 0.9;
}

/* SEO Crawler & Landing Overview */
.seo-crawler-content {
  margin-top: 10px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.6;
}
.seo-crawler-content h2 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 6px;
}
.seo-crawler-content p {
  margin: 0 0 12px;
}
.seo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.seo-feature {
  padding: 10px 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.seo-feature h3 {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 4px;
}
.seo-feature p {
  margin: 0;
  font-size: 11px;
  color: var(--text-dim);
}

/* Mobile Responsive < 768px */
@media (max-width: 768px) {
  .detail-card {
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }
}

/* Sorting indicators */
.records-table th.sort-asc::after {
  content: " ▲";
  font-size: 9px;
  color: var(--primary);
}

.records-table th.sort-desc::after {
  content: " ▼";
  font-size: 9px;
  color: var(--primary);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.virtual-asset-pill {
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  margin-bottom: 6px;
}

/* Combiner Modal */
#combinerModal .detail-card {
  max-width: 940px;
}

/* ==========================================================================
   Syntax-Highlighted JSON Viewer Tokens & Copyable Values
   ========================================================================== */
.json-view {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  padding: 10px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-main);
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: text;
}

/* Light mode JSON tokens */
.json-key {
  color: #0369a1;
  font-weight: 600;
}
.json-val-string {
  color: #15803d;
}
.json-val-number {
  color: #b45309;
}
.json-val-boolean {
  color: #7c3aed;
  font-weight: 600;
}
.json-val-null {
  color: #dc2626;
  font-style: italic;
}

/* Dark Mode JSON Syntax Tokens */
[data-theme="dark"] .json-key, body.dark .json-key {
  color: #38bdf8;
}
[data-theme="dark"] .json-val-string, body.dark .json-val-string {
  color: #00e599;
}
[data-theme="dark"] .json-val-number, body.dark .json-val-number {
  color: #f59e0b;
}
[data-theme="dark"] .json-val-boolean, body.dark .json-val-boolean {
  color: #a855f7;
}
[data-theme="dark"] .json-val-null, body.dark .json-val-null {
  color: #f43f5e;
}

/* Copyable JSON Values Interaction */
.json-val {
  cursor: pointer;
  border-radius: 3px;
  padding: 1px 3px;
  margin: -1px 0;
  transition: all 0.12s ease;
  display: inline-block;
  user-select: text;
}

.json-val:hover {
  background: rgba(56, 189, 248, 0.15);
  box-shadow: 0 0 0 1px var(--primary);
}

.json-val:active {
  transform: scale(0.96);
}

.json-val.copied {
  background: var(--primary-light) !important;
  box-shadow: 0 0 0 1px var(--primary) !important;
}

.json-val.copied::after {
  content: " ✓ Copied";
  font-size: 9.5px;
  font-weight: 700;
  color: var(--primary);
  margin-left: 4px;
}

/* Prepared Path Tables List */
.prepared-path-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  padding: 2px 0;
}

.prepared-path-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.12s ease;
}

.prepared-path-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.prepared-path-card:hover {
  border-color: var(--primary);
  background: var(--surface-subtle);
}

.prepared-path-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.prepared-path-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prepared-path-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

/* ==========================================================================
   Multi-Archive Switcher Bar
   ========================================================================== */
.archives-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.archive-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
  user-select: none;
}

.archive-chip:hover {
  border-color: var(--primary);
  color: var(--text-main);
}

.archive-chip.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.archive-chip-close {
  cursor: pointer;
  border-radius: 50%;
  padding: 0 3px;
  font-size: 11px;
  line-height: 1;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.archive-chip-close:hover {
  color: var(--danger);
  background: var(--danger-light);
}

.archive-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius);
  background: transparent;
  border: 1px dashed var(--border);
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
}

.archive-add-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ==========================================================================
   Request List Type Icons & Thumbnail Badges
   ========================================================================== */
.req-type-icon {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8.5px;
  font-weight: 800;
  font-family: var(--font-mono);
  text-transform: uppercase;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.req-thumb {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--surface-subtle);
}

/* Type icon colors */
.req-icon-html { background: rgba(249, 115, 22, 0.16); color: #ea580c; border: 1px solid rgba(249, 115, 22, 0.3); }
.req-icon-php { background: rgba(168, 85, 247, 0.16); color: #9333ea; border: 1px solid rgba(168, 85, 247, 0.3); }
.req-icon-css { background: rgba(56, 189, 248, 0.16); color: #0284c7; border: 1px solid rgba(56, 189, 248, 0.3); }
.req-icon-js { background: rgba(234, 179, 8, 0.16); color: #ca8a04; border: 1px solid rgba(234, 179, 8, 0.3); }
.req-icon-json { background: rgba(0, 229, 153, 0.16); color: var(--primary); border: 1px solid rgba(0, 229, 153, 0.3); }
.req-icon-pdf { background: rgba(244, 63, 94, 0.16); color: #e11d48; border: 1px solid rgba(244, 63, 94, 0.3); }
.req-icon-xlsx { background: rgba(16, 185, 129, 0.16); color: #059669; border: 1px solid rgba(16, 185, 129, 0.3); }
.req-icon-img { background: rgba(139, 92, 246, 0.16); color: #7c3aed; border: 1px solid rgba(139, 92, 246, 0.3); }
.req-icon-media { background: rgba(236, 72, 153, 0.16); color: #db2777; border: 1px solid rgba(236, 72, 153, 0.3); }
.req-icon-font { background: rgba(100, 116, 139, 0.16); color: #64748b; border: 1px solid rgba(100, 116, 139, 0.3); }
.req-icon-other { background: rgba(148, 163, 184, 0.16); color: var(--text-muted); border: 1px solid var(--border); }

.req-archive-tag {
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Binary / Media Previews
   ========================================================================== */
.binary-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 26px 16px;
  gap: 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-subtle);
  text-align: center;
}

.binary-icon {
  width: 44px;
  height: 44px;
  color: var(--primary);
}

.media-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ==========================================================================
   Request Checkbox & Multi-Selection
   ========================================================================== */
.req-check-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  margin-left: -2px;
  cursor: pointer;
  flex-shrink: 0;
}

.req-select-checkbox {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
  cursor: pointer;
  border-radius: 4px;
}

/* ==========================================================================
   Seen / Visited Request State
   ========================================================================== */
.request-item.seen-request {
  opacity: 0.78;
  background: var(--surface-subtle);
  border-left: 3px solid var(--border);
}

.request-item.seen-request .req-path {
  color: var(--text-muted);
  font-weight: 500;
}

.request-item.seen-request:hover {
  opacity: 1;
  border-left-color: var(--primary);
}

.seen-badge {
  font-size: 8.5px;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-weight: 600;
  flex-shrink: 0;
}

[data-theme="dark"] .request-item.seen-request {
  background: rgba(13, 16, 22, 0.75);
  border-color: rgba(255, 255, 255, 0.05);
  border-left-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .request-item.seen-request .req-path {
  color: var(--rekoner-text-dim);
}

/* ==========================================================================
   Floating Selection Action Bar (Mobile & Desktop)
   ========================================================================== */
.selection-action-bar {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 760px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--primary);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.45), 0 0 18px var(--accent-glow);
  border-radius: var(--radius-lg);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 990;
  animation: slideUpBar 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpBar {
  from { transform: translate(-50%, 25px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.sel-count-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

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

/* ==========================================================================
   Merge Duplicates Bar in Tables
   ========================================================================== */
.merge-duplicates-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 11.5px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.merge-duplicates-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.merge-key-select {
  padding: 3px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text-main);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.merge-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

/* ==========================================================================
   Mobile Responsive Optimizations (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
  body {
    padding: 6px;
  }

  .app-container {
    gap: 6px;
  }

  .app-header {
    padding: 6px 10px;
  }

  .app-title {
    font-size: 15px;
  }

  .requests-list {
    max-height: calc(100vh - 290px);
    max-height: calc(100dvh - 290px);
    padding-bottom: 70px; /* clear space for floating selection bar */
  }

  .request-item {
    padding: 7px 6px;
    gap: 5px;
  }

  .req-path {
    font-size: 11.5px;
  }

  .req-meta-box {
    min-width: 44px;
    font-size: 9.5px;
  }

  .selection-action-bar {
    bottom: 8px;
    width: calc(100% - 16px);
    padding: 7px 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .selection-action-bar .sel-count-info {
    justify-content: space-between;
  }

  .selection-action-bar .sel-actions {
    justify-content: flex-end;
    width: 100%;
  }

  .selection-action-bar .btn {
    flex: 1;
    text-align: center;
    padding: 6px 8px;
  }

  .col-selector-menu {
    right: auto;
    left: 0;
    max-width: calc(100vw - 28px);
  }

  .detail-card {
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }
}



