:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --panel: #ffffff;
  --text: #17201d;
  --muted: #5f6d66;
  --line: #d8ded6;
  --strong-line: #b7c0b5;
  --accent: #176b5b;
  --accent-2: #2f6fed;
  --danger: #a33b2b;
  --warn: #89620d;
  --ok: #167342;
  --shadow: 0 12px 34px rgba(23, 32, 29, 0.06);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

input[spellcheck="false"],
textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

button {
  min-height: 42px;
  border: 1px solid var(--strong-line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 14px;
  cursor: pointer;
  font-weight: 720;
  white-space: nowrap;
}

.button-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--strong-line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 14px;
  font-weight: 720;
  white-space: nowrap;
}

.button-link:hover {
  border-color: var(--accent);
}

.button-link.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

button:hover {
  border-color: var(--accent);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

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

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: 0;
}

.header-title {
  color: var(--text);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 780;
  line-height: 1.05;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  font-size: 16px;
  line-height: 1.25;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 16px max(20px, calc((100vw - 1120px) / 2 + 20px));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.back-link,
.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
}

.top-nav a {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-weight: 650;
}

.top-nav a:hover {
  color: var(--accent);
}

.header-actions select {
  width: auto;
  min-width: 190px;
}

.shell {
  width: min(1120px, calc(100% - 40px));
  margin: 32px auto 64px;
  display: grid;
  gap: 18px;
}

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

.surface {
  padding: 18px;
}

.config-surface {
  padding-bottom: 20px;
}

.console-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 28px 0;
}

.console-band h2 {
  max-width: 760px;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1.05;
}

.console-band h1 {
  max-width: 820px;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1.05;
}

.hero-summary {
  max-width: 720px;
  margin-top: 14px;
  color: var(--text);
  font-size: clamp(20px, 2.7vw, 30px);
  font-weight: 740;
  line-height: 1.18;
}

.brand-tagline {
  max-width: 720px;
  margin-top: 18px;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 21px);
  line-height: 1.45;
}

.compact-band h2 {
  max-width: 720px;
  font-size: clamp(26px, 3.5vw, 42px);
}

.console-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.section-title {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
}

.risk-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.risk-strip span {
  min-height: 44px;
  display: flex;
  align-items: center;
  border: 1px solid #e3cf9d;
  border-radius: 8px;
  background: #fff8e6;
  color: var(--warn);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.25;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.status-line span,
.badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8faf6;
  color: var(--muted);
  padding: 4px 10px;
  font-size: 13px;
  line-height: 1;
}

.badge.ok {
  border-color: #b7dac8;
  background: #eef9f2;
  color: var(--ok);
}

.badge.warn {
  border-color: #e3cf9d;
  background: #fff8e6;
  color: var(--warn);
}

.badge.danger {
  border-color: #e6bbb5;
  background: #fff0ee;
  color: var(--danger);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

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

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

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

.align-end {
  align-self: end;
}

.align-right {
  justify-content: flex-end;
}

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

.metric-card {
  min-width: 0;
  min-height: 110px;
  padding: 14px;
  display: grid;
  align-content: space-between;
  gap: 10px;
}

.metric-card small {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.metric-card strong {
  overflow-wrap: anywhere;
  font-size: 18px;
  line-height: 1.2;
}

.metric-card strong.badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.permissions-panel {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

.permissions-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.permissions-header h2 {
  margin-top: 4px;
}

.badge-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

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

.permission-card {
  min-height: 118px;
  display: grid;
  align-content: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 12px;
}

.permission-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.permission-card-header strong {
  font-size: 14px;
  line-height: 1.25;
}

.product-list {
  display: grid;
  gap: 12px;
}

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

.product-row,
.product-card {
  min-height: 72px;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.product-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-row:hover,
.product-card.active:hover {
  border-color: var(--accent);
}

.product-card {
  min-height: 210px;
  align-content: space-between;
}

.product-card strong {
  font-size: 22px;
  line-height: 1.15;
}

.product-card small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.product-card.planned {
  background: #fbfcf8;
  color: #495046;
}

.product-row span:first-child {
  display: grid;
  gap: 4px;
}

.product-row small {
  color: var(--muted);
}

.row-action {
  color: var(--accent);
  font-weight: 700;
}

.row-action.muted {
  color: var(--muted);
}

.trust-summary {
  display: grid;
  gap: 12px;
}

.release-summary {
  display: grid;
  gap: 8px;
}

.release-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.release-row p {
  max-width: 720px;
  color: var(--muted);
  font-size: 15px;
}

.release-panel {
  width: min(360px, 100%);
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.release-panel strong {
  font-size: 15px;
  line-height: 1.35;
}

.release-panel small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.advanced-config {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 10px 12px;
}

.advanced-config summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.advanced-config p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.wizard {
  display: grid;
  gap: 16px;
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.wizard-steps li {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcf8;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.wizard-steps li.active {
  border-color: var(--accent);
  background: #edf8f3;
  color: var(--accent);
}

.wizard-panel {
  display: grid;
  gap: 14px;
}

.field-note {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.field-note strong {
  color: var(--text);
  font-size: 14px;
}

.wizard-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.compact-details {
  margin-top: 0;
}

.muted-copy {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

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

.address-grid a,
.address-grid article {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 14px;
}

.address-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.address-grid strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.vault-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.vault-list button {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.stack {
  display: grid;
  gap: 12px;
}

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

.admin-grid .stack {
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 14px;
}

.admin-grid .stack:last-child {
  grid-column: 1 / -1;
}

.admin-grid h3 {
  min-height: 40px;
  display: flex;
  align-items: center;
  color: var(--accent);
}

.details {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.details-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
  font-size: 13px;
}

.details-row span:last-child {
  overflow-wrap: anywhere;
}

.queued-action-center {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.queued-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 14px;
}

.guide-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 36px;
  align-items: center;
  padding: 36px 0 18px;
}

.guide-hero h2 {
  max-width: 680px;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.04;
}

.guide-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 22px;
}

.guide-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.guide-nav {
  position: sticky;
  top: 102px;
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.guide-nav a {
  border-radius: 6px;
  color: var(--muted);
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 650;
}

.guide-nav a:hover {
  background: #eef6f2;
  color: var(--accent);
}

.guide-content {
  display: grid;
  gap: 18px;
}

.guide-section {
  display: grid;
  gap: 14px;
}

.guide-section p,
.guide-section li {
  color: var(--muted);
}

.step-list,
.check-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step-list li,
.check-list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 12px 14px;
}

.step-list strong,
.check-list strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

.role-table {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.role-table table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.role-table th,
.role-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

.role-table th {
  color: var(--text);
  font-size: 13px;
}

.role-table td {
  color: var(--muted);
  font-size: 14px;
}

.role-table tr:last-child th,
.role-table tr:last-child td {
  border-bottom: 0;
}

.queued-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.queued-card-header strong {
  overflow-wrap: anywhere;
}

.warning-list {
  display: grid;
  gap: 8px;
}

.warning-list:empty {
  display: none;
}

.warning-list div {
  border: 1px solid #e3cf9d;
  border-radius: 8px;
  background: #fff8e6;
  color: var(--warn);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.35;
}

.tx-dialog {
  width: min(680px, calc(100% - 28px));
  max-height: calc(100% - 36px);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 70px rgba(20, 31, 24, 0.22);
  color: var(--text);
  padding: 0;
}

.tx-dialog::backdrop {
  background: rgba(29, 33, 28, 0.48);
}

.tx-dialog-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.activity-log {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.log-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.log-line.ok {
  border-color: #b7dac8;
  color: var(--ok);
}

.log-line.error {
  border-color: #e6bbb5;
  color: var(--danger);
}

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

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

  .release-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .risk-strip,
  .product-grid,
  .address-grid,
  .metric-grid,
  .permission-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .form-grid,
  .form-grid.two-col,
  .guide-layout,
  .guide-hero,
  .admin-grid,
  .operations-grid {
    grid-template-columns: 1fr;
  }

  .guide-nav {
    position: static;
  }

  .form-grid.compact {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 32px, 1120px);
    margin-top: 18px;
  }

  .app-header {
    position: static;
    padding: 12px 16px;
    background: #fff;
  }

  .header-actions,
  .button-row,
  .console-actions {
    width: 100%;
  }

  .top-nav {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .top-nav::-webkit-scrollbar {
    display: none;
  }

  .top-nav a {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .header-actions button,
  .header-actions select,
  .header-actions .button-link,
  .console-actions .button-link,
  .button-row button {
    flex: 1 1 160px;
  }

  .risk-strip,
  .wizard-steps,
  .product-grid,
  .address-grid,
  .metric-grid,
  .guide-hero {
    grid-template-columns: 1fr;
  }

  .guide-hero h2 {
    font-size: 34px;
  }

  .role-table {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .role-table table,
  .role-table thead,
  .role-table tbody,
  .role-table tr,
  .role-table th,
  .role-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .role-table thead {
    display: none;
  }

  .role-table tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcf8;
    margin-bottom: 10px;
    padding: 12px;
  }

  .role-table th,
  .role-table td {
    border-bottom: 0;
    padding: 4px 0;
  }

  .role-table tbody th {
    font-size: 16px;
  }

  .role-table tbody td::before {
    display: block;
    color: var(--text);
    font-size: 12px;
    font-weight: 760;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .role-table tbody td:nth-child(2)::before {
    content: "Can do";
  }

  .role-table tbody td:nth-child(3)::before {
    content: "Cannot do";
  }

  .role-table tbody td:nth-child(4)::before {
    content: "Recommended holder";
  }

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

  .permission-card {
    min-height: 0;
    padding: 10px;
  }

  .permission-card .muted-copy {
    font-size: 12px;
    line-height: 1.35;
  }

  .permission-card .badge {
    padding-inline: 8px;
    font-size: 12px;
  }

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

  .badge-list {
    justify-content: flex-start;
  }

  .details-row {
    grid-template-columns: 1fr;
  }

  input[spellcheck="false"],
  textarea {
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  .permission-grid {
    grid-template-columns: 1fr;
  }
}
