:root {
  color-scheme: dark;
  --paper: #0c0d0d;
  background: #0c0d0d;
}

html {
  background: #0c0d0d;
}

.admin-page.control-active {
  background: #f7f8f7;
}

.admin-page.control-active > .site-header,
.admin-page.control-active > main > .hero,
.admin-page.control-active > main > .preview-gate,
.admin-page.control-active > main > .auth-card,
.admin-page.control-active > main > .access-denied,
.admin-page.control-active > footer {
  display: none;
}

.admin-page.control-active > main {
  width: 100%;
  padding: 0;
}

.control-workspace {
  min-height: 100vh;
}

.control-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 15rem minmax(0, 1fr);
  color: #13201b;
  background: #f7f8f7;
}

.control-rail {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  gap: 0.65rem;
  overflow-y: auto;
  padding: 0.85rem 0.7rem 0.8rem;
  color: #3f4c45;
  background: #fbfcfb;
  border-right: 1px solid #d9dfdb;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 0.72rem;
  padding: 0.2rem 0.45rem 0.8rem;
  border-bottom: 1px solid #e0e5e2;
}

.rail-brand .brand-mark {
  width: 2.35rem;
  height: 2.35rem;
  color: #fff;
  background: #176449;
  box-shadow: none;
}

.rail-brand > span:last-child {
  display: grid;
  line-height: 1.15;
}

.rail-brand strong {
  color: #15231d;
  font-size: 0.9rem;
}

.rail-brand small {
  margin-top: 0.2rem;
  color: #758078;
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.control-nav {
  display: grid;
  gap: 0.18rem;
}

.control-nav-secondary {
  margin-top: auto;
  padding-top: 0.55rem;
  border-top: 1px solid #e0e5e2;
}

.rail-section-label {
  margin: 0.58rem 0.5rem 0.2rem;
  color: #89928d;
  font-size: 0.59rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.control-nav-item {
  display: grid;
  width: 100%;
  min-height: 2.32rem;
  grid-template-columns: 1.45rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  border: 0;
  border-radius: 0.38rem;
  padding: 0.36rem 0.48rem;
  color: #56625b;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 680;
  text-align: left;
  cursor: pointer;
}

.control-nav-item:hover {
  color: #14221c;
  background: #eef2ef;
}

.control-nav-item:focus-visible,
.attention-card:focus-visible,
.tool-card:focus-visible,
.icon-button:focus-visible,
.compact-button:focus-visible {
  outline: 3px solid rgba(121, 197, 167, 0.6);
  outline-offset: 2px;
}

.control-nav-item.is-active {
  color: #104c37;
  background: #e7f0eb;
  box-shadow: inset 2px 0 0 #176449;
}

.control-nav-item b {
  min-width: 1.45rem;
  border-radius: 999px;
  padding: 0.12rem 0.35rem;
  color: #446254;
  background: #dce8e1;
  font-size: 0.68rem;
  text-align: center;
}

.nav-icon {
  display: grid;
  width: 1.35rem;
  height: 1.35rem;
  place-items: center;
  border: 0;
  border-radius: 0.3rem;
  color: #78847d;
  font-size: 0.75rem;
  font-weight: 850;
}

.control-nav-item.is-active .nav-icon {
  color: #176449;
  background: #d6e7dd;
}

.rail-boundary {
  display: flex;
  align-items: flex-start;
  gap: 0.58rem;
  padding: 0.55rem 0.5rem 0.1rem;
  color: #55635c;
}

.rail-boundary > div {
  display: grid;
  gap: 0.1rem;
}

.rail-boundary strong {
  color: #2a3932;
  font-size: 0.74rem;
}

.rail-boundary small {
  color: #7b8780;
  font-size: 0.65rem;
  line-height: 1.35;
}

.status-dot {
  display: inline-block;
  width: 0.58rem;
  height: 0.58rem;
  flex: 0 0 auto;
  margin-top: 0.24rem;
  border-radius: 999px;
  background: #d09b43;
  box-shadow: 0 0 0 3px rgba(208, 155, 67, 0.15);
}

.status-dot.is-ready {
  background: #4ab88b;
  box-shadow: 0 0 0 3px rgba(74, 184, 139, 0.15);
}

.control-stage {
  min-width: 0;
}

.control-topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  min-height: 4.2rem;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.65rem clamp(1rem, 3vw, 2.25rem);
  border-bottom: 1px solid #d8ded9;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
}

.control-context {
  display: grid;
  line-height: 1.2;
}

.control-context > span {
  color: #748078;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.control-context > span i {
  padding: 0 0.25rem;
  font-style: normal;
}

.control-context strong {
  margin-top: 0.1rem;
  font-size: 1rem;
}

.control-context small {
  margin-top: 0.12rem;
  color: #68736c;
  font-size: 0.7rem;
}

.control-top-actions {
  display: flex;
  align-items: end;
  gap: 0.55rem;
}

.role-control {
  display: grid;
  gap: 0.2rem;
  margin: 0;
}

.role-control > span {
  color: #68736c;
  font-size: 0.65rem;
  font-weight: 800;
}

.role-control select {
  width: min(15.5rem, 31vw);
  min-height: 2.45rem;
  padding: 0.45rem 2rem 0.45rem 0.65rem;
  border-color: #bdc7c0;
  border-radius: 0.42rem;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 700;
}

.compact-button,
.icon-button {
  min-height: 2.45rem;
  border-radius: 0.42rem;
  font-size: 0.75rem;
}

.icon-button {
  display: grid;
  width: 2.45rem;
  place-items: center;
  border: 1px solid #bdc7c0;
  color: #324139;
  background: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}

.role-description {
  margin: 0;
  padding: 0.56rem clamp(1rem, 3vw, 2.25rem);
  border-bottom: 1px solid #e1e5e2;
  color: #647069;
  background: #f8faf8;
  font-size: 0.72rem;
}

.control-panels {
  width: min(88rem, 100%);
  margin: 0 auto;
  padding: clamp(1.2rem, 3.5vw, 3rem);
}

.control-panel[hidden] {
  display: none !important;
}

.control-panel:focus {
  outline: 3px solid rgba(23, 100, 73, 0.18);
  outline-offset: 0.45rem;
}

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.panel-heading h2 {
  margin-bottom: 0.45rem;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
}

.panel-heading p:last-child {
  max-width: 46rem;
  margin-bottom: 0;
  color: #657169;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(16rem, 0.8fr);
  gap: 0.8rem;
}

.overview-primary-card,
.overview-status-card,
.proof-card {
  border: 1px solid #d6ddd8;
  border-radius: 0.58rem;
  padding: clamp(1rem, 2.5vw, 1.35rem);
  background: #fff;
}

.overview-primary-card > p,
.proof-card li {
  color: #617068;
}

.overview-primary-card > p {
  max-width: 50rem;
}

.overview-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.overview-card-heading h3 {
  margin-bottom: 0;
}

.status-list {
  display: grid;
  gap: 0;
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
}

.status-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.72rem 0;
  border-top: 1px solid #e6eae7;
}

.status-list li > div {
  display: grid;
  gap: 0.12rem;
}

.status-list small {
  color: #748078;
}

.module-layout {
  display: grid;
  min-height: 28rem;
  grid-template-columns: 12.5rem minmax(0, 1fr);
  border: 1px solid #d7ddd9;
  border-radius: 0.58rem;
  overflow: hidden;
  background: #fff;
}

.module-menu {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.7rem;
  border-right: 1px solid #e0e5e2;
  background: #f7f9f7;
}

.module-menu button {
  width: 100%;
  min-height: 2.35rem;
  border: 0;
  border-radius: 0.35rem;
  padding: 0.48rem 0.58rem;
  color: #5e6963;
  background: transparent;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.module-menu button:hover {
  color: #173f30;
  background: #eaf0ec;
}

.module-menu button.is-active {
  color: #12543d;
  background: #dfece5;
}

.module-menu button:focus-visible {
  outline: 3px solid rgba(23, 100, 73, 0.25);
  outline-offset: 1px;
}

.module-content {
  min-width: 0;
  padding: clamp(1rem, 3vw, 1.65rem);
}

[data-module-panel][hidden] {
  display: none !important;
}

[data-module-panel]:focus {
  outline: 3px solid rgba(23, 100, 73, 0.16);
  outline-offset: 0.35rem;
}

.proof-card {
  max-width: 50rem;
}

.proof-card ol {
  margin: 0.85rem 0 0;
  padding-left: 1.25rem;
}

.proof-card li + li {
  margin-top: 0.5rem;
}

.evan-heading {
  align-items: center;
}

.overview-heading {
  align-items: center;
}

.connection-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  flex: 0 0 auto;
  border: 1px solid #dfc58e;
  border-radius: 999px;
  padding: 0.38rem 0.62rem;
  color: #715829;
  background: #fff8e9;
  font-size: 0.72rem;
  font-weight: 800;
}

.connection-badge i {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 999px;
  background: #d09b43;
}

.owner-attention-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.attention-card {
  display: grid;
  min-height: 7rem;
  align-content: space-between;
  gap: 0.28rem;
  border: 1px solid #d4dcd6;
  border-radius: 0.62rem;
  padding: 0.92rem;
  color: #15231d;
  background: #fff;
  text-align: left;
}

button.attention-card {
  cursor: pointer;
}

button.attention-card:hover {
  border-color: #78a994;
  box-shadow: 0 8px 22px rgba(25, 46, 37, 0.08);
}

.attention-card > span {
  color: #66736b;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.attention-card > strong {
  font-size: 1.75rem;
  line-height: 1;
}

.attention-card > small {
  color: #7a857f;
  font-size: 0.7rem;
}

.attention-card.is-quiet {
  background: #eef4f0;
}

.attention-card.is-quiet > strong {
  color: #2e6c51;
  font-size: 1rem;
}

.evan-conversation {
  border: 1px solid #ccd7d0;
  border-radius: 0.72rem;
  background: #fff;
  box-shadow: 0 16px 48px rgba(24, 45, 36, 0.08);
}

.evan-welcome {
  display: flex;
  gap: 0.85rem;
  padding: clamp(1rem, 3vw, 1.55rem);
  border-bottom: 1px solid #e0e5e1;
}

.evan-welcome p {
  max-width: 54rem;
  margin: 0.3rem 0 0;
  color: #617068;
}

.evan-mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.45rem;
  color: #fff;
  background: #176449;
  font-size: 0.78rem;
  font-weight: 900;
}

.evan-composer {
  padding: 0.8rem;
}

.evan-composer fieldset {
  display: grid;
  gap: 0.55rem;
  opacity: 1;
}

.evan-composer textarea {
  width: 100%;
  min-height: 7.25rem;
  resize: vertical;
  border: 1px solid #9eada4;
  border-radius: 0.6rem;
  padding: 0.85rem;
  color: #15231d;
  background: #fbfcfb;
  font: inherit;
}

.evan-composer textarea:focus {
  border-color: #176449;
  outline: 3px solid rgba(23, 100, 73, 0.14);
}

.evan-composer fieldset:disabled textarea {
  color: #6b7770;
  background: #f2f4f2;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.composer-actions > span {
  color: #758078;
  font-size: 0.72rem;
}

.work-proof {
  margin-top: 0.8rem;
  border: 1px solid #d8ded9;
  border-radius: 0.6rem;
  padding: 0.85rem 1rem;
  background: #f8faf8;
}

.work-proof summary {
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.work-proof ol {
  margin: 0.9rem 0 0;
  padding-left: 1.2rem;
  color: #5e6a63;
  font-size: 0.78rem;
}

.work-proof li + li {
  margin-top: 0.38rem;
}

.decision-summary-card {
  display: grid;
  max-width: 36rem;
  gap: 0.35rem;
  margin-bottom: 1rem;
  border: 1px solid #d4dcd6;
  border-radius: 0.65rem;
  padding: 1.2rem;
  background: #fff;
}

.decision-summary-card > span {
  color: #68756d;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.decision-summary-card > strong {
  font-size: 2rem;
}

.decision-summary-card p {
  margin: 0;
  color: #657169;
  font-size: 0.82rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.tool-card {
  display: grid;
  min-height: 11.5rem;
  align-content: start;
  gap: 0.55rem;
  border: 1px solid #d2dad4;
  border-radius: 0.64rem;
  padding: 1rem;
  color: #16241e;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.tool-card:hover {
  border-color: #78a994;
  box-shadow: 0 10px 28px rgba(25, 46, 37, 0.08);
}

.tool-card strong {
  margin-top: 0.25rem;
  font-size: 1.04rem;
}

.tool-card p {
  margin: 0;
  color: #657169;
  font-size: 0.79rem;
}

.tool-card small {
  align-self: end;
  margin-top: auto;
  color: #176449;
  font-weight: 800;
}

.tool-status {
  justify-self: start;
  border-radius: 999px;
  padding: 0.2rem 0.48rem;
  color: #6c5a34;
  background: #fff4da;
  font-size: 0.62rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tool-status.is-partial {
  color: #2d5e4a;
  background: #e2efe8;
}

.tool-status.is-locked {
  color: #6b5151;
  background: #f4eaea;
}

.tool-detail {
  margin-top: 1rem;
  border: 1px solid #cad5ce;
  border-radius: 0.7rem;
  padding: clamp(1rem, 3vw, 1.5rem);
  background: #fff;
}

.tool-detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.tool-detail-heading > span {
  color: #7a6946;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.tool-detail h3 {
  margin-top: 1rem;
}

.tool-detail > p,
.tool-detail-body p {
  color: #657169;
}

.record-principles,
.system-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.record-queue {
  margin: 1rem 0;
  border: 1px solid #d2dad4;
  border-radius: 0.64rem;
  padding: clamp(1rem, 3vw, 1.35rem);
  background: #fff;
}

.compact-heading {
  align-items: start;
  margin-bottom: 1rem;
}

.compact-heading h3 {
  margin-bottom: 0.35rem;
}

.record-principles article,
.system-grid article,
.role-library {
  border: 1px solid #d2dad4;
  border-radius: 0.64rem;
  padding: 1rem;
  background: #fff;
}

.record-principles p,
.system-grid p,
.role-library p {
  margin: 0.38rem 0 0;
  color: #657169;
  font-size: 0.8rem;
}

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

.system-grid article {
  display: flex;
  gap: 0.7rem;
}

.role-library {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.role-library h3 {
  margin-bottom: 0;
}

@media (max-width: 1080px) {
  .owner-attention-grid,
  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .control-topbar {
    align-items: flex-start;
  }

  .control-top-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

@media (max-width: 840px) {
  .control-shell {
    min-width: 0;
    grid-template-columns: 1fr;
    overflow-x: hidden;
  }

  .control-rail {
    position: static;
    width: 100%;
    min-width: 0;
    max-width: 100vw;
    height: auto;
    gap: 0.65rem;
    overflow: visible;
    padding: 0.8rem;
  }

  .rail-brand {
    padding-bottom: 0.65rem;
  }

  .control-nav,
  .control-nav-secondary {
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: calc(100vw - 1.6rem);
    overflow-x: auto;
    gap: 0.35rem;
    padding-bottom: 0.15rem;
  }

  .control-nav-secondary {
    margin-top: 0;
    padding-top: 0.65rem;
  }

  .rail-section-label {
    display: none;
  }

  .control-nav-item {
    width: auto;
    min-width: 8.5rem;
    flex: 0 0 auto;
    grid-template-columns: 1.6rem minmax(0, 1fr);
  }

  .control-nav-item b {
    display: none;
  }

  .rail-boundary {
    display: none;
  }

  .control-topbar {
    position: static;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .record-principles {
    grid-template-columns: 1fr;
  }

  .module-layout {
    width: 100%;
    min-width: 0;
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .module-menu {
    min-width: 0;
    max-width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid #e0e5e2;
  }

  .module-menu button {
    width: auto;
    min-width: max-content;
    flex: 0 0 auto;
  }
}

@media (max-width: 620px) {
  .control-topbar,
  .control-top-actions,
  .panel-heading,
  .composer-actions,
  .role-library {
    align-items: stretch;
    flex-direction: column;
  }

  .control-top-actions {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .role-control {
    grid-column: 1 / -1;
  }

  .role-control select {
    width: 100%;
  }

  .owner-attention-grid,
  .tool-grid,
  .overview-grid,
  .system-grid,
  .admin-page .metric-grid {
    grid-template-columns: 1fr;
  }

  .attention-card {
    min-height: 5.8rem;
  }

  .control-panels {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .control-topbar {
    backdrop-filter: none;
  }
}

/* Dark, dense project-console treatment. The structure follows the Supabase
   shell pattern while retaining Clear Frameworks names and authority. */
.admin-page {
  --ink: #ecefed;
  --muted: #9da5a1;
  --paper: #0c0d0d;
  --surface: #151616;
  --surface-soft: #191a1a;
  --line: #2b2d2c;
  --green: #3ecf8e;
  --green-dark: #6ee7b7;
  --gold: #e0aa52;
  --danger: #ff8d85;
  --focus-ring: #6ee7b7;
  --control-border: #626a66;
  --text-subtle: #838b87;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
  color: var(--ink);
  background: #0c0d0d;
}

.admin-page .site-header {
  border-color: #2a2c2b;
}

.admin-page .brand,
.admin-page .site-header nav a,
.admin-page .text-button {
  color: #e8ebe9;
}

.admin-page .brand small,
.admin-page footer {
  color: #929a96;
}

.admin-page .brand-mark {
  color: #07140f;
  background: #3ecf8e;
  box-shadow: none;
}

.admin-page .boundary-card,
.admin-page .preview-gate,
.admin-page .auth-card,
.admin-page .access-denied {
  border-color: #303332;
  background: #151616;
  box-shadow: var(--shadow);
}

.admin-page .preview-gate {
  border-color: #594722;
  border-left-color: #e0aa52;
  background: #1b1811;
}

.admin-page .preview-gate p:last-child {
  color: #c8b891;
}

.admin-page .access-denied {
  border-color: #603a38;
  background: #1c1414;
}

.admin-page input,
.admin-page select,
.admin-page textarea {
  border-color: var(--control-border);
  color: #ecefed;
  background: #101111;
}

.admin-page input:focus,
.admin-page select:focus,
.admin-page textarea:focus {
  border-color: #3ecf8e;
  outline-color: var(--focus-ring);
}

.admin-page .button.primary {
  color: #07140f;
  background: #3ecf8e;
}

.admin-page .button.primary:hover {
  color: #07140f;
  background: #6ee7b7;
}

.admin-page .button.secondary {
  border-color: var(--control-border);
  color: #e8ebe9;
  background: #171818;
}

.admin-page .button.secondary:hover {
  border-color: #545957;
  color: #fff;
  background: #202222;
}

.admin-page .notice {
  border-color: #315f4b;
  color: #bdebd6;
  background: #13231c;
}

.admin-page .notice.is-error {
  border-color: #67413d;
  color: #ffb7b0;
  background: #241716;
}

.admin-page footer {
  border-color: #2a2c2b;
}

.admin-page.control-active {
  background: #101111;
}

.control-shell {
  min-height: 100vh;
  grid-template-columns: 13rem minmax(0, 1fr);
  grid-template-rows: 3rem minmax(calc(100vh - 3rem), auto);
  grid-template-areas:
    "project project"
    "rail stage";
  color: #ecefed;
  background: #101111;
}

.project-bar {
  position: sticky;
  z-index: 12;
  top: 0;
  grid-area: project;
  display: flex;
  min-width: 0;
  min-height: 3rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid #2a2c2b;
  color: #e9ecea;
  background: #111212;
}

.project-identity,
.project-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.6rem;
}

.project-logo {
  display: grid;
  width: 1.7rem;
  height: 1.7rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.32rem;
  color: #07140f;
  background: #3ecf8e;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.project-owner,
.project-identity strong {
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-identity > i {
  color: #505552;
  font-style: normal;
}

.environment-badge {
  border: 1px solid #665022;
  border-radius: 999px;
  padding: 0.14rem 0.42rem;
  color: #e5b95f;
  background: #211b10;
  font-size: 0.56rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.project-search {
  display: grid;
  min-width: 15rem;
  min-height: 2rem;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--control-border);
  border-radius: 0.42rem;
  padding: 0.3rem 0.5rem;
  color: #a9b0ad;
  background: #181919;
  font: inherit;
  font-size: 0.7rem;
  text-align: left;
  cursor: pointer;
}

.project-search:hover {
  border-color: #535855;
  color: #f3f5f4;
  background: #1d1f1e;
}

.project-search:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.project-search kbd {
  border: 1px solid #3d403e;
  border-radius: 0.28rem;
  padding: 0.08rem 0.3rem;
  color: #828a86;
  background: #111212;
  font: inherit;
  font-size: 0.58rem;
  white-space: nowrap;
}

.assurance-label {
  color: #8f9793;
  font-size: 0.64rem;
  white-space: nowrap;
}

.control-rail {
  position: sticky;
  top: 3rem;
  grid-area: rail;
  align-self: start;
  height: calc(100vh - 3rem);
  gap: 0.5rem;
  padding: 0.65rem 0.45rem;
  color: #a4aba7;
  background: #121313;
  border-color: #292b2a;
}

.rail-brand {
  display: none;
}

.control-nav-secondary {
  border-color: #292b2a;
}

.rail-section-label {
  color: var(--text-subtle);
  font-size: 0.54rem;
}

.control-nav-item {
  min-height: 2.15rem;
  border-radius: 0.3rem;
  padding: 0.3rem 0.42rem;
  color: #a5aca8;
  background: transparent;
  font-size: 0.72rem;
}

.control-nav-item:hover {
  color: #f1f3f2;
  background: #1c1e1d;
}

.control-nav-item.is-active {
  color: #f0f3f1;
  background: #222423;
  box-shadow: inset 2px 0 0 #3ecf8e;
}

.control-nav-item b {
  color: #9ed9bc;
  background: #1b3429;
}

.nav-icon,
.control-nav-item.is-active .nav-icon {
  color: #8b938f;
  background: transparent;
}

.control-nav-item.is-active .nav-icon {
  color: #5ee0a4;
}

.control-nav-item:focus-visible,
.attention-card:focus-visible,
.tool-card:focus-visible,
.icon-button:focus-visible,
.compact-button:focus-visible,
.module-menu button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.rail-boundary,
.rail-boundary strong {
  color: #a2aaa6;
}

.rail-boundary small {
  color: var(--text-subtle);
}

.control-stage {
  grid-area: stage;
  min-width: 0;
  background: #101111;
}

.control-topbar {
  top: 3rem;
  min-height: 3.35rem;
  padding: 0.45rem clamp(0.9rem, 2vw, 1.4rem);
  border-color: #292b2a;
  background: rgba(17, 18, 18, 0.96);
}

.control-context > span {
  color: var(--text-subtle);
  font-size: 0.55rem;
}

.control-context strong {
  color: #f1f3f2;
  font-size: 0.9rem;
}

.control-context small,
.role-control > span,
.role-description {
  color: #8c9490;
}

.control-top-actions {
  align-items: center;
}

.topbar-evan {
  display: none;
}

.role-control select,
.icon-button {
  min-height: 2.15rem;
  border-color: var(--control-border);
  color: #e6e9e7;
  background: #181919;
}

.role-control select {
  width: min(13rem, 28vw);
  padding-block: 0.32rem;
}

.compact-button,
.icon-button {
  min-height: 2.15rem;
  border-radius: 0.38rem;
}

.role-description {
  padding: 0.42rem clamp(0.9rem, 2vw, 1.4rem);
  border-color: #292b2a;
  background: #131414;
  font-size: 0.66rem;
}

.control-panels {
  width: 100%;
  max-width: none;
  padding: clamp(1rem, 2vw, 1.5rem);
}

.control-panel:focus,
[data-module-panel]:focus {
  outline: 3px solid var(--focus-ring);
  outline-offset: 0.35rem;
}

.panel-heading {
  align-items: center;
  margin-bottom: 1rem;
}

.panel-heading .eyebrow {
  margin-bottom: 0.38rem;
  color: #58dba0;
  font-size: 0.62rem;
}

.panel-heading h2 {
  margin-bottom: 0.28rem;
  color: #f0f2f1;
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  letter-spacing: -0.02em;
}

.panel-heading p:last-child,
.overview-primary-card > p,
.proof-card li,
.evan-welcome p,
.work-proof ol,
.decision-summary-card p,
.tool-card p,
.tool-detail > p,
.tool-detail-body p,
.record-principles p,
.system-grid p,
.role-library p,
.queue-item p {
  color: #9ba39f;
}

.module-layout {
  min-height: calc(100vh - 11rem);
  grid-template-columns: 12rem minmax(0, 1fr);
  border-color: #292b2a;
  border-radius: 0.38rem;
  background: #131414;
}

.module-menu {
  border-color: #292b2a;
  background: #111212;
}

.module-menu button {
  min-height: 2.15rem;
  border-radius: 0.3rem;
  color: #999f9c;
  font-size: 0.7rem;
}

.module-menu button:hover {
  color: #f0f2f1;
  background: #1b1d1c;
}

.module-menu button.is-active {
  color: #eff2f0;
  background: #222423;
  box-shadow: inset 2px 0 0 #3ecf8e;
}

.module-content {
  padding: clamp(0.85rem, 2vw, 1.25rem);
  background: #131414;
}

.overview-primary-card,
.overview-status-card,
.proof-card,
.attention-card,
.evan-conversation,
.decision-summary-card,
.tool-card,
.tool-detail,
.record-queue,
.record-principles article,
.system-grid article,
.role-library,
.queue-item,
.admin-page .metric-grid article {
  border-color: var(--control-border);
  border-radius: 0.4rem;
  color: #e8ebe9;
  background: #171818;
  box-shadow: none;
}

.attention-card {
  min-height: 6.2rem;
}

.attention-card:hover,
.tool-card:hover {
  border-color: #46504b;
  box-shadow: none;
  background: #1b1d1c;
}

.attention-card > span,
.attention-card > small,
.decision-summary-card > span,
.tool-detail-heading > span,
.tool-card small,
.status-list small {
  color: #929a96;
}

.attention-card.is-quiet {
  background: #151a18;
}

.attention-card.is-quiet > strong,
.tool-card small {
  color: #63daa6;
}

.status-list li,
.evan-welcome {
  border-color: #2b2d2c;
}

.connection-badge,
.tool-status {
  border-color: #5d4a24;
  color: #e2bd72;
  background: #211b10;
}

.tool-status.is-partial {
  color: #99dfbd;
  background: #173025;
}

.tool-status.is-locked {
  color: #dfa9a5;
  background: #2a1b1a;
}

.evan-mark {
  color: #07140f;
  background: #3ecf8e;
}

.evan-composer textarea {
  border-color: var(--control-border);
  color: #e9ecea;
  background: #101111;
}

.evan-composer fieldset:disabled textarea {
  color: #777f7b;
  background: #121313;
}

.composer-actions > span {
  color: #838b87;
}

.work-proof,
.empty-state {
  border-color: #363a38;
  color: #dfe3e1;
  background: #121313;
}

.empty-state p {
  color: #929a96;
}

.status-pill {
  color: #a7e2c5;
  background: #193126;
}

.admin-page * {
  scrollbar-color: #484d4a #151616;
}

.admin-page :is(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.recovery-page {
  --ink: #ecefed;
  --muted: #9da5a1;
  --paper: #0c0d0d;
  --surface: #151616;
  --surface-soft: #191a1a;
  --line: #2b2d2c;
  --green: #3ecf8e;
  --green-dark: #6ee7b7;
  --gold: #e0aa52;
  --danger: #ff8d85;
  --focus-ring: #6ee7b7;
  --control-border: #626a66;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
  color: var(--ink);
  background: #0c0d0d;
}

.recovery-page .site-header,
.recovery-page footer {
  border-color: #2a2c2b;
}

.recovery-page .brand,
.recovery-page .site-header a {
  color: #e8ebe9;
}

.recovery-page .brand-mark {
  color: #07140f;
  background: #3ecf8e;
  box-shadow: none;
}

.recovery-page .brand small,
.recovery-page footer {
  color: #929a96;
}

.recovery-page .recovery-card {
  border-color: #303332;
  color: #ecefed;
  background: #151616;
  box-shadow: var(--shadow);
}

.recovery-page .preview-gate {
  border-color: #594722;
  border-left-color: #e0aa52;
  background: #1b1811;
}

.recovery-page .preview-gate p:last-child {
  color: #c8b891;
}

.recovery-page input,
.recovery-page select {
  border-color: var(--control-border);
  color: #ecefed;
  background: #101111;
}

.recovery-page .button.primary {
  color: #07140f;
  background: #3ecf8e;
}

.recovery-page .notice {
  border-color: #315f4b;
  color: #bdebd6;
  background: #13231c;
}

.recovery-page .notice.is-error {
  border-color: #67413d;
  color: #ffb7b0;
  background: #241716;
}

.recovery-page .success-panel {
  border-color: #315f4b;
  color: #ecefed;
  background: #13231c;
}

.recovery-page .security-callout {
  border-color: #303332;
  color: #ecefed;
  background: #171818;
}

.recovery-page :is(.success-panel, .security-callout) p {
  color: #9da5a1;
}

:is(.admin-page, .recovery-page) .skip-link {
  color: #07140f;
  background: var(--focus-ring);
}

.recovery-page :is(a, button, input, select, summary):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

@media (max-width: 840px) {
  .control-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
      "project"
      "rail"
      "stage";
  }

  .project-bar {
    position: sticky;
    min-height: 3.15rem;
  }

  .project-search {
    min-width: 11rem;
  }

  .assurance-label {
    display: none;
  }

  .control-rail {
    position: static;
    width: 100%;
    max-width: 100vw;
    height: auto;
    overflow: hidden;
    padding: 0.42rem 0.55rem;
    border-right: 0;
    border-bottom: 1px solid #292b2a;
  }

  .control-nav,
  .control-nav-secondary {
    display: flex;
    width: 100%;
    max-width: calc(100vw - 1.1rem);
    overflow-x: auto;
    gap: 0.25rem;
    padding: 0.35rem 0.4rem;
    scroll-padding-inline: 0.4rem;
  }

  .control-nav-secondary {
    margin-top: 0;
    padding-top: 0.35rem;
    border-top: 1px solid #292b2a;
  }

  .rail-section-label,
  .rail-boundary {
    display: none;
  }

  .control-nav-item {
    width: auto;
    min-width: 7.25rem;
    flex: 0 0 auto;
    grid-template-columns: 1.35rem minmax(0, 1fr);
  }

  .control-nav-item b {
    display: none;
  }

  .control-topbar {
    position: static;
    top: auto;
  }

  .module-layout {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .module-menu {
    max-width: 100%;
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid #292b2a;
  }

  .module-menu button {
    width: auto;
    min-width: max-content;
    flex: 0 0 auto;
  }

  .module-menu button.is-active {
    box-shadow: inset 0 -2px 0 #3ecf8e;
  }
}

@media (max-width: 620px) {
  .project-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 0.42rem;
    padding: 0.5rem 0.65rem;
  }

  .project-actions,
  .project-search {
    width: 100%;
  }

  .project-search {
    min-width: 0;
  }

  .project-search kbd {
    display: none;
  }

  .control-topbar,
  .control-top-actions,
  .panel-heading,
  .composer-actions,
  .role-library {
    align-items: stretch;
    flex-direction: column;
  }

  .control-top-actions {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .role-control {
    grid-column: 1 / -1;
  }

  .role-control select {
    width: 100%;
  }

  .control-panels {
    padding: 0.85rem;
  }
}
