:root {
  color-scheme: dark;
  --canvas: #0a0c0c;
  --surface: #101313;
  --surface-raised: #151818;
  --surface-hover: #1b1e1d;
  --ink: #f2f1eb;
  --ink-2: #b4b5af;
  --ink-3: #747975;
  --line: #303432;
  --line-soft: #202422;
  --signal: #29d3b5;
  --signal-dim: #163f38;
  --archive: #cb67d4;
  --good: #42c99c;
  --warn: #e4b34a;
  --bad: #ef625c;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;
  font-family: var(--sans);
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --canvas: #e9e7df;
    --surface: #f1efe8;
    --surface-raised: #fbfaf5;
    --surface-hover: #ffffff;
    --ink: #151716;
    --ink-2: #4f534f;
    --ink-3: #777b76;
    --line: #aaa9a0;
    --line-soft: #d5d2c8;
    --signal: #007e72;
    --signal-dim: #cae2dc;
    --archive: #963b98;
    --good: #087c59;
    --warn: #936100;
    --bad: #bd3834;
  }
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input { font: inherit; }

button {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: -2px;
}

[hidden] { display: none !important; }

/* Workspace */

.app-shell {
  height: 100dvh;
  display: grid;
  grid-template:
    "command command command" 52px
    "nav browser inspector" minmax(0, 1fr)
    / 218px minmax(520px, 1fr) 338px;
  overflow: hidden;
  border-top: 3px solid var(--signal);
  background: var(--canvas);
}

.command-bar {
  grid-area: command;
  z-index: 10;
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr) 338px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  height: 49px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-right: 1px solid var(--line);
  padding: 0 16px;
  color: inherit;
  text-decoration: none;
}

.brand-glyph {
  width: 27px;
  height: 27px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: end;
  gap: 2px;
  padding: 5px;
  border: 1px solid var(--line);
  background: var(--canvas);
}

.brand-glyph i {
  display: block;
  background: var(--ink-3);
}

.brand-glyph i:nth-child(1) { height: 35%; }
.brand-glyph i:nth-child(2) { height: 58%; }
.brand-glyph i:nth-child(3) { height: 79%; }
.brand-glyph i:nth-child(4) { height: 100%; background: var(--signal); }

.brand strong {
  display: block;
  font-size: 15px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -.025em;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.command-context {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9px;
  white-space: nowrap;
}

.command-context i {
  color: var(--line);
  font-style: normal;
}

.command-context strong {
  overflow: hidden;
  color: var(--ink-2);
  font-weight: 650;
  text-overflow: ellipsis;
}

.command-actions {
  height: 49px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  border-left: 1px solid var(--line);
  padding: 0 13px;
}

.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.connection-state i,
.source-live {
  width: 6px;
  height: 6px;
  display: inline-block;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 12%, transparent);
}

.text-button {
  border: 0;
  border-left: 1px solid var(--line);
  padding: 3px 4px 3px 15px;
  background: transparent;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}

.text-button:hover { color: var(--signal); }

/* Navigator */

.navigator {
  grid-area: nav;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.nav-section {
  border-bottom: 1px solid var(--line);
  padding: 19px 10px 15px;
}

.nav-label {
  margin: 0 7px 9px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 750;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.nav-item,
.filter-item {
  position: relative;
  width: 100%;
  min-height: 35px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 0;
  padding: 0 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.filter-item:hover { background: var(--surface-hover); color: var(--ink); }

.nav-item.active,
.filter-item.active {
  background: var(--signal-dim);
  color: var(--ink);
}

.nav-item.active::before,
.filter-item.active::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -10px;
  width: 3px;
  background: var(--signal);
}

.nav-item strong,
.filter-item strong {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
}

.nav-icon {
  width: 13px;
  height: 13px;
  display: block;
  border: 1px solid var(--ink-3);
}

.live-icon {
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--signal) 0 28%, transparent 32%),
    transparent;
}

.archive-icon {
  box-shadow: inset 0 -4px var(--archive);
}

.filter-item {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 30px;
  padding-left: 25px;
  color: var(--ink-3);
  font-size: 10px;
}

.filter-item.active {
  background: transparent;
  color: var(--ink);
}

.filter-item.active::before { left: 8px; width: 5px; height: 5px; top: 13px; border-radius: 50%; }

.source-section { margin-top: auto; }

.source-row {
  min-height: 27px;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 8px;
}

.source-row > i:not(.source-live) {
  width: 5px;
  height: 5px;
  border: 1px solid var(--ink-3);
  border-radius: 50%;
}

.source-row strong {
  font-weight: 650;
  text-transform: uppercase;
}

.navigator-foot {
  min-height: 52px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 0 18px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .04em;
}

/* Browser */

.browser {
  grid-area: browser;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--canvas);
}

.browser-view {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.browser-toolbar {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  background: var(--surface-raised);
}

.browser-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
}

.scope-number {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--signal);
  color: var(--signal);
  font-family: var(--mono);
  font-size: 9px;
}

.archive-scope {
  border-color: var(--archive);
  color: var(--archive);
}

.browser-title h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 590;
  line-height: 1.1;
  letter-spacing: -.035em;
}

.browser-title p {
  margin: 5px 0 0;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 8px;
}

.finder-search {
  width: min(430px, 48%);
  height: 38px;
  display: grid;
  grid-template-columns: 17px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  padding: 0 9px;
  background: var(--canvas);
}

.finder-search > span {
  position: relative;
  width: 11px;
  height: 11px;
  display: block;
  border: 1.5px solid var(--ink-3);
  border-radius: 50%;
}

.finder-search > span::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 1.5px;
  right: -4px;
  bottom: -2px;
  background: var(--ink-3);
  transform: rotate(45deg);
}

.finder-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

.finder-search input::placeholder { color: var(--ink-3); }

kbd {
  border: 1px solid var(--line);
  padding: 2px 4px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 500;
}

.path-strip {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 8px;
  background: var(--surface);
}

.path-strip i { color: var(--line); font-style: normal; }
.path-strip strong { color: var(--ink-2); font-weight: 650; }

.path-strip button {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 7px;
  text-transform: uppercase;
  cursor: pointer;
}

.path-strip button:hover { color: var(--signal); }

.status-line {
  min-height: 36px;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.5;
  background: var(--surface);
}

.status-line.error { color: var(--bad); }

.list-columns,
.file-row {
  display: grid;
  grid-template-columns:
    minmax(166px, 1.05fr)
    minmax(210px, 1.25fr)
    minmax(130px, .82fr)
    minmax(100px, .62fr)
    minmax(84px, .5fr);
}

.list-columns {
  flex: 0 0 auto;
  min-height: 28px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.list-columns span {
  height: 100%;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--line-soft);
  padding: 0 10px;
}

.file-list {
  min-height: 0;
  flex: 1;
  overflow: auto;
  scrollbar-color: var(--line) transparent;
}

.file-row {
  --row-color: var(--signal);
  position: relative;
  width: 100%;
  min-height: 54px;
  align-items: stretch;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  padding: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: default;
}

.file-row:hover { background: var(--surface-hover); }
.file-row.selected { background: var(--signal-dim); }
.file-row:focus-visible { outline-offset: -2px; }

.file-cell {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--line-soft);
  padding: 8px 10px;
}

.file-cell:last-child { border-right: 0; }

.name-cell {
  position: relative;
  display: grid;
  grid-template-columns: 23px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding-left: 9px;
}

.file-mark {
  width: 18px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--row-color) 68%, var(--line));
  background: color-mix(in srgb, var(--row-color) 10%, transparent);
  color: var(--row-color);
  font-family: var(--mono);
  font-size: 6px;
  font-weight: 750;
}

.file-mark::after { content: "TR"; }

.cell-main {
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-sub {
  overflow: hidden;
  margin-top: 4px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 7px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branch-text { color: var(--row-color); }
.route-cell .cell-main { font-size: 12px; font-weight: 520; letter-spacing: -.015em; }
.status-cell.good .cell-main { color: var(--good); }
.status-cell.warn .cell-main { color: var(--warn); }
.status-cell.bad .cell-main { color: var(--bad); }

.status-pip {
  width: 5px;
  height: 5px;
  display: inline-block;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
}

.file-row::after {
  content: "›";
  position: absolute;
  right: 8px;
  top: 50%;
  color: transparent;
  font-size: 17px;
  transform: translateY(-50%);
}

.file-row:hover::after,
.file-row.selected::after { color: var(--signal); }

.storage-group {
  min-height: 29px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 2;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0 10px;
  background: var(--surface-raised);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.archive-search {
  min-width: 460px;
  display: grid;
  grid-template-columns: auto minmax(190px, 1fr) 58px;
  gap: 8px;
}

.archive-search .finder-search { width: 100%; }

.lookup-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
}

.segment,
.run-button {
  border: 0;
  background: var(--canvas);
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 8px;
  cursor: pointer;
}

.segment { min-width: 48px; border-right: 1px solid var(--line); }
.segment:last-child { border-right: 0; }
.segment.active { background: var(--archive); color: #fff; }

.run-button {
  background: var(--ink);
  color: var(--canvas);
  font-weight: 750;
  text-transform: uppercase;
}

.run-button:hover { background: var(--signal); color: #061d18; }
.run-button:disabled { opacity: .45; cursor: default; }

.empty-state {
  height: 100%;
  min-height: 300px;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 30px;
  color: var(--ink-3);
  text-align: center;
}

.empty-index {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  color: var(--archive);
  font-family: var(--mono);
  font-size: 11px;
}

.empty-state strong { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.empty-state p { max-width: 280px; margin: 8px 0 0; font-size: 11px; line-height: 1.5; }

/* Inspector */

.inspector {
  grid-area: inspector;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-left: 1px solid var(--line);
  background: var(--surface);
}

.inspector-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: var(--ink-3);
  text-align: center;
}

.inspector-mark {
  width: 44px;
  height: 58px;
  display: block;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  box-shadow:
    7px 7px 0 -1px var(--surface),
    7px 7px 0 0 var(--line);
}

.inspector-empty strong { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.inspector-empty p { max-width: 230px; margin: 8px 0 0; font-size: 10px; line-height: 1.5; }

.inspector-content {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.inspector-head {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  background: var(--surface-raised);
}

.inspector-label,
.inspector-section h3,
.kv-list dt,
.settings-form > label,
.dialog-head > div > span {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 750;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.detail-title-main {
  margin-top: 5px;
  font-size: 16px;
  font-weight: 620;
  letter-spacing: -.025em;
}

.detail-title-sub {
  margin-top: 3px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 7px;
  text-transform: uppercase;
}

.close-inspector {
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  padding: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 18px;
  font-weight: 300;
  cursor: pointer;
}

.close-inspector:hover { border-color: var(--ink); color: var(--ink); }

#detail-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--line) transparent;
}

.detail-notice {
  border-bottom: 1px solid var(--signal);
  padding: 10px 14px;
  color: var(--signal);
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.45;
}

.detail-notice.error { border-color: var(--bad); color: var(--bad); }

.inspector-identity {
  --row-color: var(--signal);
  border-bottom: 1px solid var(--line);
  padding: 24px 15px 20px;
  box-shadow: inset 3px 0 var(--row-color);
}

.identity-branch {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--row-color);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.identity-branch i {
  width: 6px;
  height: 6px;
  display: block;
  background: var(--row-color);
}

.identity-route {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 12px;
  font-size: 24px;
  font-weight: 480;
  line-height: 1.08;
  letter-spacing: -.045em;
}

.identity-route i { color: var(--ink-3); font-style: normal; font-weight: 300; }

.identity-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 17px;
}

.badge {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  border-left: 2px solid var(--line);
  padding: 2px 7px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 750;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.badge.late,
.badge.canceled { border-color: var(--bad); color: var(--bad); }
.badge.early,
.badge.ontime { border-color: var(--good); color: var(--good); }
.badge.held { border-color: var(--warn); color: var(--warn); }

.inspector-section {
  border-bottom: 1px solid var(--line);
  padding: 18px 14px;
}

.inspector-section h3 {
  margin: 0 0 11px;
}

.kv-list {
  display: grid;
  margin: 0;
}

.kv-list > div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 10px;
  border-top: 1px solid var(--line-soft);
  padding: 8px 0;
}

.kv-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink-2);
  font-size: 9px;
  font-weight: 560;
  line-height: 1.4;
}

.stop-list {
  --stop-axis: 6px;
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
}

.stop-list::before {
  content: "";
  position: absolute;
  top: 20px;
  bottom: 20px;
  left: calc(var(--stop-axis) - .5px);
  width: 1px;
  background: var(--line);
}

.stop-row {
  position: relative;
  min-height: 47px;
  display: grid;
  grid-template-columns: calc(var(--stop-axis) * 2) minmax(0, 1fr) 55px 36px;
  align-items: center;
  gap: 7px;
  border-top: 1px solid var(--line-soft);
  padding: 5px 0;
}

.stop-row:first-child { border-top: 0; }
.stop-row.employee { opacity: .55; }
.stop-row.local-cancel .stop-name { color: var(--bad); text-decoration: line-through; }

.stop-dot {
  z-index: 1;
  width: 7px;
  height: 7px;
  justify-self: center;
  border: 1px solid var(--ink-3);
  border-radius: 50%;
  background: var(--surface);
}

.stop-row.departed .stop-dot { border-color: var(--good); background: var(--good); }
.stop-row.berthed .stop-dot { border-color: var(--signal); background: var(--signal); }
.stop-name { font-size: 9px; font-weight: 590; }

.stop-sub {
  display: block;
  margin-top: 3px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 6px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.stop-time {
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 7px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.stop-time .actual { font-weight: 700; }
.stop-time .late { color: var(--bad); }
.stop-time .early { color: var(--good); }

.track-pill {
  min-width: 32px;
  border: 1px solid var(--line);
  padding: 5px 3px;
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 750;
  text-align: center;
}

.track-pill.posted { border-color: var(--good); color: var(--good); }
.track-pill.predicted { border-color: var(--signal); color: var(--signal); }
.track-pill.moved,
.track-pill.actual { border-color: var(--warn); color: var(--warn); }

.track-prev {
  margin-top: 2px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 6px;
  text-align: center;
  text-decoration: line-through;
}

.consist-strip {
  display: flex;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  scrollbar-color: var(--line) transparent;
}

.car-box {
  min-width: 96px;
  flex: 0 0 auto;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 11px;
  background: var(--canvas);
}

.car-box.highlight {
  box-shadow: inset 0 -3px var(--signal);
  background: var(--signal-dim);
}

.car-number { font-size: 14px; font-weight: 580; font-variant-numeric: tabular-nums; }
.car-sub {
  margin-top: 5px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 6px;
  line-height: 1.45;
  text-transform: uppercase;
}

/* Branch colors */

.card-color-006ec7 { --row-color: #168cdb; }
.card-color-00985f { --row-color: #22b981; }
.card-color-00a1de { --row-color: #1eb6e8; }
.card-color-00af3f { --row-color: #28c467; }
.card-color-00b2a9 { --row-color: #20c7bf; }
.card-color-4d5357 { --row-color: #a3adb3; }
.card-color-60269e { --row-color: #9167d9; }
.card-color-6e3219 { --row-color: #bc744e; }
.card-color-a626aa { --row-color: #d14ed6; }
.card-color-c70b30 { --row-color: #e83e61; }
.card-color-ce8e00 { --row-color: #e5a51b; }
.card-color-ff6319 { --row-color: #ff7a32; }

/* Settings */

dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
}

dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(0, 0, 0, .74); backdrop-filter: blur(4px); }

.dialog-head {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  background: var(--surface-raised);
}

.dialog-head h2 {
  margin: 5px 0 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.035em;
}

.settings-form {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  padding: 22px;
}

.settings-form > label {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.settings-form input {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0 10px;
  background: var(--canvas);
  color: var(--ink);
}

.settings-form p {
  margin: 0;
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.55;
}

.settings-form .check-row {
  flex-direction: row;
  align-items: center;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
}

.settings-form .check-row input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--signal);
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  padding-top: 4px;
}

.primary-button,
.secondary-button {
  min-height: 36px;
  border-radius: 0;
  padding: 0 12px;
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}

.primary-button { border: 0; background: var(--signal); color: #06231e; }
.secondary-button { border: 1px solid var(--line); background: transparent; color: var(--ink-2); }

/* Responsive */

@media (max-width: 1160px) {
  .app-shell {
    grid-template:
      "command command" 52px
      "nav browser" minmax(0, 1fr)
      / 205px minmax(0, 1fr);
  }

  .command-bar { grid-template-columns: 205px minmax(0, 1fr) auto; }

  .inspector {
    position: fixed;
    top: 52px;
    right: 0;
    bottom: 0;
    z-index: 30;
    width: min(390px, 92vw);
    box-shadow: -18px 0 60px rgba(0,0,0,.34);
    transform: translateX(100%);
    transition: transform 180ms ease;
  }

  .app-shell.inspector-open .inspector { transform: translateX(0); }
  .inspector-empty { display: none; }
}

@media (max-width: 820px) {
  body { overflow: auto; }

  .app-shell {
    min-height: 100dvh;
    height: auto;
    display: block;
    padding-top: 49px;
  }

  .command-bar {
    position: fixed;
    top: 3px;
    right: 0;
    left: 0;
    z-index: 40;
    height: 49px;
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto;
  }

  .brand { border-right: 0; }
  .command-context,
  .connection-state { display: none; }
  .command-actions { border-left: 0; }

  .navigator {
    position: fixed;
    right: 12px;
    bottom: 12px;
    left: 12px;
    z-index: 35;
    min-height: 56px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-raised) 92%, transparent);
    backdrop-filter: blur(18px);
  }

  .navigator .nav-section:first-child {
    display: contents;
  }

  .navigator .nav-label,
  .nav-filters,
  .source-section,
  .navigator-foot { display: none; }

  .nav-item {
    min-height: 56px;
    grid-template-columns: 17px auto;
    justify-content: center;
    border-right: 1px solid var(--line);
    padding: 0 12px;
  }

  .nav-item:last-child { border-right: 0; }
  .nav-item strong { display: none; }
  .nav-item.active::before { top: auto; right: 0; bottom: 0; left: 0; width: auto; height: 3px; }

  .browser { min-height: calc(100dvh - 49px); }
  .browser-view { min-height: calc(100dvh - 49px); }

  .browser-toolbar {
    min-height: 126px;
    align-items: stretch;
    flex-direction: column;
    gap: 13px;
    padding: 17px 14px 14px;
  }

  .finder-search { width: 100%; }
  .archive-search { min-width: 0; grid-template-columns: auto minmax(0, 1fr) 54px; }

  .list-columns { display: none; }

  .file-row {
    min-height: 91px;
    grid-template-columns: minmax(0, 1fr) minmax(100px, .6fr);
    padding: 0 26px 0 0;
  }

  .file-cell { border-right: 0; }
  .name-cell { grid-column: 1; grid-row: 1; padding-bottom: 3px; }
  .route-cell { grid-column: 1 / -1; grid-row: 2; padding: 2px 10px 11px 40px; }
  .route-cell .cell-main { overflow: visible; font-size: 17px; white-space: normal; }
  .position-cell { grid-column: 2; grid-row: 1; align-items: flex-end; text-align: right; }
  .status-cell { grid-column: 1; grid-row: 3; padding: 7px 10px 9px 40px; border-top: 1px solid var(--line-soft); }
  .observed-cell { grid-column: 2; grid-row: 3; align-items: flex-end; padding: 7px 10px 9px; border-top: 1px solid var(--line-soft); text-align: right; }

  .file-row::after { color: var(--ink-3); }

  .inspector {
    top: 3px;
    width: 100vw;
    max-width: none;
  }

  .inspector-head { min-height: 64px; }
  .identity-route { font-size: 29px; }
}

@media (max-width: 520px) {
  .brand small { display: none; }
  .brand-glyph { width: 25px; height: 25px; }
  .settings-button { border-left: 0; padding-left: 4px; }

  .archive-toolbar { min-height: 147px; }
  .archive-search {
    grid-template-columns: 1fr 52px;
  }

  .lookup-switch {
    grid-column: 1 / -1;
    min-height: 32px;
  }

  .path-strip { overflow: hidden; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
