:root {
  color-scheme: dark;
  --bg: #090909;
  --panel: #11110f;
  --panel-strong: #171716;
  --line: #2c2a26;
  --text: #f2eee7;
  --muted: #a8a096;
  --soft: #70695f;
  --accent: #d6ff73;
  --blue: #8fb7ff;
  --danger: #ff877f;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 320px;
  min-height: 100vh;
  overflow: hidden;
}

.sidebar,
.inspector {
  background: var(--panel);
  border-color: var(--line);
  min-height: 100vh;
  overflow-y: auto;
  padding: 18px;
}

.sidebar {
  border-right: 1px solid var(--line);
}

.inspector {
  border-left: 1px solid var(--line);
}

.brand-lockup,
.topbar,
.frame-header,
.route-tools,
.topbar__actions {
  display: flex;
  align-items: center;
}

.brand-lockup,
.topbar {
  justify-content: space-between;
  gap: 16px;
}

.brand-lockup {
  margin-bottom: 22px;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 5px;
  text-transform: uppercase;
}

h1,
h2 {
  font-size: 1rem;
  line-height: 1.15;
  margin: 0;
}

.auth-pill,
.save-state {
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  padding: 6px 8px;
  white-space: nowrap;
}

.auth-pill.is-secure {
  border-color: rgba(214, 255, 115, 0.45);
  color: var(--accent);
}

.auth-pill.is-warning {
  border-color: rgba(255, 135, 127, 0.5);
  color: var(--danger);
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}

.field span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

input,
select,
textarea {
  background: #0b0b0a;
  border: 1px solid var(--line);
  color: var(--text);
  min-width: 0;
  outline: 0;
  padding: 10px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
}

textarea {
  min-height: 220px;
  resize: vertical;
}

.route-tools {
  gap: 8px;
  margin-bottom: 14px;
}

.tool-button,
.icon-button,
.primary-button {
  border: 1px solid var(--line);
  color: var(--text);
  min-height: 34px;
  padding: 8px 10px;
}

.tool-button,
.icon-button {
  background: transparent;
}

.tool-button.is-active,
.icon-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #15180b;
  font-weight: 800;
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.route-list {
  display: grid;
  gap: 14px;
}

.route-group {
  display: grid;
  gap: 6px;
}

.route-group__title {
  color: var(--soft);
  font-size: 0.7rem;
  font-weight: 800;
  margin: 0;
  text-transform: uppercase;
}

.route-button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  display: grid;
  gap: 4px;
  padding: 8px;
  text-align: left;
  width: 100%;
}

.route-button strong {
  color: var(--text);
  font-size: 0.86rem;
}

.route-button span {
  color: var(--soft);
  font-size: 0.7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-button.is-active,
.route-button:hover {
  background: var(--panel-strong);
  border-color: var(--line);
}

.route-button[data-status="approved"] {
  border-left-color: var(--accent);
}

.route-button[data-status="revise"] {
  border-left-color: var(--danger);
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

.topbar {
  background: rgba(9, 9, 9, 0.9);
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
}

.topbar__actions {
  gap: 8px;
}

.canvas {
  background-color: #080808;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(520px, 1fr) 420px;
  overflow: auto;
  padding: 28px;
}

.frame-node {
  align-self: start;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-width: 0;
}

.frame-node.is-hidden {
  display: none;
}

.frame-node--desktop {
  min-width: 520px;
}

.frame-node--mobile {
  width: 420px;
}

.frame-header {
  background: var(--panel-strong);
  border-bottom: 1px solid var(--line);
  gap: 10px;
  height: 38px;
  padding: 0 11px;
}

.frame-header strong {
  font-size: 0.82rem;
}

.frame-header span:last-child {
  color: var(--muted);
  font-size: 0.72rem;
  margin-left: auto;
}

.frame-grip {
  background: repeating-linear-gradient(90deg, var(--soft), var(--soft) 2px, transparent 2px, transparent 5px);
  display: block;
  height: 14px;
  opacity: 0.7;
  width: 20px;
}

.frame-body {
  background: #050505;
  height: min(720px, calc(100vh - 140px));
  min-height: 420px;
  overflow: auto;
  padding: 0;
}

.frame-body--mobile {
  display: grid;
  justify-content: center;
}

iframe {
  background: #fff;
  border: 0;
  display: block;
  height: 100%;
  width: 100%;
}

.frame-body--mobile iframe {
  width: 390px;
}

.panel {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  margin-bottom: 16px;
  padding: 13px;
}

.panel--compact {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.route-path {
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.save-state {
  display: inline-block;
  margin: 0;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .inspector {
    border-left: 0;
    border-top: 1px solid var(--line);
    grid-column: 1 / -1;
    min-height: 0;
  }
}

@media (max-width: 780px) {
  .app-shell,
  .workspace,
  .canvas {
    display: block;
    overflow: visible;
  }

  .sidebar,
  .inspector {
    min-height: 0;
  }

  .canvas {
    padding: 16px;
  }

  .frame-node,
  .frame-node--desktop,
  .frame-node--mobile {
    margin-bottom: 16px;
    min-width: 0;
    width: 100%;
  }

  .frame-body {
    height: 620px;
  }

  .topbar,
  .brand-lockup {
    align-items: flex-start;
    flex-direction: column;
  }
}
