:root {
  --page-bg: #070705;
  --panel-bg: #070705;
  --panel-border: #161612;
  --text: #c8c6bc;
  --heading: #e8e6dc;
  --muted: #8f8d83;
  --input-bg: #090907;
  --input-border: #1e1e18;
  --input-text: #c8c6bc;
  --accent: #f97316;
  --secondary-stroke: #2e2e26;
  --max-width: 1080px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;
}

[data-theme="light"] {
  --page-bg: #e8e7e0;
  --panel-bg: #edece5;
  --panel-border: #c8c6be;
  --text: #2a2a22;
  --heading: #111110;
  --muted: #6f6c62;
  --input-bg: #f2f1ea;
  --input-border: #c0beb6;
  --input-text: #1a1a14;
  --secondary-stroke: #111111;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

body {
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover,
a:focus-visible {
  color: var(--accent);
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 100vw;
  height: 100vh;
}

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

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.toolbar-group.compact {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hidden-file {
  display: none;
}

.btn,
.field,
.search-input,
.sort-btn,
.theme-toggle {
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  border-radius: 0;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: border-color 0.12s ease, color 0.12s ease,
    background-color 0.12s ease;
}

.btn,
.sort-btn,
.theme-toggle {
  cursor: pointer;
}

.btn {
  padding: 7px 12px;
}

.theme-toggle {
  padding: 7px 12px;
}

.btn.ghost {
  background: transparent;
}

.search-input {
  width: min(420px, 40vw);
  padding: 7px 10px;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 12px;
}

.search-input::placeholder {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.field {
  padding: 7px 8px;
}

.field.short {
  width: 88px;
}

.btn:hover,
.sort-btn:hover,
.theme-toggle:hover,
.field:hover,
.search-input:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(249, 115, 22, 0.08);
}

.btn:focus-visible,
.sort-btn:focus-visible,
.theme-toggle:focus-visible,
.field:focus-visible,
.search-input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.workspace {
  display: grid;
  min-height: 0;
  min-width: 0;
}

.history-pane {
  min-height: 120px;
  min-width: 0;
  overflow: hidden;
}

.inspector-pane {
  min-height: 180px;
  min-width: 0;
  overflow: hidden;
}

.splitter {
  background: var(--panel-border);
}

.splitter.horizontal {
  height: 8px;
  cursor: row-resize;
  border-top: 1px solid var(--panel-border);
  border-bottom: 1px solid var(--panel-border);
}

.splitter.horizontal:hover {
  background: var(--accent);
}

.history-root {
  height: 100%;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--panel-border);
}

.history-scroll {
  height: 100%;
  overflow: auto;
  min-height: 0;
  outline: none;
}

.history-table {
  border-collapse: collapse;
  table-layout: fixed;
  width: 100%;
  min-width: 100%;
  font-family: var(--mono);
  font-size: 12px;
  background: var(--panel-bg);
}

.history-table col.col-method {
  width: 80px;
}

.history-table col.col-host {
  width: 220px;
}

.history-table col.col-path {
  width: 36%;
}

.history-table col.col-status {
  width: 80px;
}

.history-table col.col-mime {
  width: 140px;
}

.history-table col.col-bytes {
  width: 110px;
}

.history-table col.col-time {
  width: 240px;
}

.history-table col.col-duration {
  width: 110px;
}

.history-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0;
  background: var(--panel-bg);
  border-bottom: 1px solid var(--panel-border);
  border-right: 1px solid var(--panel-border);
  text-align: left;
  white-space: nowrap;
}

.history-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--panel-border);
  text-transform: none;
}

.cell-truncate {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.history-row {
  cursor: pointer;
}

.history-row:hover {
  background: rgba(249, 115, 22, 0.08);
}

.history-row.selected {
  background: rgba(249, 115, 22, 0.16);
}

.history-row .status {
  color: var(--accent);
}

.sort-btn {
  width: 100%;
  padding: 8px 8px;
  border-radius: 0;
  border: 0;
  text-align: left;
  background: var(--panel-bg);
}

.message-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100%;
  min-height: 0;
  gap: 12px;
  padding: 12px;
  background: var(--page-bg);
}

.message-panel {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--panel-border);
  border-radius: 0;
  background: var(--panel-bg);
}

.message-title {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--panel-border);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.message-view {
  margin: 0;
  padding: 12px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  white-space: pre;
  color: var(--text);
}

.status-bar {
  border-top: 1px solid var(--panel-border);
  background: var(--panel-bg);
  padding: 8px 12px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (max-width: 1000px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input {
    width: 100%;
  }

  .history-table {
    font-size: 11px;
  }

  .message-split {
    grid-template-columns: 1fr;
  }
}
