:root {
  color: #1b2528;
  background: #f5f7f4;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f5f7f4;
}

button,
input,
select {
  font: inherit;
}

.console-shell,
.console-wasm-shell,
.shell {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.console-wasm-shell {
  display: grid;
  gap: 18px;
}

.console-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid #d8dfdb;
}

.console-wasm-shell > header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid #d8dfdb;
}

.console-wasm-shell > header p {
  margin: 0 0 8px;
  color: #2d6f6f;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.masthead {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #2d6f6f;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 2.65rem;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 0.92rem;
}

.summary {
  max-width: 680px;
  color: #53616a;
  font-size: 1rem;
  line-height: 1.6;
}

.header-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.console-userbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.console-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 0;
}

.console-nav a {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid #cbd8d3;
  border-radius: 7px;
  background: #ffffff;
  color: #314347;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
}

.console-nav a[aria-current="page"] {
  border-color: #2d6f6f;
  background: #edf7f5;
  color: #174f4f;
}

.metric,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid #cbd8d3;
  border-radius: 999px;
  background: #ffffff;
  color: #314347;
  font-size: 0.82rem;
  font-weight: 650;
  white-space: nowrap;
}

.metric[data-tone="valid"],
.pill[data-status="active"],
.pill[data-status="valid"],
.pill[data-status="resolved"] {
  border-color: #8bc5aa;
  color: #14563a;
  background: #eff9f4;
}

.metric[data-tone="degraded"],
.pill[data-status="degraded"] {
  border-color: #d9ba6f;
  color: #6a4a00;
  background: #fff8df;
}

.metric[data-tone="invalid"],
.metric[data-tone="unavailable"],
.pill[data-status="invalid"],
.pill[data-status="error"] {
  border-color: #e1a29d;
  color: #8a1f15;
  background: #fff1ef;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) minmax(220px, 2fr) auto;
  gap: 12px;
  align-items: end;
  margin: 20px 0;
}

.toolbar label {
  display: grid;
  gap: 6px;
  color: #526064;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.toolbar select,
.toolbar input,
.login-form input,
.password-change-form input,
.account-password-form input,
.refresh-button,
.secondary-button {
  min-height: 40px;
  border: 1px solid #cbd8d3;
  border-radius: 7px;
  background: #ffffff;
  color: #1b2528;
}

.toolbar select,
.toolbar input,
.login-form input,
.password-change-form input,
.account-password-form input {
  width: 100%;
  padding: 0 11px;
}

.refresh-button,
.secondary-button {
  padding: 0 16px;
  border-color: #2d6f6f;
  background: #2d6f6f;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button {
  border-color: #cbd8d3;
  background: #ffffff;
  color: #314347;
}

.refresh-button:disabled,
.secondary-button:disabled {
  border-color: #bdc9c5;
  background: #dce4e1;
  color: #6d7a7d;
  cursor: wait;
}

.login-panel,
.password-change-panel,
.account-panel,
.accounts-panel,
.credentials-panel,
.email-panel {
  margin-top: 22px;
}

.login-panel,
.password-change-panel {
  padding: 18px;
  border: 1px solid #d8dfdb;
  border-radius: 8px;
  background: #ffffff;
}

.console-wasm-shell > section[aria-label="Console login"],
.console-wasm-shell > section[aria-label="Password change required"],
.console-wasm-shell > section[aria-label="Console unavailable"] {
  max-width: 760px;
  padding: 18px;
  border: 1px solid #d8dfdb;
  border-radius: 8px;
  background: #ffffff;
}

.login-form,
.password-change-form,
.account-password-form {
  display: grid;
  gap: 12px;
  align-items: end;
}

.setup-status {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #8bc5aa;
  border-radius: 8px;
  background: #eff9f4;
  color: #14563a;
}

.setup-status h2 {
  margin-bottom: 6px;
}

.setup-status p {
  margin-bottom: 0;
  color: #2d6047;
  line-height: 1.45;
}

.login-form {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
}

.console-wasm-shell > section[aria-label="Console login"] form,
.console-wasm-shell > section[aria-label="Password change required"] form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 12px;
}

.console-wasm-status {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid #d9ba6f;
  border-radius: 7px;
  background: #fff8df;
  color: #6a4a00;
  font-size: 0.9rem;
  line-height: 1.45;
}

.password-change-form {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
}

.account-panel {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 1.2fr);
  gap: 16px;
  align-items: start;
}

.account-settings-panel {
  min-width: 0;
}

.credentials-layout,
.accounts-layout,
.email-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
  align-items: start;
  margin-top: 20px;
}

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

.accounts-layout {
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
}

.accounts-list-panel > div,
.accounts-detail-panel > div,
.credentials-declarations-panel > div,
.credentials-status-panel > div,
.email-state-panel > div,
.email-messages-panel > div,
.email-attempts-panel > div {
  padding: 12px;
}

.email-messages-panel,
.email-attempts-panel {
  grid-column: 1 / -1;
}

.credential-declaration-table {
  table-layout: fixed;
  min-width: 820px;
}

.credential-declaration-table th:nth-child(1) {
  width: 44%;
}

.credential-declaration-table th:nth-child(2),
.credential-declaration-table th:nth-child(3),
.credential-declaration-table th:nth-child(4) {
  width: 18.666%;
}

.credential-declaration-main td {
  border-bottom: 0;
  padding-bottom: 6px;
}

.credential-declaration-detail-head th {
  padding-top: 0;
  padding-bottom: 8px;
  color: #7a878a;
  font-size: 0.68rem;
  border-bottom: 1px solid #eef3f0;
}

.credential-detail-cell {
  padding-top: 0;
  padding-bottom: 14px;
  border-top: 1px solid #eef3f0;
}

.credential-cell-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.credential-cell-value {
  min-width: 0;
}

.segmented-token {
  overflow-wrap: normal;
  word-break: normal;
}

.account-summary,
.account-admin-list,
.accounts-detail-panel > div,
.account-password-form {
  padding: 14px;
}

.account-admin-row {
  align-items: center;
}

.account-admin-row .component-meta {
  margin-bottom: 0;
}

.account-password-form {
  grid-template-columns: minmax(170px, 1fr) minmax(170px, 1fr) minmax(170px, 1fr) auto;
}

.login-form label,
.password-change-form label,
.account-password-form label,
.console-wasm-shell > section[aria-label="Console login"] label,
.console-wasm-shell > section[aria-label="Password change required"] label {
  display: grid;
  gap: 6px;
  color: #526064;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.console-wasm-shell input,
.console-wasm-shell button {
  min-height: 40px;
  border: 1px solid #cbd8d3;
  border-radius: 7px;
  background: #ffffff;
  color: #1b2528;
  font: inherit;
}

.console-wasm-shell input {
  width: 100%;
  min-width: 0;
  padding: 0 11px;
}

.console-wasm-shell button {
  padding: 0 16px;
  border-color: #2d6f6f;
  background: #2d6f6f;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

.console-wasm-shell button:disabled {
  border-color: #bdc9c5;
  background: #dce4e1;
  color: #6d7a7d;
  cursor: not-allowed;
}

.console-wasm-shell nav[aria-label="Console navigation"] {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.console-wasm-shell nav[aria-label="Console navigation"] section {
  min-width: 180px;
  padding: 12px;
  border: 1px solid #d8dfdb;
  border-radius: 8px;
  background: #ffffff;
}

.console-wasm-shell nav[aria-label="Console navigation"] ul {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.console-wasm-shell nav[aria-label="Console navigation"] a {
  color: #174f4f;
  font-weight: 700;
  text-decoration: none;
}

.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #d9ba6f;
  border-radius: 8px;
  background: #fff8df;
  color: #6a4a00;
  line-height: 1.45;
}

.credential-value-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid #d7e2dd;
  border-radius: 8px;
  color: #1f292c;
  background: #ffffff;
  box-shadow: 0 20px 70px rgba(15, 32, 37, 0.22);
}

.credential-value-dialog::backdrop {
  background: rgba(13, 30, 35, 0.42);
}

.credential-value-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.credential-value-form h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.credential-dialog-copy {
  margin: 0;
  color: #526064;
  font-size: 0.9rem;
  line-height: 1.4;
}

.credential-value-form label {
  display: grid;
  gap: 6px;
  color: #526064;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.credential-value-form input {
  min-width: 0;
  height: 38px;
  padding: 8px 10px;
  border: 1px solid #cfdbd6;
  border-radius: 6px;
  font: inherit;
}

.credential-secret-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.credential-secret-toggle {
  height: 38px;
  padding: 0 10px;
  border: 1px solid #cfdbd6;
  border-radius: 6px;
  color: #1f292c;
  background: #f8fbf9;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.credential-dialog-status {
  min-height: 20px;
  margin: 0;
  color: #795100;
  font-size: 0.88rem;
}

.credential-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.composition-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
}

.console-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.panel,
article {
  border: 1px solid #d8dfdb;
  border-radius: 8px;
  background: #ffffff;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 13px 14px;
  border-bottom: 1px solid #e3e8e5;
}

.panel-heading span {
  color: #637174;
  font-size: 0.82rem;
  white-space: nowrap;
}

.topology-panel,
.bindings-panel,
.permissions-panel,
.issues-panel {
  grid-column: 1 / 2;
}

.components-panel,
.inspector-panel {
  grid-column: 2 / 3;
}

.topology-canvas {
  min-height: 310px;
  padding: 14px;
  overflow: auto;
}

.topology-svg {
  display: block;
  width: 100%;
  min-width: 640px;
  height: 280px;
}

.node-rect {
  fill: #f8fbfa;
  stroke: #9db4ad;
  stroke-width: 1;
}

.node-rect[data-status="active"] {
  stroke: #4f9e78;
}

.node-rect[data-status="degraded"] {
  stroke: #c79c35;
}

.node-rect[data-status="invalid"] {
  stroke: #c65d51;
}

.edge-line {
  stroke: #68868b;
  stroke-width: 2;
}

.edge-line[data-status="invalid"] {
  stroke: #c65d51;
  stroke-dasharray: 5 4;
}

.node-label {
  fill: #1b2528;
  font-size: 12px;
  font-weight: 700;
}

.node-meta,
.edge-label {
  fill: #59676b;
  font-size: 11px;
}

.component-list,
.inspector-panel > div,
.bindings-panel > div,
.permissions-panel > div,
.issues-panel > div {
  padding: 12px;
}

.component-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  margin: 0 0 8px;
  padding: 10px;
  border: 1px solid #e1e7e4;
  border-radius: 7px;
  background: #fbfdfc;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.component-row[aria-selected="true"] {
  border-color: #2d6f6f;
  background: #edf7f5;
}

.component-name,
.binding-name,
.permission-name {
  overflow-wrap: anywhere;
  font-weight: 750;
}

.component-meta,
.binding-meta,
.permission-meta,
.input-meta {
  margin-top: 4px;
  color: #5f6d70;
  font-size: 0.86rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.inspector-section {
  margin-bottom: 18px;
}

.inspector-section:last-child {
  margin-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid #e6ebe8;
  text-align: left;
  vertical-align: top;
}

th {
  color: #526064;
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

td {
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.empty {
  margin: 0;
  color: #627073;
  line-height: 1.5;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 32px;
}

article {
  min-height: 132px;
  padding: 18px;
}

article h2 {
  margin-bottom: 10px;
}

article p {
  color: #53616a;
  line-height: 1.55;
}

@media (max-width: 980px) {
  .console-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-metrics {
    justify-content: flex-start;
  }

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

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

  .login-form,
  .password-change-form,
  .console-wasm-shell > section[aria-label="Console login"] form,
  .console-wasm-shell > section[aria-label="Password change required"] form,
  .account-panel,
  .accounts-layout,
  .account-password-form,
  .credentials-layout,
  .email-layout {
    grid-template-columns: 1fr;
  }

  .console-layout {
    grid-template-columns: 1fr;
  }

  .topology-panel,
  .bindings-panel,
  .permissions-panel,
  .issues-panel,
  .components-panel,
  .inspector-panel {
    grid-column: 1 / 2;
  }

}

@media (max-width: 640px) {
  .credential-declaration-table {
    min-width: 0;
  }

  .credential-declaration-table thead {
    display: none;
  }

  .credential-declaration-table,
  .credential-declaration-table tbody,
  .credential-declaration-table tr,
  .credential-declaration-table td {
    display: block;
    width: 100%;
  }

  .credential-declaration-main {
    padding-top: 10px;
    border-top: 1px solid #e6ebe8;
  }

  .credential-declaration-main:first-child {
    border-top: 0;
  }

  .credential-declaration-main td,
  .credential-declaration-details td,
  .credential-detail-cell {
    padding: 6px 0;
    border: 0;
  }

  .credential-declaration-details {
    padding-bottom: 14px;
    border-bottom: 1px solid #e6ebe8;
  }

  .credential-main-cell,
  .credential-detail-cell {
    display: grid;
    grid-template-columns: minmax(82px, 28%) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
  }

  .credential-cell-label {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    border: 0;
    color: #7a878a;
    font-size: 0.68rem;
    font-weight: 750;
    line-height: 1.4;
    text-transform: uppercase;
  }
}

@media (max-width: 620px) {
  .console-shell,
  .shell {
    width: min(100% - 20px, 1360px);
    padding-top: 20px;
  }

  h1 {
    font-size: 2rem;
  }

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

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