:root {
  --bg: #efede8;
  --panel: #fbfaf7;
  --panel-border: rgb(23 22 20 / 16%);
  --text: #171614;
  --muted: #5f5a50;
  --accent: #171614;
  --accent-soft: #d9d4ca;
  --danger: #a33e2a;
  --success: #215b38;
  --shadow: 0 10px 30px rgb(31 24 13 / 7%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 14px;
  background: linear-gradient(180deg, #f5f3ee 0%, var(--bg) 100%);
}

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

.app-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 18px 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-panel,
.nav-panel,
.workspace-panel {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.header-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.nav-panel {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding: 10px 12px;
}

.workspace-panel {
  margin-top: 20px;
  padding: 18px;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.75rem;
}

.footer-label {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.footer-commit {
  padding: 0.18rem 0.4rem;
  border: 1px solid rgb(23 22 20 / 10%);
  color: var(--text);
  background: rgb(255 255 255 / 55%);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
}

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

.brand {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.network-select,
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--panel-border);
  border-radius: 0;
  color: var(--text);
  background: #fff;
}

.network-select {
  width: 132px;
  min-height: 36px;
}

.subtle-text,
.panel-caption,
.balance-meta,
.address-key {
  color: var(--muted);
}

.wallet-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wallet-status {
  max-width: 140px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: right;
  line-height: 36px;
}

.wallet-button,
.primary-button,
.secondary-button,
.tab-button {
  border: 1px solid transparent;
  transition:
    background-color 120ms ease,
    border-color 120ms ease;
  cursor: pointer;
}

.wallet-button,
.primary-button {
  padding: 0.65rem 0.9rem;
  border-radius: 0;
  color: #faf7f1;
  background: var(--accent);
  min-height: 36px;
}

.wallet-action-button {
  width: 118px;
  justify-content: center;
}

.secondary-button {
  padding: 0.65rem 0.9rem;
  border-radius: 0;
  color: var(--text);
  background: transparent;
  border-color: var(--panel-border);
  text-decoration: none;
}

.plain-link-button {
  text-decoration: none;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  background: #fff;
  cursor: pointer;
}

.icon-button svg {
  width: 14px;
  height: 14px;
}

.icon-button:hover {
  color: var(--text);
  background: #efe9de;
}

.wallet-button:disabled,
.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.tab-button {
  display: inline-flex;
  padding: 0.65rem 0.85rem;
  border-radius: 0;
  color: var(--muted);
  background: #fff;
  border-color: var(--panel-border);
  text-decoration: none;
}

.tab-button.is-active {
  color: var(--text);
  background: var(--accent-soft);
}

.wallet-button:hover,
.primary-button:hover,
.secondary-button:hover,
.tab-button:hover {
  background: #2b2925;
}

.secondary-button:hover,
.tab-button:hover {
  background: #efe9de;
}

.panel {
  padding: 18px;
  border: 1px solid var(--panel-border);
  border-radius: 0;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.address-field-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.address-field {
  display: grid;
  gap: 6px;
}

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

.address-field-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.address-explorer-link {
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: none;
}

.address-explorer-link:hover {
  color: var(--text);
}

.address-status-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}

.address-status-indicator.is-initialized {
  color: var(--success);
}

.address-status-indicator.is-missing {
  color: var(--danger);
}

.address-display {
  padding: 0.65rem 0.7rem;
  border: 1px solid rgb(23 22 20 / 8%);
  color: var(--text);
  background: rgb(255 255 255 / 55%);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  word-break: break-all;
}

.compact-address-list {
  margin-top: 0;
}

.panel-header h2 {
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 1rem;
}

.panel-lead {
  margin: 12px 0 0;
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.9rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.action-row-no-top-margin {
  margin-top: 0;
}

.panel-message {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 0;
}

.dismissible-message {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-message.is-error {
  color: var(--danger);
  background: rgb(163 62 42 / 9%);
}

.panel-message.is-success {
  color: var(--success);
  background: rgb(33 91 56 / 9%);
}

.message-close {
  padding: 0;
  border: 0;
  color: currentcolor;
  font-size: 1rem;
  line-height: 1;
  background: transparent;
  cursor: pointer;
}

.balance-list,
.config-form {
  margin-top: 18px;
}

.balance-row,
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.balance-row {
  padding: 14px 0;
  border-top: 1px solid rgb(23 22 20 / 8%);
}

.balance-label,
.balance-value {
  font-weight: 600;
}

.balance-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.balance-send-button {
  min-height: 32px;
  padding: 0.45rem 0.8rem;
}

.empty-state,
.status-card,
.tx-card {
  margin-top: 18px;
  padding: 14px;
  border-radius: 0;
  background: #fff;
  border: 1px solid rgb(23 22 20 / 8%);
}

.status-card {
  display: grid;
  gap: 12px;
}

.tx-card {
  display: grid;
  gap: 8px;
}

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

.tx-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.tx-close {
  padding: 0;
  border: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  background: transparent;
  cursor: pointer;
}

.tx-signature {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  word-break: break-all;
}

.tx-note {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.vault-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.vault-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgb(23 22 20 / 8%);
  color: var(--text);
  text-decoration: none;
  background: #fff;
}

.vault-card:hover {
  background: #f3eee5;
}

.vault-card-header {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.45;
  word-break: break-all;
}

.vault-card-meta {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  word-break: break-all;
}

.vault-card-grid,
.vault-detail-grid {
  display: grid;
  gap: 10px;
}

.vault-card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  color: var(--text);
  font-size: 0.82rem;
}

.vault-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.profile-account-row {
  align-items: flex-start;
}

.address-value-with-link {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.configuration-grid-no-top-gap {
  margin-top: 0;
}

.tick-book-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgb(23 22 20 / 10%);
}

.tick-address-card {
  gap: 12px;
}

.tick-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.84rem;
}

.tick-filter-toggle input {
  width: auto;
  margin: 0;
}

.tick-table-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid rgb(23 22 20 / 8%);
  background: #fff;
}

.tick-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 0.82rem;
}

.tick-table th,
.tick-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgb(23 22 20 / 8%);
  text-align: left;
  white-space: nowrap;
}

.tick-table th {
  color: var(--muted);
  font-weight: 600;
  background: #f5f1e8;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(23 22 20 / 32%);
}

.modal-shell {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-card {
  width: min(100%, 520px);
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.vault-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.vault-tool-card {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.vault-tool-card.with-top-gap,
.status-card.with-top-gap {
  margin-top: 24px;
}

.vault-create-form {
  min-width: 0;
}

.tool-card-text {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.vault-create-form .field input {
  width: 100%;
}

.configuration-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(300px, 1fr);
  gap: 20px;
  margin-top: 18px;
}

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

.configuration-sidebar {
  align-self: start;
}

.profile-tools-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgb(23 22 20 / 10%);
}

.profile-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.config-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.form-group {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgb(23 22 20 / 8%);
}

.group-header h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
}

.inline-fields {
  display: grid;
  gap: 10px;
}

.inline-fields.single-column {
  grid-template-columns: minmax(0, 220px);
}

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

.inline-fields.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 0.8rem;
  color: var(--muted);
}

.field-with-inline-action {
  position: relative;
}

.field-with-inline-action input {
  padding-right: 36px;
}

.field-inline-icon {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: none;
}

.field textarea {
  min-height: 280px;
  resize: vertical;
}

.registry-section {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.registry-title {
  font-size: 0.8rem;
  color: var(--muted);
}

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

.registry-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.registry-index {
  padding-top: 0.65rem;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  text-align: right;
}

.registry-address {
  min-width: 0;
}

.registry-empty {
  margin-top: 0;
}

.network-select:focus,
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid rgb(23 22 20 / 12%);
  outline-offset: 1px;
}

.form-submit {
  margin-top: 8px;
}

.address-value {
  max-width: 62%;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  text-align: right;
  word-break: break-all;
}

.truncate-address-value {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

@media (width <= 720px) {
  .app-shell {
    padding: 18px 14px 28px;
  }

  .header-panel,
  .header-actions,
  .wallet-box {
    flex-direction: column;
    align-items: stretch;
  }

  .wallet-status {
    max-width: none;
    text-align: left;
    line-height: 1.4;
  }

  .network-select {
    width: 100%;
  }

  .inline-fields.single-column,
  .inline-fields.two-columns,
  .inline-fields.three-columns {
    grid-template-columns: 1fr;
  }

  .configuration-grid,
  .vault-card-grid,
  .vault-detail-grid,
  .profile-tools,
  .vault-tools-grid {
    grid-template-columns: 1fr;
  }

  .balance-row,
  .status-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
