:root {
  color-scheme: light;
  --paper: #eee7dc;
  --paper-deep: #e4d9c9;
  --panel: #f6f1e8;
  --panel-strong: #fffaf1;
  --ink: #2a2520;
  --ink-soft: #514940;
  --muted: #746b61;
  --line: #d4c7b4;
  --line-strong: #bdad98;
  --rust: #a94f31;
  --rust-deep: #79351f;
  --sage: #4e765d;
  --sage-soft: #e0eadf;
  --amber: #9c6b23;
  --amber-soft: #f3e2be;
  --blue: #3f6576;
  --blue-soft: #dde9eb;
  --shadow: 0 18px 50px rgba(42, 37, 32, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0) 42rem),
    var(--paper);
  color: var(--ink);
  font-family: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  letter-spacing: 0;
}

button,
a {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
}

a {
  text-decoration: none;
}

.field-backdrop {
  position: fixed;
  inset: auto 0 0;
  z-index: 0;
  width: 100%;
  height: 48svh;
  min-height: 22rem;
  pointer-events: none;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(14rem, 17rem) minmax(0, 1fr);
  min-height: 100svh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100svh;
  padding: 1.15rem;
  border-right: 1px solid rgba(189, 173, 152, 0.68);
  background: rgba(238, 231, 220, 0.74);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0.15rem 0.1rem 0.7rem;
}

.brand-name {
  display: block;
  min-width: 0;
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
  font-size: 2.2rem;
  line-height: 0.92;
}

.workspace {
  min-width: 0;
  padding: 0.65rem clamp(1rem, 2.5vw, 2rem) 2.3rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.1rem;
  padding-bottom: 0.35rem;
}

.eyebrow {
  margin: 0;
  color: var(--rust);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
}

.eyebrow:empty {
  display: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.topbar h1 {
  margin-top: 0.1rem;
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
  font-size: clamp(2.35rem, 4.5vw, 4.7rem);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 0.94;
}

.topbar h1:empty {
  display: none;
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.45rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.42rem;
  background: rgba(255, 250, 241, 0.66);
  box-shadow: 0 8px 24px rgba(42, 37, 32, 0.04);
  cursor: pointer;
}

.ghost-button {
  padding: 0.42rem 0.8rem;
  font-size: 0.72rem;
}

.ghost-button {
  background: rgba(255, 250, 241, 0.38);
  color: var(--ink-soft);
}

.ghost-button:hover,
.ghost-button:focus-visible {
  outline: 1px solid rgba(169, 79, 49, 0.44);
  outline-offset: 2px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.metric-card,
.project-card,
.environment-table {
  border: 1px solid rgba(189, 173, 152, 0.74);
  border-radius: 0.5rem;
  background: rgba(246, 241, 232, 0.76);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.metric-card {
  min-height: 6.2rem;
  padding: 0.95rem;
}

.metric-label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.66rem;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 0.95rem;
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
  font-size: 2.45rem;
  font-weight: 400;
  line-height: 0.92;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.15rem 0 0.7rem;
}

.section-heading h2 {
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 400;
  line-height: 1;
}

.section-heading span {
  color: var(--muted);
  font-size: 0.68rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.project-card {
  display: grid;
  min-height: 16.5rem;
  padding: 1rem;
  color: inherit;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.project-card:hover,
.project-card:focus-visible {
  border-color: rgba(169, 79, 49, 0.44);
  box-shadow: 0 20px 58px rgba(42, 37, 32, 0.12);
  outline: 0;
  transform: translateY(-1px);
}

.project-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
}

.project-code {
  color: var(--rust);
  font-size: 0.66rem;
  text-transform: uppercase;
}

.project-card h3 {
  margin-top: 0.25rem;
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
  font-size: 2.05rem;
  font-weight: 400;
  line-height: 0.98;
}

.project-card__summary {
  margin-top: 0.9rem;
  color: var(--ink-soft);
  font-size: 0.74rem;
  line-height: 1.55;
}

.project-card__meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: auto;
  padding-top: 1.1rem;
}

.meta-box {
  min-width: 0;
  padding-top: 0.58rem;
  border-top: 1px solid rgba(189, 173, 152, 0.7);
}

.meta-box span {
  display: block;
  color: var(--muted);
  font-size: 0.6rem;
  text-transform: uppercase;
}

.meta-box strong {
  display: block;
  margin-top: 0.22rem;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.35;
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  min-height: 1.55rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 500;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-pill::before {
  width: 0.4rem;
  height: 0.4rem;
  margin-right: 0.38rem;
  border-radius: 999px;
  content: "";
}

.status-pill[data-status="ready"] {
  border-color: rgba(78, 118, 93, 0.24);
  background: var(--sage-soft);
  color: #365541;
}

.status-pill[data-status="ready"]::before {
  background: var(--sage);
}

.status-pill[data-status="in-progress"] {
  border-color: rgba(156, 107, 35, 0.28);
  background: var(--amber-soft);
  color: #704a12;
}

.status-pill[data-status="in-progress"]::before {
  background: var(--amber);
}

.tag {
  border-color: rgba(63, 101, 118, 0.22);
  background: var(--blue-soft);
  color: var(--blue);
}

.tag[data-project-status="completed"] {
  border-color: rgba(78, 118, 93, 0.24);
  background: var(--sage-soft);
  color: #365541;
}

.tag[data-project-status="in-progress"] {
  border-color: rgba(156, 107, 35, 0.28);
  background: var(--amber-soft);
  color: #704a12;
}

.progress-line {
  display: grid;
  gap: 0.55rem;
  margin-top: 1rem;
}

.progress-row {
  display: grid;
  grid-template-columns: 5rem 1fr 2.8rem;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.64rem;
}

.bar {
  height: 0.38rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(212, 199, 180, 0.58);
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--rust);
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  margin-top: 0.15rem;
  padding: 1.1rem;
  border: 1px solid rgba(189, 173, 152, 0.76);
  border-radius: 0.5rem;
  background: rgba(246, 241, 232, 0.78);
  box-shadow: var(--shadow);
}

.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: max-content;
  color: var(--rust);
  font-size: 0.68rem;
}

.detail-hero h2 {
  margin-top: 0.5rem;
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
  font-size: clamp(2.25rem, 5vw, 5.4rem);
  font-weight: 400;
  line-height: 0.92;
}

.detail-hero p {
  max-width: 64rem;
  margin-top: 0.8rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.65;
}

.detail-hero__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(7rem, 1fr));
  gap: 0.58rem;
  min-width: 16rem;
}

.info-tile {
  padding: 0.75rem;
  border: 1px solid rgba(189, 173, 152, 0.74);
  border-radius: 0.42rem;
  background: rgba(255, 250, 241, 0.45);
}

.info-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
  text-transform: uppercase;
}

.info-tile strong {
  display: block;
  margin-top: 0.28rem;
  font-size: 0.8rem;
  font-weight: 500;
}

.detail-grid {
  margin-top: 0.95rem;
}

.environment-table {
  overflow: hidden;
}

.sort-controls {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.38rem;
}

.sort-button {
  min-height: 1.95rem;
  padding: 0.3rem 0.58rem;
  border: 1px solid rgba(189, 173, 152, 0.78);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.46);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 0.62rem;
  line-height: 1;
  text-transform: uppercase;
}

.sort-button:hover,
.sort-button:focus-visible,
.sort-button.is-active {
  border-color: rgba(169, 79, 49, 0.42);
  background: rgba(169, 79, 49, 0.1);
  color: var(--rust-deep);
  outline: 0;
}

.table-header,
.environment-row {
  display: grid;
  grid-template-columns: minmax(13rem, 1.6fr) minmax(7rem, 0.72fr) minmax(9rem, 0.8fr) 2.6rem;
  gap: 0.9rem;
  align-items: center;
  padding: 0.85rem 1rem;
}

.table-header {
  border-bottom: 1px solid rgba(189, 173, 152, 0.8);
  background: rgba(255, 250, 241, 0.34);
  color: var(--muted);
  font-size: 0.62rem;
  text-transform: uppercase;
}

.environment-row {
  min-height: 4.75rem;
  border-bottom: 1px solid rgba(212, 199, 180, 0.68);
}

.environment-row:last-child {
  border-bottom: 0;
}

.env-name {
  min-width: 0;
}

.env-name strong {
  display: block;
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.env-name span {
  display: block;
  margin-top: 0.22rem;
  color: var(--muted);
  font-size: 0.64rem;
  line-height: 1.45;
}

.table-cell {
  min-width: 0;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.table-cell strong {
  display: block;
  color: var(--ink);
  font-weight: 500;
}

.environment-link {
  display: inline-grid;
  width: 2.1rem;
  height: 2.1rem;
  place-items: center;
  border: 1px solid rgba(189, 173, 152, 0.78);
  border-radius: 0.42rem;
  background: rgba(255, 250, 241, 0.48);
  color: var(--rust-deep);
}

.environment-link:hover,
.environment-link:focus-visible {
  border-color: rgba(169, 79, 49, 0.5);
  background: rgba(169, 79, 49, 0.1);
  outline: 1px solid rgba(169, 79, 49, 0.34);
  outline-offset: 2px;
}

.environment-link svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.empty-state {
  padding: 2rem;
  border: 1px solid rgba(189, 173, 152, 0.74);
  border-radius: 0.5rem;
  background: rgba(246, 241, 232, 0.78);
  text-align: center;
}

.empty-state h2 {
  font-family: "Instrument Serif", Georgia, "Times New Roman", serif;
  font-size: 2.5rem;
  font-weight: 400;
}

.empty-state p {
  margin: 0.6rem auto 1rem;
  max-width: 34rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

@media (max-width: 70rem) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    align-content: start;
  }

  .sidebar {
    position: static;
    align-self: start;
    width: 100%;
    height: auto;
    padding: 0.9rem clamp(1rem, 2.5vw, 2rem);
    border-right: 0;
    border-bottom: 1px solid rgba(189, 173, 152, 0.68);
  }

  .brand {
    padding: 0;
  }

  .metrics-grid,
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-grid,
  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-hero__meta {
    min-width: 0;
  }
}

@media (max-width: 52rem) {
  .workspace {
    padding-inline: 0.75rem;
  }

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

  .metrics-grid,
  .project-grid,
  .detail-hero__meta {
    grid-template-columns: 1fr;
  }

  .project-card__meta {
    grid-template-columns: 1fr;
  }

  .environment-table {
    display: grid;
    gap: 0.72rem;
    padding: 0.72rem;
    overflow: visible;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .table-header {
    display: none;
  }

  .environment-row {
    grid-template-columns: 1fr;
    gap: 0.58rem;
    padding: 0.85rem;
    border: 1px solid rgba(189, 173, 152, 0.74);
    border-radius: 0.5rem;
    background: rgba(246, 241, 232, 0.78);
    box-shadow: var(--shadow);
  }
}

@media (max-width: 34rem) {
  .sidebar {
    padding: 0.9rem 0.75rem;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }
}
