@font-face {
  font-family: "Pixelify Sans";
  src: url("/fonts/PixelifySans-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --iron-0: #0c1013;
  --iron-1: #141a1e;
  --iron-2: #1d252a;
  --iron-3: #28333a;
  --line: #3e4b52;
  --line-soft: #2c373d;
  --paper: #e8e0cd;
  --muted: #a69f91;
  --brass: #c6873f;
  --brass-light: #e2aa63;
  --brass-dark: #704723;
  --good: #78a76f;
  --danger: #bd6559;
  font-family: "Pixelify Sans", "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--iron-0);
  color: var(--paper);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.workshop-shell {
  display: grid;
  grid-template-rows: 64px 44px minmax(0, 1fr) 28px;
  width: 100%;
  height: 100%;
  background: var(--iron-0);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  border-bottom: 1px solid #050708;
  box-shadow: inset 0 -1px var(--line);
  background: #171e22;
}

.brand-logo {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
}

.brand-copy p,
.brand-copy h1,
.panel-heading h2,
.panel-heading small,
.server-state small,
.function-label small,
.function-label strong {
  margin: 0;
}

.brand-copy p {
  color: var(--brass-light);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand-copy h1 {
  margin-top: 2px;
  font-family: "Pixelify Sans", "Segoe UI", sans-serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.server-state {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: #101519;
}

.server-state small {
  display: block;
  color: var(--muted);
  font: 700 9px/1.2 Consolas, monospace;
  letter-spacing: 0.12em;
}

.server-state strong {
  display: block;
  margin-top: 2px;
  font: 700 11px/1.2 Consolas, monospace;
}

.signal-lamp {
  width: 10px;
  height: 10px;
  border: 1px solid #0b0d0e;
  border-radius: 50%;
  background: #6f5535;
  box-shadow: 0 0 0 2px #2b3439;
}

.signal-lamp.online {
  background: var(--good);
  box-shadow: 0 0 0 2px #2b3439, 0 0 9px rgba(120, 167, 111, 0.5);
}

.signal-lamp.offline {
  background: var(--danger);
}

.toolrail {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-bottom: 1px solid #050708;
  box-shadow: inset 0 -1px var(--line-soft);
  background: #20292e;
}

.tool-button,
.icon-button,
.add-function {
  min-height: 28px;
  border: 1px solid #4b585e;
  border-radius: 2px;
  background: #273138;
  color: #d9d3c5;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.035em;
}

.tool-button {
  padding: 0 12px;
}

.tool-button:hover,
.icon-button:hover,
.add-function:hover {
  border-color: var(--brass);
  background: #303b41;
}

.tool-button.primary {
  border-color: var(--brass-dark);
  background: #6e4826;
  color: #fff3dd;
}

.tool-button.primary:hover {
  border-color: var(--brass-light);
  background: #80552d;
}

.rail-divider {
  width: 1px;
  height: 24px;
  margin: 0 3px;
  background: var(--line);
}

.workspace {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 0;
}

.library-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-height: 0;
  border-right: 1px solid #050708;
  box-shadow: inset -1px 0 var(--line);
  background: #151c20;
}

.panel-heading {
  display: flex;
  align-items: center;
  padding: 14px 12px 10px;
}

.panel-heading small,
.function-label small {
  color: var(--brass-light);
  font: 700 9px/1 Consolas, monospace;
  letter-spacing: 0.13em;
}

.panel-heading h2 {
  margin-top: 3px;
  font-size: 15px;
}

.icon-button {
  width: 28px;
  margin-left: auto;
  padding: 0;
  font-size: 18px;
}

.filter-field {
  display: block;
  margin: 0 10px 8px;
}

.filter-field span,
.manifest-meta label {
  display: block;
  margin: 0 0 4px 1px;
  color: var(--muted);
  font: 700 9px/1 Consolas, monospace;
  letter-spacing: 0.12em;
}

.filter-field input,
.manifest-meta input,
.manifest-meta select {
  width: 100%;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 2px;
  outline: 0;
  background: #0f1518;
  color: var(--paper);
  font-size: 11px;
  padding: 0 8px;
}

.filter-field input:focus,
.manifest-meta input:focus,
.manifest-meta select:focus {
  border-color: var(--brass);
}

.manifest-meta select {
  margin-bottom: 9px;
  background: #0f1518;
  color: var(--paper);
}

.manifest-list {
  min-height: 0;
  overflow: auto;
  padding: 2px 8px 10px;
}

.manifest-entry {
  display: block;
  width: 100%;
  margin: 0 0 4px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-left: 3px solid #46545b;
  background: #1c2529;
  color: var(--paper);
  cursor: pointer;
  text-align: left;
}

.manifest-entry:hover {
  border-color: #48565d;
  border-left-color: var(--brass);
}

.manifest-entry.current-graph-entry {
  position: sticky;
  top: 0;
  z-index: 2;
  border-color: #4d5c63;
  border-left-color: var(--brass);
  background: #232d31;
}

.manifest-entry:disabled {
  cursor: default;
  opacity: 0.55;
}

body[data-public-site="true"] .workspace {
  grid-template-columns: minmax(0, 1fr);
}

body[data-public-site="true"] .library-panel {
  display: none;
}

.manifest-entry.active {
  border-color: var(--brass-dark);
  border-left-color: var(--brass-light);
  background: #2a2923;
}

.manifest-entry strong,
.manifest-entry small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manifest-entry strong {
  font-size: 11px;
}

.manifest-entry small {
  margin-top: 3px;
  color: var(--muted);
  font: 10px/1.2 Consolas, monospace;
}

.empty-message {
  margin: 24px 10px;
  color: #797f7d;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.manifest-meta {
  padding: 10px;
  border-top: 1px solid var(--line-soft);
}

.manifest-meta p {
  margin: 7px 1px 0;
  color: var(--muted);
  font: 10px/1.3 Consolas, monospace;
}

.editor-panel {
  display: grid;
  grid-template-rows: 38px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  background: var(--iron-0);
}

.function-bar {
  display: flex;
  align-items: stretch;
  min-width: 0;
  border-bottom: 1px solid #050708;
  background: #11171a;
}

.function-label {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 104px;
  padding-left: 12px;
  border-right: 1px solid var(--line-soft);
}

.function-label strong {
  margin-top: 2px;
  font-size: 11px;
}

.function-tabs {
  display: flex;
  min-width: 0;
  overflow-x: auto;
}

.function-tab {
  position: relative;
  min-width: 86px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid var(--line-soft);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.function-tab:hover {
  color: var(--paper);
  background: #192125;
}

.function-tab.active {
  color: #fff2dc;
  background: #28271f;
}

.function-tab.active::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  content: "";
  background: var(--brass);
}

.add-function {
  min-width: 86px;
  margin: 5px 7px 5px auto;
  padding: 0 10px;
}

.editor-mount {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #0d1215;
}

.editor-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  color: var(--muted);
  font: 700 11px/1 Consolas, monospace;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.loading-cog {
  width: 34px;
  height: 34px;
  margin: auto;
  border: 4px dotted var(--brass);
  border-radius: 50%;
  animation: turn 2s linear infinite;
}

@keyframes turn {
  to { transform: rotate(360deg); }
}

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  border-top: 1px solid var(--line);
  background: #101619;
  color: var(--muted);
  font: 10px/1 Consolas, monospace;
}

.status-bolt {
  margin-right: 7px;
  color: var(--brass);
}

.document-stats {
  display: flex;
  gap: 18px;
}

#statusText.error {
  color: #e98b7f;
}

#statusText.success {
  color: #9bc291;
}

@media (max-width: 850px) {
  .workspace {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .tool-button {
    padding: 0 7px;
    font-size: 10px;
  }

  .brand-copy h1 {
    font-size: 18px;
  }
}
