: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;
}

.evan-live-connection {
  display: inline-flex;
  margin-top: 0.65rem;
  border: 1px solid #aebbb3;
  border-radius: 999px;
  padding: 0.28rem 0.58rem;
  color: #53645a;
  font-size: 0.7rem;
  font-weight: 800;
}

.evan-live-connection[data-state="ready"] {
  border-color: #57a681;
  color: #176449;
  background: #e9f7f0;
}

.evan-live-connection[data-state="denied"] {
  border-color: #c9847d;
  color: #8d332b;
  background: #fff0ee;
}

.evan-live-messages {
  display: grid;
  max-height: min(48vh, 34rem);
  gap: 0.7rem;
  overflow-y: auto;
  padding: 1rem;
  border-bottom: 1px solid #e0e5e1;
}

.evan-live-messages:empty {
  display: none;
}

.evan-live-message {
  max-width: min(48rem, 92%);
  border: 1px solid #d7dfda;
  border-radius: 0.65rem;
  padding: 0.75rem 0.85rem;
  background: #f8faf8;
}

.evan-live-message.is-user {
  justify-self: end;
  background: #edf6f1;
}

.evan-live-message strong {
  display: block;
  margin-bottom: 0.3rem;
  color: #176449;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.evan-live-message p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.evan-live-actions {
  display: flex;
  gap: 0.55rem;
}

.evan-live-run {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 0.75rem;
  margin: 0;
  padding: 0.8rem 1rem;
  border-top: 1px solid #e0e5e1;
}

.evan-live-run > div {
  min-width: 0;
}

.evan-live-run dt {
  color: #758078;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.evan-live-run dd {
  overflow: hidden;
  margin: 0.25rem 0 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.72rem;
}

.evan-live-run-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.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;
}

.owner-live-registry {
  display: grid;
  gap: 1rem;
}

.owner-live-registry[hidden] {
  display: none !important;
}

.owner-registry-heading,
.owner-registry-profile,
.owner-registry-section-heading,
.owner-registry-record,
.owner-registry-section > summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.owner-registry-heading h3,
.owner-registry-heading p,
.owner-registry-section-heading h4,
.owner-registry-section-heading p,
.owner-registry-record p {
  margin: 0;
}

.owner-registry-heading p,
.owner-registry-section-heading p,
.owner-registry-record p,
.owner-registry-profile small {
  color: #657169;
  font-size: 0.76rem;
}

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

.owner-registry-totals {
  display: flex;
  flex: 0 0 auto;
  gap: 0.5rem;
}

.owner-registry-totals span,
.owner-registry-roles span,
.owner-registry-state {
  border-radius: 999px;
  padding: 0.28rem 0.58rem;
  font-size: 0.68rem;
  font-weight: 850;
}

.owner-registry-totals span,
.owner-registry-roles span {
  color: #24483a;
  background: #e7f1ec;
}

.owner-registry-profile {
  border: 1px solid #cad5ce;
  border-radius: 0.65rem;
  padding: 1rem;
  background: #f8faf9;
}

.owner-registry-profile > div {
  display: grid;
  gap: 0.35rem;
}

.owner-registry-profile > div:first-child {
  min-width: min(22rem, 45%);
}

.owner-registry-profile span,
.owner-registry-section > summary small {
  color: #657169;
  font-size: 0.7rem;
  font-weight: 800;
}

.owner-registry-profile strong,
.owner-registry-profile small {
  overflow-wrap: anywhere;
}

.owner-registry-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.owner-registry-section {
  border: 1px solid #d2dad4;
  border-radius: 0.65rem;
  padding: 1rem;
  background: #fff;
}

.owner-registry-section > summary {
  cursor: pointer;
  list-style-position: inside;
}

.owner-registry-section > summary > span {
  color: #16241e;
  font-weight: 850;
}

.owner-registry-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.owner-registry-record {
  min-width: 0;
  border: 1px solid #e0e6e2;
  border-radius: 0.52rem;
  padding: 0.72rem;
}

.owner-registry-record > div {
  min-width: 0;
}

.owner-registry-record strong,
.owner-registry-record p {
  overflow-wrap: anywhere;
}

.owner-registry-record p {
  margin-top: 0.22rem;
}

.owner-registry-state {
  flex: 0 0 auto;
  text-transform: lowercase;
}

.owner-registry-state.is-active {
  color: #176449;
  background: #dff3e9;
}

.owner-registry-state.is-waiting {
  color: #6c5a34;
  background: #fff4da;
}

.tool-toolbar {
  display: grid;
  grid-template-columns: minmax(14rem, 1fr) minmax(11rem, 0.45fr) auto;
  align-items: end;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tool-search,
.tool-category,
.tool-field {
  display: grid;
  gap: 0.35rem;
  color: #657169;
  font-size: 0.72rem;
  font-weight: 750;
}

.tool-search input,
.tool-category select,
.tool-field input,
.tool-field select,
.tool-field textarea {
  width: 100%;
  box-sizing: border-box;
}

#tool-count {
  margin: 0;
  padding-bottom: 0.65rem;
  color: #657169;
  font-size: 0.76rem;
  white-space: nowrap;
}

.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;
  text-decoration: none;
  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-card-meta {
  color: #76827b;
  font-size: 0.68rem;
  font-weight: 700;
}

.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-live {
  color: #176449;
  background: #dff3e9;
}

.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;
}

.tool-section-heading {
  margin-bottom: 1rem;
}

.tool-section-heading h3,
.tool-section-heading p {
  margin: 0;
}

.tool-section-heading p {
  margin-top: 0.35rem;
  color: #657169;
  font-size: 0.8rem;
}

.tool-facts {
  display: grid;
  grid-template-columns: minmax(8rem, 0.35fr) minmax(0, 1fr);
  margin: 1rem 0 0;
  border: 1px solid #d2dad4;
  border-radius: 0.55rem;
  overflow: hidden;
}

.tool-facts dt,
.tool-facts dd {
  margin: 0;
  padding: 0.62rem 0.75rem;
  border-bottom: 1px solid #e3e8e5;
  font-size: 0.76rem;
}

.tool-facts dt {
  color: #526159;
  background: #f5f8f6;
  font-weight: 800;
}

.tool-facts dd {
  overflow-wrap: anywhere;
}

.tool-facts :nth-last-child(-n + 2) {
  border-bottom: 0;
}

.tool-workspace,
.tool-runtime-action {
  margin-top: 1.25rem;
  border-top: 1px solid #d2dad4;
  padding-top: 1.15rem;
}

.tool-workspace h4,
.tool-runtime-action h4 {
  margin: 0 0 0.4rem;
}

.tool-boundary-note {
  margin: 0 0 1rem;
  font-size: 0.78rem;
}

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

.tool-field.is-wide,
.tool-form-actions.is-wide {
  grid-column: 1 / -1;
}

.tool-field textarea {
  min-height: 7rem;
  resize: vertical;
}

.tool-form-actions,
.tool-effect-boundary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.tool-effect-boundary,
.tool-session-records {
  margin-top: 1rem;
  border: 1px solid #d2dad4;
  border-radius: 0.55rem;
  padding: 0.85rem;
  background: #f8faf9;
}

.tool-effect-boundary p {
  flex: 1 1 18rem;
  margin: 0;
  font-size: 0.76rem;
}

.tool-session-status {
  min-height: 1.2rem;
  margin: 0.65rem 0 0;
  color: #27694e;
  font-size: 0.76rem;
}

.tool-session-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding-left: 1.25rem;
}

.tool-session-list li {
  padding-left: 0.25rem;
}

.tool-session-list p,
.tool-session-empty {
  margin: 0.2rem 0 0;
  font-size: 0.74rem;
}

.tool-runtime-action .button {
  margin-top: 0.35rem;
}

.tool-runtime-action p {
  max-width: 54rem;
  margin-bottom: 0;
  font-size: 0.78rem;
}

.authority-intro,
.authority-card-heading,
.authority-section-heading,
.task-decision-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.authority-intro {
  align-items: flex-start;
  margin-bottom: 1.2rem;
  border: 1px solid #d2dad4;
  border-radius: 0.64rem;
  padding: 1rem;
  background: #fff;
}

.authority-intro h3,
.authority-intro p,
.authority-section-heading h3,
.authority-section-heading p,
.authority-card h4,
.authority-card p {
  margin: 0;
}

.authority-intro > div > p:last-child,
.authority-section-heading p,
.authority-card > p {
  margin-top: 0.35rem;
  color: #657169;
  font-size: 0.78rem;
}

#capability-control-status {
  max-width: 30rem;
  text-align: right;
}

#capability-control-status.is-connected {
  color: #176449;
  background: #dff3e9;
}

.authority-section {
  margin-top: 1.35rem;
}

.authority-section-heading {
  align-items: end;
  margin-bottom: 0.75rem;
}

.authority-section-heading p {
  max-width: 48rem;
  text-align: right;
}

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

.authority-card {
  min-width: 0;
  border: 1px solid #d2dad4;
  border-radius: 0.64rem;
  padding: 1rem;
  background: #fff;
}

.authority-card-compact {
  padding: 0.85rem;
}

.authority-card-heading {
  align-items: flex-start;
}

.authority-card-heading h4,
.authority-capability-id,
.authority-facts dd,
.authority-receipt span {
  overflow-wrap: anywhere;
}

.authority-capability-id {
  color: #526159 !important;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.69rem !important;
}

.authority-state {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.2rem 0.48rem;
  color: #6c5a34;
  background: #fff4da;
  font-size: 0.61rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.authority-state:is(.is-activated, .is-online, .is-approved, .is-allowed, .is-local-boundary) {
  color: #176449;
  background: #dff3e9;
}

.authority-state:is(.is-revoked, .is-denied, .is-rejected, .is-failed, .is-cancelled) {
  color: #7a3d38;
  background: #fae7e5;
}

.authority-state:is(.is-issued, .is-offline, .is-queued, .is-suspended) {
  color: #725c2c;
  background: #fff1d2;
}

.authority-facts {
  display: grid;
  grid-template-columns: minmax(7.5rem, 0.35fr) minmax(0, 1fr);
  margin: 0.8rem 0 0;
  border-top: 1px solid #e1e6e3;
}

.authority-facts dt,
.authority-facts dd {
  margin: 0;
  padding: 0.45rem 0;
  border-bottom: 1px solid #edf0ee;
  font-size: 0.72rem;
}

.authority-facts dt {
  color: #526159;
  font-weight: 800;
}

.authority-facts dd {
  color: #26352e;
}

.authority-action {
  margin-top: 0.8rem;
  border-top: 1px solid #e1e6e3;
  padding-top: 0.7rem;
}

.authority-action summary {
  color: #8a433d;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}

.authority-action-body,
.task-decision-control {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.65rem;
}

.authority-reason {
  display: grid;
  gap: 0.3rem;
  color: #526159;
  font-size: 0.7rem;
  font-weight: 800;
}

.authority-reason input {
  width: 100%;
  box-sizing: border-box;
}

.authority-workflow {
  margin-top: 0;
  border: 1px solid #d2dad4;
  border-radius: 0.64rem;
  padding: 0.85rem;
}

.authority-workflow-form {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.7rem;
}

.authority-workflow-form > p {
  margin: 0;
  color: #657169;
  font-size: 0.72rem;
}

.authority-reason select,
.authority-reason textarea {
  width: 100%;
  box-sizing: border-box;
}

.authority-workflow-result {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
}

.button.danger {
  border-color: #b75f56;
  color: #7a2922;
  background: #fff1ef;
}

.authority-action-status {
  min-height: 1.1rem;
  color: #657169;
  font-size: 0.7rem;
}

.authority-empty {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px dashed #cad3cd;
  border-radius: 0.55rem;
  padding: 0.85rem;
  color: #657169;
  background: #f8faf9;
  font-size: 0.76rem;
}

.authority-receipt-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.authority-receipt {
  display: grid;
  grid-template-columns: auto auto auto minmax(12rem, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid #d2dad4;
  border-radius: 0.5rem;
  padding: 0.65rem 0.75rem;
  background: #fff;
  font-size: 0.7rem;
}

.authority-receipt time {
  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: clip;
  }

  .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;
}

.install-app-button {
  white-space: nowrap;
}

.project-actions .install-app-button {
  border: 1px solid #365d4d;
  color: #bdebd6;
  background: #16271f;
}

.project-actions .install-app-button:hover {
  border-color: #4b8069;
  color: #effcf6;
  background: #1c3529;
}

.install-help {
  width: min(34rem, calc(100% - 2rem));
  border: 1px solid #365d4d;
  border-radius: 1rem;
  padding: 1.25rem;
  color: #f5f7f6;
  background: #111413;
  box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 55%);
}

.install-help::backdrop {
  background: rgb(0 0 0 / 72%);
}

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

.install-help h2 {
  margin: 0.2rem 0 1rem;
  font-size: clamp(1.35rem, 5vw, 2rem);
}

.install-help p {
  line-height: 1.6;
}

.install-help-note {
  margin-bottom: 0;
  color: #aeb9b4;
  font-size: 0.9rem;
}

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

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

.admin-page .mfa-enrollment img {
  display: block;
  width: min(260px, 100%);
  height: auto;
  margin: 1rem 0;
  padding: 0.75rem;
  border-radius: 0.75rem;
  background: #fff;
}

.admin-page .mfa-enrollment img[hidden] {
  display: none;
}

.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;
}

.admin-page .owner-registry-profile,
.admin-page .owner-registry-section,
.admin-page .owner-registry-record {
  border-color: var(--control-border);
  color: #e8ebe9;
  background: #171818;
}

.admin-page .owner-registry-heading p,
.admin-page .owner-registry-section-heading p,
.admin-page .owner-registry-record p,
.admin-page .owner-registry-profile small,
.admin-page .owner-registry-profile > div > span,
.admin-page .owner-registry-section > summary small {
  color: #929a96;
}

.admin-page .owner-registry-section > summary > span {
  color: #e8ebe9;
}

.admin-page .owner-registry-totals span,
.admin-page .owner-registry-roles span {
  color: #a7e2c5;
  background: #193126;
}

.admin-page .owner-registry-state.is-active {
  color: #9cf0c5;
  background: #123b29;
}

.admin-page .owner-registry-state.is-waiting {
  color: #e2bd72;
  background: #211b10;
}

.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-live {
  color: #9cf0c5;
  background: #123b29;
}

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

.tool-search,
.tool-category,
.tool-field,
#tool-count,
.tool-card-meta,
.tool-section-heading p {
  color: #929a96;
}

.tool-facts,
.tool-workspace,
.tool-runtime-action,
.tool-effect-boundary,
.tool-session-records {
  border-color: #343936;
}

.tool-facts dt,
.tool-facts dd {
  border-color: #2b2f2d;
}

.tool-facts dt {
  color: #aeb6b2;
  background: #121413;
}

.tool-facts dd,
.tool-effect-boundary,
.tool-session-records {
  color: #dce1de;
  background: #151716;
}

.tool-session-status {
  color: #7fe0b4;
}

.authority-intro,
.authority-card,
.authority-receipt {
  border-color: var(--control-border);
  color: #e8ebe9;
  background: #171818;
}

.authority-intro > div > p:last-child,
.authority-section-heading p,
.authority-card > p,
.authority-action-status,
.authority-empty,
.authority-receipt time {
  color: #929a96;
}

#capability-control-status.is-connected,
.authority-state:is(.is-activated, .is-online, .is-approved, .is-allowed, .is-local-boundary) {
  color: #99dfbd;
  background: #173025;
}

.authority-state:is(.is-revoked, .is-denied, .is-rejected, .is-failed, .is-cancelled) {
  color: #f0aaa4;
  background: #2a1b1a;
}

.authority-state:is(.is-issued, .is-offline, .is-queued, .is-suspended) {
  color: #e2bd72;
  background: #211b10;
}

.authority-facts,
.authority-action {
  border-color: #343936;
}

.authority-facts dt,
.authority-facts dd {
  border-color: #2b2f2d;
}

.authority-facts dt,
.authority-reason {
  color: #aeb6b2;
}

.authority-facts dd {
  color: #dce1de;
}

.authority-capability-id {
  color: #9ba39f !important;
}

.authority-action summary {
  color: #ffaaa3;
}

.authority-reason input {
  border-color: var(--control-border);
  color: #e9ecea;
  background: #101111;
}

.authority-workflow {
  border-color: var(--control-border);
  background: #151716;
}

.authority-workflow-form > p {
  color: #929a96;
}

.authority-reason select,
.authority-reason textarea {
  border-color: var(--control-border);
  color: #e9ecea;
  background: #101111;
}

.button.danger {
  border-color: #86514c;
  color: #ffb0aa;
  background: #241716;
}

.authority-empty {
  border-color: #343936;
  background: #151716;
}

.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;
}

.evan-live-connection {
  border-color: #49514d;
  color: #a0aaa5;
}

.evan-live-connection[data-state="ready"] {
  border-color: #2c805a;
  color: #70e0ac;
  background: #10261c;
}

.evan-live-connection[data-state="denied"] {
  border-color: #86514c;
  color: #ffb0aa;
  background: #241716;
}

.evan-live-messages,
.evan-live-run {
  border-color: var(--control-border);
}

.evan-live-message {
  border-color: #343936;
  color: #e8ebe9;
  background: #121313;
}

.evan-live-message.is-user {
  background: #14221b;
}

.evan-live-message strong {
  color: #70e0ac;
}

.evan-live-run dt {
  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;
}

.evan-workspace-intro,
.evan-workspace-section,
.evan-workspace-status,
.evan-workspace-record {
  border: 1px solid var(--control-border);
  border-radius: 0.65rem;
  background: #171818;
}

.evan-workspace-intro,
.evan-workspace-section {
  padding: 1rem;
}

.evan-workspace-intro h3,
.evan-workspace-intro p,
.evan-workspace-section h3,
.evan-workspace-status p,
.evan-workspace-detail,
.evan-workspace-empty {
  margin: 0;
}

.evan-workspace-intro > div > p:last-child,
.evan-workspace-status p,
.evan-workspace-detail,
.evan-workspace-empty {
  color: #929a96;
  font-size: 0.76rem;
}

.evan-workspace-control {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.evan-workspace-status-grid,
.evan-workspace-records {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.evan-workspace-status,
.evan-workspace-record {
  min-width: 0;
  padding: 0.8rem;
}

.evan-workspace-status-heading,
.evan-workspace-record-heading,
.evan-workspace-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.evan-workspace-status p {
  margin-top: 0.35rem;
}

.evan-workspace-state {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.25rem 0.52rem;
  color: #e2bd72;
  background: #211b10;
  font-size: 0.66rem;
  font-weight: 850;
  text-transform: lowercase;
}

.evan-workspace-state.is-active,
.evan-workspace-state.is-approved,
.evan-workspace-state.is-succeeded,
.evan-workspace-state.is-dispatched {
  color: #9cf0c5;
  background: #123b29;
}

.evan-workspace-field {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.75rem;
  color: #b2bbb6;
  font-size: 0.72rem;
  font-weight: 800;
}

.evan-workspace-field select,
.evan-workspace-field input,
.evan-workspace-field textarea {
  width: 100%;
  border: 1px solid var(--control-border);
  border-radius: 0.48rem;
  padding: 0.7rem;
  color: #ecefed;
  background: #101111;
}

.evan-workspace-field textarea {
  min-height: 6rem;
  resize: vertical;
}

.evan-workspace-field :disabled {
  cursor: not-allowed;
  color: #777f7b;
  opacity: 1;
}

.evan-workspace-task-form {
  display: grid;
  gap: 0.7rem;
}

.evan-workspace-task-form > .button {
  justify-self: start;
}

.evan-workspace-file-content {
  max-height: 24rem;
  overflow: auto;
  margin: 0.75rem 0 0;
  border: 1px solid #2b2f2d;
  border-radius: 0.45rem;
  padding: 0.7rem;
  color: #d9dddb;
  background: #101111;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.evan-workspace-selected,
.evan-workspace-records,
.evan-workspace-detail {
  margin-top: 0.7rem;
}

.evan-workspace-facts {
  display: grid;
  grid-template-columns: minmax(7rem, 0.35fr) minmax(0, 1fr);
  margin: 0.65rem 0 0;
  font-size: 0.72rem;
}

.evan-workspace-facts dt,
.evan-workspace-facts dd {
  min-width: 0;
  overflow-wrap: anywhere;
  margin: 0;
  padding: 0.35rem 0;
  border-top: 1px solid #2b2f2d;
}

.evan-workspace-facts dt {
  color: #89928d;
  font-weight: 750;
}

.evan-workspace-facts dd {
  color: #d9dddb;
}

.evan-workspace-empty {
  grid-column: 1 / -1;
  padding: 0.75rem;
  border: 1px dashed #3c423f;
  border-radius: 0.5rem;
}

@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;
  }
}

@media (max-width: 760px) {
  .tool-toolbar,
  .tool-form-grid,
  .tool-facts,
  .owner-registry-list,
  .evan-workspace-status-grid,
  .evan-workspace-records,
  .authority-grid,
  .authority-facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .evan-live-run {
    grid-template-columns: minmax(0, 1fr);
  }

  .authority-intro,
  .authority-section-heading,
  .owner-registry-heading,
  .owner-registry-profile,
  .owner-registry-section-heading,
  .evan-workspace-section-heading,
  .task-decision-actions {
    align-items: stretch;
    flex-direction: column;
  }

  #capability-control-status,
  .authority-section-heading p {
    max-width: none;
    text-align: left;
  }

  .authority-receipt {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .evan-workspace-facts {
    grid-template-columns: minmax(0, 1fr);
  }

  #tool-count {
    padding-bottom: 0;
  }

  .tool-field.is-wide,
  .tool-form-actions.is-wide {
    grid-column: auto;
  }

  .tool-facts dt,
  .tool-facts dd {
    border-bottom: 0;
  }

  .tool-facts dt:not(:first-child) {
    border-top: 1px solid #2b2f2d;
  }
}
