:root {
  --bg: #f7f8f5;
  --surface: #ffffff;
  --surface-2: #eef3ef;
  --ink: #1f2a27;
  --muted: #63726d;
  --line: #d9e0dc;
  --accent: #167a5c;
  --accent-ink: #ffffff;
  --warning: #a85d17;
  --danger: #b42318;
  --shadow: 0 14px 36px rgba(31, 42, 39, 0.1);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

a {
  color: var(--accent);
}

img {
  display: block;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #fbfcfa;
  padding: 20px 16px;
}

.app-brand,
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-brand {
  min-height: 44px;
  margin-bottom: 22px;
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.brand-mark img {
  width: 21px;
  height: 21px;
}

.tab-nav {
  display: grid;
  gap: 6px;
}

.tab-link {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 10px;
  color: var(--ink);
  text-decoration: none;
  border-radius: 8px;
  border: 1px solid transparent;
}

.tab-link img,
.button img,
.icon-button img,
.user-chip img,
.document-index img,
.download-link img {
  width: 18px;
  height: 18px;
}

.tab-link span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-link:hover {
  background: var(--surface-2);
}

.tab-link.active {
  border-color: rgba(22, 122, 92, 0.22);
  background: #e2f1eb;
  color: #0c5f47;
  font-weight: 700;
}

.main-panel {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 92px;
  padding: 22px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 248, 245, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 4;
}

.topbar h1,
.summary-copy h2,
.login-panel h1 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

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

.owner-line {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

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

.logout-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  max-width: 240px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.92rem;
}

.user-chip {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
}

.button {
  padding: 0 14px;
}

.button.compact {
  min-height: 36px;
  padding: 0 10px;
  font-size: 0.9rem;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.button.primary img {
  filter: brightness(0) invert(1);
}

.button.full {
  width: 100%;
}

.icon-button {
  width: 40px;
  padding: 0;
}

.summary-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  gap: 24px;
  align-items: end;
  padding: 30px 32px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.summary-copy h2 {
  max-width: 760px;
  font-size: 1.5rem;
  font-weight: 720;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.metric-card {
  min-height: 78px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  font-size: 1rem;
  line-height: 1.25;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 26px 32px;
  border-bottom: 1px solid var(--line);
}

.overview-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 8px 12px;
  align-items: start;
  min-height: 150px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
}

.overview-card:hover {
  border-color: rgba(22, 122, 92, 0.36);
  background: #f0f7f3;
}

.overview-icon {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.overview-icon img {
  width: 19px;
  height: 19px;
}

.overview-status,
.overview-card strong,
.overview-card span:last-child {
  grid-column: 2;
}

.overview-status {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.overview-card strong {
  font-size: 1.06rem;
  line-height: 1.2;
}

.overview-card span:last-child {
  color: var(--muted);
  line-height: 1.45;
}

.spotlight-grid {
  display: grid;
  gap: 14px;
  padding: 0 32px 26px;
  border-bottom: 1px solid var(--line);
}

.spotlight-card {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
  border: 1px solid rgba(22, 122, 92, 0.26);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: #f3faf6;
  box-shadow: var(--shadow);
}

.spotlight-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
}

.spotlight-heading span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(22, 122, 92, 0.28);
  border-radius: 999px;
  background: #e2f1eb;
  color: #0c5f47;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.spotlight-card h2 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.25;
}

.spotlight-card p {
  max-width: 980px;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.spotlight-card ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
}

.spotlight-card li {
  line-height: 1.35;
}

.embedded-demo {
  margin: 26px 32px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.embedded-demo-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.embedded-demo-header h2 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.2;
}

.embedded-demo-header p:last-child {
  max-width: 820px;
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.embedded-demo iframe {
  display: block;
  width: 100%;
  height: min(760px, calc(100vh - 180px));
  min-height: 560px;
  border: 0;
  background: #f7f3eb;
}

.markdown-body .embedded-demo {
  margin: 24px 0;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 26px 32px 48px;
}

.workspace-grid.single {
  grid-template-columns: 220px minmax(0, 1fr);
}

.document-index {
  position: sticky;
  top: 118px;
  align-self: start;
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 136px);
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-gutter: stable;
}

.document-index h2 {
  margin: 16px 0 4px;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.document-index h2:first-child {
  margin-top: 0;
}

.document-index a,
.download-link {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.92rem;
  text-decoration: none;
}

.document-index a span,
.download-link span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.document-index a:hover,
.download-link:hover {
  border-color: rgba(22, 122, 92, 0.36);
  background: #f0f7f3;
}

.download-link.missing {
  color: var(--danger);
  pointer-events: none;
}

.monitor-shell {
  display: grid;
  gap: 22px;
  padding-bottom: 44px;
}

.monitor-summary {
  border-bottom: 0;
}

.monitor-section {
  margin: 0 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.monitor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.monitor-heading h2 {
  margin: 0;
  font-size: 1.05rem;
}

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

.table-frame {
  width: 100%;
  overflow-x: auto;
}

.monitor-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.monitor-table th,
.monitor-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
}

.monitor-table th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 800;
}

.status-pill.online {
  border-color: rgba(22, 122, 92, 0.25);
  background: #e2f1eb;
  color: #0c5f47;
}

.status-pill.idle {
  background: #eef3ef;
  color: var(--muted);
}

.status-pill.danger {
  border-color: rgba(180, 35, 24, 0.25);
  background: #fff0ed;
  color: var(--danger);
}

.document-stack {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.doc-article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.doc-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.doc-header h2 {
  margin: 4px 0 0;
  font-size: 1.2rem;
  line-height: 1.2;
}

.doc-path {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 160px;
}

.doc-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 700;
}

.markdown-body {
  padding: 4px 20px 24px;
  line-height: 1.62;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  letter-spacing: 0;
  line-height: 1.18;
}

.markdown-body h1 {
  margin-top: 18px;
  font-size: 1.65rem;
}

.markdown-body h2 {
  margin-top: 28px;
  font-size: 1.28rem;
}

.markdown-body h3 {
  margin-top: 22px;
  font-size: 1.08rem;
}

.markdown-body p,
.markdown-body li {
  color: #2d3935;
}

.markdown-body blockquote {
  margin: 18px 0;
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  background: #edf6f1;
  color: var(--ink);
}

.markdown-body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 18px 0;
}

.markdown-body th,
.markdown-body td {
  padding: 9px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: var(--surface-2);
}

.markdown-body code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #eef3ef;
  color: #24443a;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.94em;
}

.markdown-body pre {
  overflow-x: auto;
  padding: 14px;
  border-radius: 8px;
  background: #18231f;
  color: #f3f7f4;
}

.markdown-body pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.markdown-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 28px 0;
}

.empty-state {
  margin: 48px auto;
  max-width: 640px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.empty-state h1 {
  margin-top: 0;
}

.empty-state.compact {
  margin: 18px;
  max-width: none;
  padding: 16px;
  box-shadow: none;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef3ef;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(260px, 360px);
  gap: 0;
  width: min(860px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.login-shell.password-shell {
  grid-template-columns: minmax(320px, 460px);
  width: min(500px, 100%);
}

.login-panel {
  padding: 34px;
}

.login-panel h1 {
  font-size: 1.6rem;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.login-notice {
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
}

.login-form input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(22, 122, 92, 0.16);
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.92rem;
  font-weight: 700;
}

.form-success {
  margin: 0;
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 700;
}

.login-context {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 28px;
  border-left: 1px solid var(--line);
  background: #fbfcfa;
}

.context-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 52px;
}

.context-row span {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: #e2f1eb;
  color: #0c5f47;
  font-weight: 800;
}

.public-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef3ef;
}

.public-shell {
  width: min(620px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.public-shell .brand-mark {
  margin-bottom: 22px;
}

.public-shell h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.08;
}

.public-shell p {
  max-width: 520px;
  color: var(--muted);
  line-height: 1.55;
}

.public-note {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.public-owner {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.94rem;
}

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

  .app-brand span:last-child,
  .tab-link span {
    display: none;
  }

  .tab-link {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .summary-band {
    grid-template-columns: 1fr;
  }

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

  .workspace-grid,
  .workspace-grid.single {
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 18px;
  }

  .document-index {
    position: sticky;
    top: 112px;
  }

  .document-index h2 {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .app-brand {
    margin-bottom: 10px;
  }

  .app-brand span:last-child,
  .tab-link span {
    display: inline;
  }

  .tab-nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .tab-link {
    grid-template-columns: 20px max-content;
    flex: 0 0 auto;
  }

  .topbar {
    position: sticky;
    top: 0;
    align-items: flex-start;
    flex-direction: column;
    padding: 20px;
  }

  .logout-form,
  .user-chip {
    width: 100%;
  }

  .logout-form {
    flex-wrap: wrap;
  }

  .user-chip {
    max-width: none;
  }

  .summary-band,
  .overview-grid,
  .workspace-grid {
    padding: 20px;
  }

  .embedded-demo {
    margin: 20px;
  }

  .embedded-demo-header {
    flex-direction: column;
  }

  .embedded-demo iframe {
    height: 680px;
    min-height: 620px;
  }

  .workspace-grid,
  .workspace-grid.single {
    grid-template-columns: 1fr;
  }

  .document-index {
    position: sticky;
    top: 154px;
    z-index: 3;
    display: flex;
    gap: 8px;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }

  .document-index h2 {
    display: none;
  }

  .document-index a,
  .document-index .download-link {
    flex: 0 0 220px;
  }

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

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

  .doc-header {
    flex-direction: column;
  }

  .doc-meta {
    justify-content: flex-start;
  }

  .markdown-body {
    padding: 2px 16px 20px;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-context {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .monitor-section {
    margin: 0 20px;
  }

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