@font-face {
  font-family: 'Bare Sans';
  src: url('/static/fonts/BareSans-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Bare Sans';
  src: url('/static/fonts/BareSans-Medium.woff') format('woff');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Bare Sans';
  src: url('/static/fonts/BareSans-Bold.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  --brand: 'Bare Sans';

  --paper: #edece8;
  --surface: #ffffff;
  --surface-2: #f6f5f2;
  --surface-3: #eceae5;

  --ink: #171614;
  --ink-2: #57544e;
  --ink-3: #8d8a83;
  --ink-4: #b5b1a9;

  --line: #dedbd4;
  --line-2: #c9c5bc;
  --line-strong: #171614;

  --accent: #b3381d;
  --accent-ink: #ffffff;
  --accent-soft: #f7e7e2;
  --accent-line: #d8a294;

  --ok: #2f6b45;
  --warn: #8a6216;

  --grid-line: #e4e2dc;
  --scrim: rgba(23, 22, 20, 0.34);

  --r: 2px;
  --row: 26px;
  --pad: 10px;

  --ui: ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas,
    monospace;

  --fs-xs: 10.5px;
  --fs-sm: 11.5px;
  --fs: 12.5px;
  --fs-md: 13.5px;
}

:root[data-theme='dark'] {
  color-scheme: dark;

  --paper: #101010;
  --surface: #191918;
  --surface-2: #212120;
  --surface-3: #2a2a28;

  --ink: #eceae5;
  --ink-2: #a8a49c;
  --ink-3: #78756e;
  --ink-4: #56534d;

  --line: #2e2e2c;
  --line-2: #3d3d3a;
  --line-strong: #eceae5;

  --accent: #e0674a;
  --accent-ink: #1a0f0b;
  --accent-soft: #33201a;
  --accent-line: #6b3728;

  --ok: #6aab84;
  --warn: #c9a24f;

  --grid-line: #232322;
  --scrim: rgba(0, 0, 0, 0.56);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: var(--fs);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

.app {
  display: grid;
  grid-template-rows: 38px 1fr 24px;
  height: 100vh;
  width: 100vw;
}

.workspace {
  min-height: 0;
  min-width: 0;
  display: grid;
  overflow: hidden;
}

.panel {
  background: var(--surface);
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel--left {
  border-right: 1px solid var(--line);
}

.panel--right {
  border-left: 1px solid var(--line);
}

.panel__scroll {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
}

.section {
  border-bottom: 1px solid var(--line);
}

.section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: var(--row);
  padding: 0 var(--pad);
  color: var(--ink-3);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  user-select: none;
}

.section__head button {
  color: var(--ink-3);
}

.section__body {
  padding: 2px var(--pad) 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.section--collapsed .section__body {
  display: none;
}

.field {
  display: grid;
  grid-template-columns: 84px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}

.field--wide {
  grid-template-columns: 1fr;
  gap: 3px;
}

.field__label {
  color: var(--ink-2);
  font-size: var(--fs-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.field__row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.input {
  width: 100%;
  min-width: 0;
  height: 22px;
  padding: 0 5px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r);
  font-size: var(--fs);
  font-variant-numeric: tabular-nums;
}

.input:hover {
  border-color: var(--line);
}

.input:focus {
  background: var(--surface);
  border-color: var(--accent);
  outline: none;
}

.input--num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  cursor: ew-resize;
}

.input--text {
  cursor: text;
}

textarea.input {
  height: auto;
  min-height: 56px;
  padding: 4px 5px;
  resize: vertical;
  line-height: 1.45;
  cursor: text;
}

select.input {
  cursor: pointer;
  appearance: none;
  padding-right: 18px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 10px) 10px, calc(100% - 6px) 10px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

.unit {
  color: var(--ink-4);
  font-size: var(--fs-xs);
  flex: 0 0 auto;
  width: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: var(--fs);
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--line-2);
}

.btn:active {
  background: var(--surface-3);
}

.btn[disabled] {
  color: var(--ink-4);
  cursor: default;
  background: transparent;
  border-color: var(--line);
}

.btn--primary {
  background: var(--ink);
  color: var(--surface);
  border-color: var(--ink);
}

.btn--primary:hover {
  background: var(--ink-2);
  border-color: var(--ink-2);
}

.btn--quiet {
  border-color: transparent;
  color: var(--ink-2);
  padding: 0 5px;
}

.btn--quiet:hover {
  background: var(--surface-2);
  border-color: transparent;
  color: var(--ink);
}

.btn--icon {
  width: 22px;
  padding: 0;
  border-color: transparent;
  color: var(--ink-2);
}

.btn--icon:hover {
  background: var(--surface-2);
  border-color: transparent;
  color: var(--ink);
}

.btn--icon.is-on {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn--danger:hover {
  color: var(--accent);
  border-color: var(--accent-line);
}

.btn-row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  height: 22px;
}

.seg__item {
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  padding: 0 8px;
  font-size: var(--fs-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
}

.seg__item:last-child {
  border-right: 0;
}

.seg__item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.seg__item.is-active {
  background: var(--ink);
  color: var(--surface);
}

.seg--quiet .seg__item.is-active {
  background: var(--surface-3);
  color: var(--ink);
}

.switch {
  width: 26px;
  height: 14px;
  border: 1px solid var(--line-2);
  border-radius: 1px;
  background: var(--surface-2);
  position: relative;
  padding: 0;
  flex: 0 0 auto;
}

.switch::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  width: 10px;
  height: 10px;
  background: var(--ink-3);
  transition: transform 90ms linear;
}

.switch.is-on {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

.switch.is-on::after {
  transform: translateX(12px);
  background: var(--accent);
}

.list {
  display: flex;
  flex-direction: column;
}

.list__item {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--row);
  padding: 0 var(--pad);
  border: 0;
  background: transparent;
  text-align: left;
  width: 100%;
  color: var(--ink);
  font-size: var(--fs);
}

.list__item:hover {
  background: var(--surface-2);
}

.list__item.is-active {
  background: var(--accent-soft);
  color: var(--ink);
  box-shadow: inset 2px 0 0 var(--accent);
}

.list__item__meta {
  margin-left: auto;
  color: var(--ink-4);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  user-select: none;
}

.wordmark {
  font-family: var(--brand), var(--ui);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  padding-right: 4px;
  color: var(--ink);
}

.topbar__spacer {
  flex: 1;
}

.statusbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 10px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  user-select: none;
  overflow: hidden;
  white-space: nowrap;
}

.status-dot {
  width: 5px;
  height: 5px;
  background: var(--ink-4);
  flex: 0 0 auto;
}

.status-dot.is-ready {
  background: var(--ok);
}

.status-dot.is-error {
  background: var(--accent);
}

.status-dot.is-busy {
  background: var(--warn);
}

.overlay {
  position: fixed;
  inset: 0;
  background: color-mix(in srgb, var(--paper) 72%, transparent);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  z-index: 60;
}

.dialog {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  width: min(560px, calc(100vw - 32px));
  max-height: 76vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 34px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-md);
}

.dialog__body {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dialog__foot {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.11);
  padding: 3px 0;
  min-width: 170px;
  z-index: 70;
}

.menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 24px;
  padding: 0 10px;
  background: transparent;
  border: 0;
  text-align: left;
  font-size: var(--fs);
  color: var(--ink);
}

.menu__item:hover {
  background: var(--surface-2);
}

.menu__item kbd {
  margin-left: auto;
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: var(--fs-xs);
}

.menu__sep {
  height: 1px;
  background: var(--line);
  margin: 3px 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--surface);
  padding: 7px 13px;
  border-radius: var(--r);
  font-size: var(--fs);
  z-index: 80;
  max-width: 60vw;
}

.toast.is-error {
  background: var(--accent);
  color: var(--accent-ink);
}

.hint {
  color: var(--ink-3);
  font-size: var(--fs-xs);
  line-height: 1.45;
}

.mono {
  font-family: var(--mono);
  font-size: var(--fs-sm);
}

.hr {
  height: 1px;
  background: var(--line);
  margin: 6px 0;
}

.empty {
  padding: 18px var(--pad);
  color: var(--ink-3);
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.resizer {
  width: 3px;
  cursor: col-resize;
  background: transparent;
  margin: 0 -2px;
  z-index: 5;
  position: relative;
}

.resizer:hover {
  background: var(--accent-line);
}

.scrub {
  cursor: ew-resize;
  user-select: none;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border: 3px solid var(--surface);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ink-4);
}
