/* A fixed sidebar does not participate in layout; keep the workspace full-width. */
.app-shell {
  display: block;
}

button.primary {
  white-space: nowrap;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.field-head,
.field-row {
  grid-template-columns: repeat(3, minmax(0, 1fr)) 36px;
}

.field-head {
  display: grid;
  gap: 8px;
  padding: 0 10px 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.field-row input,
.field-row select,
.field-row .value-slot {
  min-width: 0;
}

.field-row input,
.field-row select {
  height: 40px;
}

.field-row .field-name:disabled {
  color: #78847e;
  background: #f2f3f0;
  font-style: italic;
}

.field-row .value-slot > input,
.field-row .value-slot > select {
  width: 100%;
}

.field-row .add-child {
  grid-column: 3 / 4 !important;
  width: 100%;
  min-height: 40px;
  border: 1px dashed #8db5a4;
  border-radius: 6px;
  background: #f1faf6;
  text-align: center !important;
  font-weight: 700;
}

.children {
  margin-top: 2px;
  padding-top: 9px;
}

.children::before {
  content: "Nested level";
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.json-label {
  display: block;
  margin: 20px 0 8px;
  font-size: 12px;
  font-weight: 800;
}

#import-json {
  width: 100%;
  min-height: 300px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: #fff;
  color: var(--ink);
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  outline: none;
}

#import-json:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(13, 107, 77, .1);
}

.import-status {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

/* Lab portal */
.portal-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 82% 22%, rgba(123, 199, 165, .20), transparent 25%),
    linear-gradient(150deg, #f8f6ef 0%, #eeece4 100%);
}

.portal-header,
.guide-topbar {
  min-height: 82px;
  padding: 15px clamp(22px, 5vw, 70px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(23, 33, 29, .10);
  background: rgba(255, 255, 255, .62);
  backdrop-filter: blur(12px);
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.portal-brand > span {
  display: flex;
  flex-direction: column;
}

.portal-brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.portal-user,
.guide-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.portal-user > span {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.portal-user small {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.portal-content {
  width: min(1100px, calc(100% - 44px));
  margin: auto;
  padding: 75px 0 60px;
}

.portal-content > .eyebrow {
  margin-top: 0;
}

.portal-content > h1 {
  margin: 0;
  font: 700 clamp(39px, 6vw, 66px)/1.05 Georgia, serif;
  letter-spacing: -.035em;
}

.portal-intro {
  max-width: 620px;
  margin: 18px 0 42px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.route-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.route-card {
  position: relative;
  min-height: 350px;
  padding: 34px;
  overflow: hidden;
  border: 1px solid rgba(23, 33, 29, .11);
  border-radius: 15px;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 10px 35px rgba(23, 33, 29, .07);
  transition: transform .2s, box-shadow .2s;
}

.route-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 22px 48px rgba(23, 33, 29, .14);
}

.database-card {
  background: #173028;
  color: #fff;
}

.database-card .eyebrow,
.database-card .route-number {
  color: #8fd5b7;
}

.guide-card {
  background: rgba(255, 255, 255, .88);
}

.route-number {
  position: absolute;
  right: 28px;
  top: 23px;
  color: #7b8983;
  font: 700 12px/1 ui-monospace, monospace;
}

.route-icon {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 18px;
  font: 700 22px/1 Georgia, serif;
  opacity: .82;
}

.route-card h2 {
  margin: 0 0 12px;
  font: 700 37px/1.1 Georgia, serif;
}

.route-card > p:not(.eyebrow) {
  max-width: 420px;
  min-height: 72px;
  margin: 0;
  color: inherit;
  opacity: .72;
  line-height: 1.55;
}

.route-action {
  position: absolute;
  left: 34px;
  bottom: 31px;
  display: flex;
  gap: 12px;
  align-items: center;
  font-weight: 800;
  font-size: 13px;
}

.route-action b {
  font-size: 19px;
}

.portal-footer {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
}

/* Online guide */
.guide-page {
  background: #f7f5ee;
}

.guide-topbar {
  position: sticky;
  z-index: 10;
  top: 0;
}

.guide-actions a {
  text-decoration: none;
}

.guide-layout {
  width: min(1180px, calc(100% - 44px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 240px minmax(0, 760px);
  gap: clamp(35px, 6vw, 80px);
  justify-content: center;
  align-items: start;
  padding: 56px 0 100px;
}

.guide-nav {
  position: sticky;
  top: 116px;
  width: 240px;
  max-height: calc(100vh - 142px);
  overflow: auto;
  padding: 0 19px 0 0;
  background: transparent;
  color: var(--ink);
  border-right: 1px solid var(--line);
}

.guide-nav .eyebrow {
  margin: 0 0 14px;
}

.guide-nav a {
  display: block;
  padding: 7px 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  line-height: 1.35;
}

.guide-nav a:hover {
  color: var(--green);
}

.guide-article {
  min-width: 0;
  padding: 48px clamp(25px, 6vw, 74px) 70px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 12px 42px rgba(23, 33, 29, .06);
}

.guide-kicker {
  margin: 0 0 10px !important;
  color: var(--green) !important;
  font-size: 10px !important;
  font-weight: 850;
  letter-spacing: .16em;
}

.guide-article h1 {
  margin: 0 0 24px;
  font: 700 clamp(39px, 6vw, 57px)/1.03 Georgia, serif;
  letter-spacing: -.035em;
}

.guide-article h2 {
  scroll-margin-top: 115px;
  margin: 55px 0 15px;
  padding-top: 23px;
  border-top: 1px solid var(--line);
  color: var(--green);
  font: 700 28px/1.15 Georgia, serif;
}

.guide-article h3 {
  scroll-margin-top: 115px;
  margin: 28px 0 8px;
  font: 700 18px/1.3 Georgia, serif;
}

.guide-article p,
.guide-article li {
  color: #435049;
  font-size: 15px;
  line-height: 1.75;
}

.guide-article li {
  margin: 7px 0;
}

.guide-article code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #edf3ef;
  color: #174d3a;
  font: .88em ui-monospace, SFMono-Regular, Menlo, monospace;
}

.guide-article pre {
  overflow: auto;
  margin: 23px 0;
  padding: 21px;
  border-radius: 9px;
  background: #17211d;
  color: #dcebe4;
}

.guide-article pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 12px;
  line-height: 1.65;
}

.guide-note {
  position: static;
  width: auto;
  margin: 25px 0;
  padding: 18px 20px;
  display: block;
  border-left: 4px solid var(--green);
  background: var(--mint);
  color: var(--ink);
}

.guide-note strong {
  color: var(--green);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.guide-note p {
  margin: 5px 0 0;
}

@media (max-width: 760px) {
  .header-actions {
    flex-direction: column-reverse;
  }
  .field-head {
    display: none;
  }

  .field-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px;
  }

  .field-row .value-slot,
  .field-row .add-child {
    grid-column: 1 / 3 !important;
  }

  .portal-header,
  .guide-topbar {
    padding: 12px 18px;
  }

  .portal-brand small,
  .portal-user > span,
  .guide-actions button {
    display: none;
  }

  .portal-content {
    padding: 48px 0;
  }

  .route-grid {
    grid-template-columns: 1fr;
  }

  .route-card {
    min-height: 320px;
    padding: 28px;
  }

  .guide-layout {
    width: min(100% - 24px, 760px);
    display: block;
    padding: 24px 0 60px;
  }

  .guide-nav {
    display: none;
  }

  .guide-article {
    padding: 34px 24px 50px;
  }
}
