:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f0ea;
  color: #1d2329;
  --ink: #1d2329;
  --muted: #687078;
  --line: #d9dedf;
  --paper: #fffdf8;
  --panel: #ffffff;
  --forest: #1d5b4f;
  --teal: #2f7f78;
  --coral: #c95f48;
  --gold: #d39b31;
  --blue: #2d6f9f;
  --bad: #a33a32;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  background: var(--forest);
  border: 1px solid var(--forest);
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

a {
  color: var(--forest);
  font-weight: 700;
  text-decoration: none;
}

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

.shell-sidebar {
  background: #17201f;
  color: #f7f1e6;
  display: grid;
  grid-template-rows: auto 1fr auto;
  inset: 0 auto 0 0;
  padding: 22px 16px;
  position: fixed;
  width: 240px;
}

.brand {
  align-items: center;
  color: #fff;
  display: flex;
  gap: 12px;
}

.brand-mark {
  align-items: center;
  background: var(--coral);
  border-radius: 8px;
  display: inline-flex;
  font-size: 1.25rem;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.brand small,
.sidebar-note,
.eyebrow,
.muted {
  color: var(--muted);
}

.brand small {
  color: #b8c4bf;
  display: block;
  font-size: 0.78rem;
  margin-top: 2px;
}

.nav-list {
  display: grid;
  gap: 6px;
  margin-top: 30px;
}

.nav-list a {
  border-radius: 6px;
  color: #dce6e1;
  padding: 11px 12px;
}

.nav-list a.active,
.nav-list a:hover {
  background: #24322f;
  color: #ffffff;
}

.sidebar-note {
  align-items: center;
  background: #202c29;
  border-radius: 8px;
  color: #c8d5cf;
  display: flex;
  gap: 8px;
  padding: 12px;
}

.sidebar-note .dot {
  background: #76c989;
  border-radius: 50%;
  height: 8px;
  width: 8px;
}

.sidebar-note.bad .dot {
  background: var(--bad);
}

.app-shell {
  margin-left: 240px;
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding: 22px 40px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.eyebrow {
  color: var(--coral);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar h1 {
  font-size: 2.1rem;
  line-height: 1.1;
  margin-top: 4px;
}

.topbar-actions,
.button-row,
.link-row,
.form-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.api-key-field {
  color: var(--muted);
  display: grid;
  font-size: 0.78rem;
  gap: 4px;
}

input,
textarea {
  background: #fff;
  border: 1px solid #cbd3d4;
  border-radius: 6px;
  color: var(--ink);
  min-height: 40px;
  min-width: 0;
  padding: 8px 10px;
  width: 100%;
}

.api-key-field input {
  width: min(240px, 52vw);
}

main {
  padding: 28px 40px 56px;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 22px;
}

.view-heading,
.section-heading,
.asset-header,
.card-topline {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.view-heading h2 {
  font-size: 1.8rem;
}

.view-heading p,
.section-heading span,
.content-card p,
.asset-header p,
.stack-item p,
.empty-state p {
  color: var(--muted);
}

.metric-grid,
.dashboard-grid,
.workspace-grid,
.ops-grid,
.card-grid,
.asset-detail-grid {
  display: grid;
  gap: 16px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card,
.panel,
.content-card,
.asset-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 128px;
  padding: 18px;
}

.metric-card span {
  color: var(--muted);
  font-weight: 800;
}

.metric-card strong {
  color: var(--forest);
  font-size: 2.35rem;
  line-height: 1;
}

.metric-card small {
  color: var(--muted);
}

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

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

.panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.span-panel {
  grid-column: 1 / -1;
}

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

label {
  color: #3d464b;
  display: grid;
  font-weight: 750;
  gap: 6px;
}

.wide-field,
.checkbox-label,
.form-actions {
  grid-column: 1 / -1;
}

.checkbox-label {
  align-items: center;
  display: flex;
}

.checkbox-label input {
  width: auto;
}

.form-actions {
  justify-content: flex-end;
}

.secondary-button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.stack-list,
.asset-list {
  display: grid;
  gap: 10px;
}

.stack-item {
  align-items: center;
  background: #fbfcfb;
  border: 1px solid #e4e8e8;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 13px;
}

.stack-item strong,
.content-card h3,
.asset-card h3 {
  overflow-wrap: anywhere;
}

.badge {
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 900;
  padding: 5px 9px;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge.good {
  background: #def1e3;
  color: #1d5b2c;
}

.badge.busy {
  background: #fff0c6;
  color: #755314;
}

.badge.bad {
  background: #ffe0d8;
  color: var(--bad);
}

.badge.neutral {
  background: #e9eef0;
  color: #4d5960;
}

.card-grid {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.content-card {
  display: grid;
  gap: 14px;
  grid-template-columns: 96px minmax(0, 1fr);
  padding: 14px;
}

.art-tile {
  align-items: center;
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--forest), var(--coral));
  background-position: center;
  background-size: cover;
  border-radius: 8px;
  color: #fff;
  display: flex;
  font-size: 2rem;
  font-weight: 900;
  justify-content: center;
}

.content-card-body {
  display: grid;
  gap: 8px;
}

.clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.asset-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.readiness-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.asset-detail-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.definition-item {
  display: grid;
  gap: 3px;
}

.definition-item span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.definition-item strong {
  overflow-wrap: anywhere;
}

.empty-state {
  background: #f8f5ee;
  border: 1px dashed #d5cdbf;
  border-radius: 8px;
  display: grid;
  gap: 5px;
  padding: 16px;
}

.alert-region {
  inset: 84px 24px auto auto;
  position: fixed;
  width: min(380px, calc(100vw - 48px));
  z-index: 4;
}

.app-alert {
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(24, 31, 33, 0.14);
  padding: 14px 16px;
}

.app-alert.good {
  border-left-color: var(--forest);
}

.app-alert.bad {
  border-left-color: var(--bad);
}

@media (max-width: 980px) {
  .shell-sidebar {
    inset: 0 0 auto 0;
    min-height: 72px;
    padding: 12px 16px;
    position: sticky;
    width: auto;
    z-index: 3;
  }

  .brand small,
  .sidebar-note {
    display: none;
  }

  .nav-list {
    display: flex;
    margin-top: 10px;
    overflow-x: auto;
  }

  .app-shell {
    margin-left: 0;
  }

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

  .topbar,
  main {
    padding-left: 24px;
    padding-right: 24px;
  }

  .metric-grid,
  .dashboard-grid,
  .workspace-grid,
  .ops-grid,
  .asset-detail-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .metric-grid,
  .dashboard-grid,
  .workspace-grid,
  .ops-grid,
  .form-grid,
  .asset-detail-grid,
  .content-card {
    grid-template-columns: 1fr;
  }

  .topbar,
  main {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar h1 {
    font-size: 1.7rem;
  }

  .view-heading h2 {
    font-size: 1.45rem;
  }

  .topbar-actions {
    align-items: stretch;
    width: 100%;
  }

  .api-key-field,
  .api-key-field input,
  .topbar-actions button {
    width: 100%;
  }

  .section-heading,
  .asset-header,
  .card-topline {
    align-items: flex-start;
    flex-direction: column;
  }
}
