:root {
  --guard-primary: #3390ec;
  --guard-primary-strong: #2481cc;
  --guard-primary-text: #fff;
  --guard-primary-soft: color-mix(in srgb, var(--guard-primary) 14%, transparent);
  --guard-primary-border: color-mix(in srgb, var(--guard-primary) 32%, transparent);
  color-scheme: light dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--tg-theme-bg-color, Canvas);
  color: var(--tg-theme-text-color, CanvasText);
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 280px;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--tg-theme-bg-color, Canvas);
  color: var(--tg-theme-text-color, CanvasText);
}

button {
  font: inherit;
}

.app-shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  flex-direction: column;
  overflow: hidden;
}

.app-header {
  flex: 0 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 16px 14px;
  border-bottom: 1px solid var(--tg-theme-section-separator-color, GrayText);
  background: var(--tg-theme-header-bg-color, var(--tg-theme-bg-color, Canvas));
}

.app-header strong {
  font-size: 18px;
}

.app-content {
  flex: 1 1 auto;
  min-height: 0;
  padding: 20px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.app-content.is-edge-to-edge {
  padding: 0;
}

.page h1 {
  margin: 0 0 18px;
  font-size: 24px;
  line-height: 1.2;
}

.loading {
  color: var(--tg-theme-hint-color, GrayText);
}

.error-message {
  margin: 20px 16px;
  padding: 14px;
  border: 1px solid var(--tg-theme-destructive-text-color, GrayText);
  border-radius: 8px;
}

.error-message p {
  margin: 8px 0;
}

.error-message small {
  color: var(--tg-theme-hint-color, GrayText);
  overflow-wrap: anywhere;
}

.app-navigation {
  display: grid;
  z-index: 10;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: 52px;
  align-items: center;
  align-content: start;
  width: 100%;
  height: calc(68px + env(safe-area-inset-bottom));
  min-height: calc(68px + env(safe-area-inset-bottom));
  max-height: calc(68px + env(safe-area-inset-bottom));
  flex: 0 0 calc(68px + env(safe-area-inset-bottom));
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  gap: 4px;
  border-top: 1px solid var(--tg-theme-section-separator-color, GrayText);
  background: var(--tg-theme-secondary-bg-color, Canvas);
}

.app-navigation button {
  align-self: center;
  height: 44px;
  max-height: 44px;
  min-width: 0;
  min-height: 44px;
  padding: 6px 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--tg-theme-hint-color, CanvasText);
  overflow-wrap: anywhere;
}

.app-navigation button[aria-current="page"] {
  background: var(--guard-primary);
  color: var(--tg-theme-button-text-color, ButtonText);
}

.add-address-page {
  max-width: 560px;
  margin: 0 auto;
}

.add-address-hero {
  margin-bottom: 24px;
}

.add-address-hero h1 {
  margin-bottom: 8px;
}

.add-address-hero p,
.add-address-note {
  margin: 0;
  color: var(--tg-theme-hint-color, GrayText);
  line-height: 1.45;
}

.add-address-form {
  padding: 18px;
  border: 1px solid var(--tg-theme-section-separator-color, #dce3ef);
  border-radius: 14px;
  background: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, Canvas));
}

.add-address-form .field-label {
  display: flex;
  justify-content: space-between;
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.add-address-form .field-label:not(:first-child) {
  margin-top: 18px;
}

.add-address-form .field-label span {
  color: var(--tg-theme-hint-color, GrayText);
  font-weight: 400;
}

.add-address-form input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--tg-theme-section-separator-color, #cfd6e0);
  border-radius: 10px;
  outline: none;
  background: var(--tg-theme-bg-color, Canvas);
  color: var(--tg-theme-text-color, CanvasText);
  font: inherit;
}

.add-address-form input:focus {
  border-color: var(--guard-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--guard-primary) 20%, transparent);
}

.add-address-note {
  margin-top: 14px;
  font-size: 13px;
}

.add-address-feedback {
  min-height: 20px;
  margin: 12px 0;
  font-size: 13px;
}

.add-address-feedback.is-success {
  color: #0a9f61;
}

.add-address-feedback.is-warning {
  color: #b7791f;
}

.add-address-feedback.is-error {
  color: var(--tg-theme-destructive-text-color, #d93025);
}

.add-address-submit {
  width: 100%;
}

.add-address-submit:disabled {
  cursor: wait;
  opacity: .65;
}

@media (max-width: 340px) {
  .app-navigation {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Label Settings follows the compact card hierarchy used by the Mini App design. */
.label-settings-page {
  min-height: 100%;
  background: var(--tg-theme-secondary-bg-color, #f7f8fa);
}

.label-settings-page .settings-toolbar {
  border-bottom: 1px solid var(--tg-theme-section-separator-color, #e7e9ed);
  background: var(--tg-theme-bg-color, #fff);
}

.label-settings-page .label-form {
  display: block;
  min-height: 0;
  padding: 14px 16px 28px;
}

.label-identity-card,
.kyt-settings-card {
  border: 1px solid var(--tg-theme-section-separator-color, #e1e4e8);
  border-radius: 14px;
  background: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #fff));
  box-shadow: 0 1px 2px rgb(0 0 0 / 3%);
}

.label-identity-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  min-height: 96px;
  padding: 14px 18px;
  gap: 14px;
}

.label-card-icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, #8b67d8 15%, var(--tg-theme-bg-color, #fff));
  color: #7956c8;
  font-size: 24px;
}

.label-card-copy {
  min-width: 0;
}

.label-settings-page .label-form input[name="name"] {
  min-height: 34px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 18px;
  font-weight: 700;
}

.label-settings-page .label-form input[name="name"]:focus {
  border: 0;
  box-shadow: none;
}

.label-card-copy small {
  display: block;
  margin-top: 2px;
  color: var(--tg-theme-hint-color, #727981);
  font-size: 13px;
}

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

.label-settings-page .character-count {
  height: 0;
  margin: 0;
  overflow: hidden;
}

.kyt-settings-card {
  margin-top: 12px;
  padding: 18px;
}

.kyt-settings-card .toggle-row {
  align-items: center;
}

.kyt-settings-card .toggle-row small {
  margin-top: 7px;
  line-height: 1.5;
}

.label-settings-page .label-addresses-section {
  margin-top: 28px;
}

.label-settings-page .section-heading {
  min-height: 42px;
  padding: 0 4px;
}

.label-settings-page .section-heading h2 {
  font-size: 17px;
}

.label-settings-page .expand-addresses {
  color: var(--guard-primary);
  font-size: 14px;
}

.label-settings-page .chain-groups {
  border-color: var(--tg-theme-section-separator-color, #e1e4e8);
  border-radius: 12px;
  background: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #fff));
}

.label-settings-page .chain-group-heading {
  min-height: 48px;
  padding: 0 12px;
  background: transparent;
}

.chain-heading-name,
.chain-heading-meta {
  display: flex;
  align-items: center;
  gap: 9px;
}

.chain-heading-meta {
  color: var(--tg-theme-hint-color, #727981);
  gap: 12px;
}

.chain-heading-meta small {
  font-size: 12px;
}

.chain-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.chain-tron { background: #ef3340; }
.chain-eth { background: #62688f; }
.chain-btc { background: #f7931a; }

.label-settings-page .chain-address-row {
  min-height: 54px;
  padding: 7px 14px 7px 45px;
  background: transparent;
}

.label-settings-page .delete-action {
  display: block;
  width: 100%;
  margin-top: 14px;
  font-size: 15px;
}

.label-settings-page .form-feedback:empty {
  display: none;
}

/* Address import flow */
.address-import-page {
  min-height: 100%;
  background:
    radial-gradient(circle at 80% 0%, color-mix(in srgb, var(--guard-primary) 6%, transparent), transparent 34%),
    var(--tg-theme-bg-color, #080d0f);
  color: var(--tg-theme-text-color, #f4f7f6);
}

.import-shell,
.template-page {
  display: flex;
  width: min(100%, 620px);
  min-height: 100%;
  margin: 0 auto;
  padding: 22px 18px 18px;
  flex-direction: column;
}

.step-badge {
  align-self: flex-start;
  padding: 3px 7px;
  border-radius: 4px;
  background: var(--guard-primary-soft);
  color: var(--guard-primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}

.import-shell h1,
.template-page h1,
.import-success h1 {
  margin: 22px 0 6px;
  font-size: 23px;
  line-height: 1.2;
}

.import-subtitle,
.template-page > p,
.import-success > p {
  margin: 0;
  color: var(--tg-theme-hint-color, #a5ada9);
  font-size: 13px;
  line-height: 1.5;
}

.import-content {
  display: flex;
  min-height: 0;
  flex: 1;
  margin-top: 24px;
  flex-direction: column;
}

.import-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 30px;
  border-radius: 7px;
  background: var(--tg-theme-secondary-bg-color, #11191c);
  overflow: hidden;
}

.import-tabs button {
  min-height: 44px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--tg-theme-text-color, #f4f7f6);
  font-size: 13px;
  font-weight: 700;
}

.import-tabs button.is-active,
.import-primary {
  background: linear-gradient(135deg, var(--guard-primary-strong), var(--guard-primary));
  color: var(--guard-primary-text);
}

.import-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
}

.import-label:not(:first-child) {
  margin-top: 28px;
}

.import-label small {
  color: var(--guard-primary);
  font-size: 11px;
  font-weight: 500;
}

.import-input,
.import-textarea,
.paste-field,
.import-card select {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, #7d8682) 15%, transparent);
  border-radius: 8px;
  outline: none;
  background: var(--tg-theme-secondary-bg-color, #11191c);
  color: var(--tg-theme-text-color, #f4f7f6);
  font: inherit;
}

.import-input:focus,
.import-textarea:focus,
.paste-field:focus-within,
.import-card select:focus {
  border-color: var(--guard-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--guard-primary) 20%, transparent);
}

.import-input {
  min-height: 52px;
  padding: 0 14px;
}

.paste-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  overflow: hidden;
}

.paste-field input {
  min-width: 0;
  min-height: 52px;
  padding: 0 14px;
  border: 0;
  outline: none;
  background: transparent;
  color: inherit;
  font: inherit;
}

.paste-field button,
.template-link {
  border: 0;
  background: transparent;
  color: var(--guard-primary);
  font-weight: 700;
}

.paste-field button {
  padding: 0 14px;
}

.field-help {
  margin: 10px 0 0;
  color: var(--tg-theme-hint-color, #919b96);
  font-size: 11px;
  line-height: 1.45;
}

.import-textarea {
  min-height: 190px;
  padding: 14px;
  resize: vertical;
  line-height: 1.7;
}

.import-or {
  margin: 17px 0;
  color: var(--tg-theme-hint-color, #919b96);
  font-size: 12px;
  text-align: center;
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.upload-grid label {
  display: grid;
  min-height: 48px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, #7d8682) 15%, transparent);
  border-radius: 8px;
  background: var(--tg-theme-secondary-bg-color, #11191c);
  font-size: 12px;
  font-weight: 700;
}

.upload-grid input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.template-link {
  align-self: center;
  min-height: 44px;
  margin-top: 5px;
}

.import-primary,
.import-outline {
  min-height: 50px;
  border-radius: 7px;
  font-weight: 750;
}

.import-primary {
  border: 0;
}

.import-primary:disabled {
  opacity: .5;
}

.import-bottom-action {
  width: 100%;
  margin-top: auto;
}

.import-back,
.template-back {
  align-self: flex-start;
  min-height: 32px;
  margin-bottom: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--guard-primary);
}

.import-card {
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, #7d8682) 15%, transparent);
  border-radius: 8px;
  background: var(--tg-theme-secondary-bg-color, #11191c);
}

.import-card + .import-card {
  margin-top: 12px;
}

.import-card select {
  min-height: 48px;
  margin-top: 4px;
  padding: 0 12px;
}

.kyt-preview-card > div,
.confirm-label-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kyt-preview-card p {
  margin: 14px 0 0;
  color: var(--tg-theme-hint-color, #9aa39f);
  font-size: 12px;
  line-height: 1.5;
}

.status-pill {
  padding: 4px 8px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--tg-theme-hint-color, #89918d) 15%, transparent);
  color: var(--tg-theme-hint-color, #89918d);
  font-size: 11px;
  font-weight: 800;
}

.status-pill.is-on {
  background: color-mix(in srgb, #00c875 15%, transparent);
  color: #0bd57c;
}

.preview-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.preview-stat {
  display: grid;
  min-height: 82px;
  padding: 12px 5px;
  place-content: center;
  border-radius: 8px;
  background: var(--tg-theme-secondary-bg-color, #11191c);
  text-align: center;
}

.preview-stat strong {
  font-size: 22px;
}

.preview-stat span {
  margin-top: 5px;
  font-size: 10px;
}

.preview-stat.is-valid { color: #0bd57c; }
.preview-stat.is-duplicate { color: #f2ae2e; }
.preview-stat.is-invalid { color: #ff4d55; }
.preview-stat.is-limited { color: #a68cff; }

.preview-groups {
  display: grid;
  margin-top: 14px;
  gap: 2px;
}

.preview-group {
  border: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, #7d8682) 15%, transparent);
  border-radius: 7px;
  background: var(--tg-theme-secondary-bg-color, #11191c);
  overflow: hidden;
}

.preview-group summary {
  display: flex;
  min-height: 48px;
  padding: 0 12px;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
}

.preview-group summary > span,
.success-counts span {
  display: flex;
  align-items: center;
  gap: 9px;
}

.coin {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-style: normal;
}

.coin-tron { background: #e62e3b; }
.coin-eth { background: #625bd6; }
.coin-btc { background: #f59d1d; }

.preview-address {
  display: flex;
  min-height: 54px;
  padding: 8px 14px 8px 43px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, #7d8682) 12%, transparent);
}

.preview-address strong,
.preview-address small {
  display: block;
}

.preview-address small {
  margin-top: 4px;
  color: var(--tg-theme-hint-color, #949d99);
  font-size: 10px;
}

.preview-address b {
  color: #0bd57c;
}

.confirm-label-card > span,
.confirm-label-card > strong {
  display: block;
}

.confirm-label-card > span {
  color: var(--tg-theme-hint-color, #949d99);
  font-size: 11px;
}

.confirm-label-card > strong {
  margin: 12px 0 18px;
}

.confirm-label-card > div {
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, #7d8682) 12%, transparent);
}

.confirm-counts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
  border: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, #7d8682) 15%, transparent);
  border-radius: 8px;
  background: var(--tg-theme-secondary-bg-color, #11191c);
  overflow: hidden;
}

.confirm-counts > div {
  display: grid;
  min-height: 88px;
  padding: 14px;
  gap: 5px;
  border-right: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, #7d8682) 12%, transparent);
}

.confirm-counts > div:last-of-type {
  border-right: 0;
}

.confirm-counts footer {
  display: flex;
  grid-column: 1 / -1;
  min-height: 45px;
  padding: 0 14px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, #7d8682) 12%, transparent);
  font-size: 12px;
}

.import-notice {
  margin: 14px 0;
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--guard-primary) 30%, transparent);
  border-radius: 7px;
  background: color-mix(in srgb, var(--guard-primary) 7%, transparent);
  color: var(--tg-theme-hint-color, #a9b5b0);
  font-size: 11px;
  line-height: 1.5;
}

.import-error {
  margin: 12px 0;
  color: #ff5961;
  font-size: 12px;
}

.import-success {
  display: flex;
  width: min(100%, 520px);
  min-height: 100%;
  margin: 0 auto;
  padding: 58px 28px 28px;
  align-items: center;
  flex-direction: column;
  text-align: center;
}

.success-check {
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  border: 1px solid #0bd57c;
  border-radius: 50%;
  background: color-mix(in srgb, #00c875 14%, transparent);
  box-shadow: 0 0 0 14px color-mix(in srgb, #00c875 5%, transparent);
  color: #fff;
  font-size: 40px;
}

.success-label {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 16px;
  background: var(--tg-theme-secondary-bg-color, #11191c);
  color: #0bd57c;
  font-size: 12px;
}

.success-counts {
  width: 100%;
  margin-top: 34px;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--tg-theme-secondary-bg-color, #11191c);
}

.success-counts > div {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
}

.success-counts > div + div {
  border-top: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, #7d8682) 12%, transparent);
}

.success-actions {
  display: grid;
  width: 100%;
  margin-top: auto;
  gap: 10px;
}

.import-outline {
  border: 1px solid var(--guard-primary);
  background: transparent;
  color: var(--guard-primary);
}

.template-page > p {
  margin-bottom: 24px;
}

.template-file {
  display: flex;
  min-height: 66px;
  padding: 12px 16px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, #7d8682) 15%, transparent);
  border-radius: 8px;
  background: var(--tg-theme-secondary-bg-color, #11191c);
  color: var(--tg-theme-text-color, #f4f7f6);
  text-align: left;
}

.template-file span,
.template-file small {
  display: block;
}

.template-file small {
  margin: 5px 0 0 22px;
  color: var(--tg-theme-hint-color, #949d99);
}

.template-file > b {
  color: var(--guard-primary);
  font-size: 21px;
}

.template-table {
  margin-top: 6px;
  border: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, #7d8682) 15%, transparent);
  border-radius: 7px;
  overflow: hidden;
}

.template-table > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 48px;
}

.template-table span,
.template-table strong {
  padding: 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, #7d8682) 12%, transparent);
  font-size: 11px;
}

.template-table span + span,
.template-table strong + strong {
  border-left: 1px solid color-mix(in srgb, var(--tg-theme-hint-color, #7d8682) 12%, transparent);
}

.app-navigation button {
  display: grid;
  grid-template-rows: 20px 15px;
  place-items: center;
  font-size: 10px;
  line-height: 1;
}

.app-navigation .nav-icon {
  font-size: 18px;
}

.app-navigation button[aria-current="page"] {
  background: transparent;
  color: var(--guard-primary);
}

@media (max-width: 380px) {
  .preview-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .preview-stat {
    min-height: 68px;
  }
}

.label-addresses-section {
  margin-top: 28px;
}

.section-heading,
.chain-group-heading,
.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-heading h2,
.detail-card h2 {
  margin: 0;
  font-size: 17px;
}

.expand-addresses {
  min-height: 36px;
  font-size: 14px;
  text-align: right;
}

.chain-groups {
  overflow: hidden;
  border: 1px solid var(--tg-theme-section-separator-color, #dce3ef);
  border-radius: 12px;
}

.chain-group + .chain-group {
  border-top: 1px solid var(--tg-theme-section-separator-color, #dce3ef);
}

.chain-group-heading {
  min-height: 46px;
  padding: 0 14px;
  background: var(--tg-theme-section-bg-color, #fff);
}

.chain-group-heading strong {
  font-size: 14px;
}

.chain-address-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 8px 14px 8px 28px;
  border: 0;
  border-top: 1px solid var(--tg-theme-section-separator-color, #edf0f4);
  background: var(--tg-theme-bg-color, #fff);
  color: var(--tg-theme-text-color, #111);
  text-align: left;
}

.chain-address-row strong,
.chain-address-row small {
  display: block;
}

.chain-address-row small {
  margin-top: 3px;
  color: var(--tg-theme-hint-color, #7d8590);
  font-size: 12px;
}

.address-detail-page {
  min-height: 100%;
  background: var(--tg-theme-secondary-bg-color, #f5f6f8);
}

.detail-toolbar {
  display: grid;
  position: sticky;
  z-index: 5;
  top: 0;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  align-items: center;
  min-height: 48px;
  padding: 2px 16px;
  border-bottom: 1px solid var(--tg-theme-section-separator-color, #e7e9ed);
  background: var(--tg-theme-bg-color, #fff);
}

.detail-toolbar h1 {
  margin: 0;
  font-size: 17px;
  text-align: center;
}

.detail-edit { text-align: right; }
.detail-back { text-align: left; }

.address-detail-content {
  display: grid;
  padding: 14px 14px 28px;
  gap: 12px;
}

.network-pill {
  justify-self: start;
  padding: 4px 10px;
  border-radius: 999px;
  background: #dff8ea;
  color: #079653;
  font-size: 12px;
  font-weight: 700;
}

.network-eth { background: #ece9ff; color: #6553c7; }
.network-btc { background: #fff1dc; color: #d57a00; }

.detail-card {
  padding: 16px;
  border: 1px solid var(--tg-theme-section-separator-color, #dfe3e8);
  border-radius: 12px;
  background: var(--tg-theme-section-bg-color, #fff);
  color: var(--tg-theme-text-color, #111);
}

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

.identity-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.identity-card code {
  color: var(--tg-theme-hint-color, #69717c);
  font-family: inherit;
  cursor: pointer;
}

.outline-action {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--guard-primary);
  border-radius: 9px;
  background: transparent;
  color: var(--guard-primary);
}

.label-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  gap: 12px;
  text-align: left;
}

.label-link > span:first-child,
.empty-copy,
.address-info dt {
  color: var(--tg-theme-hint-color, #7b838e);
}

.balance-list > div,
.address-info dl > div {
  display: flex;
  justify-content: space-between;
  padding-top: 13px;
}

.empty-copy {
  margin: 12px 0 0;
}

.transaction-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  padding: 12px 0;
  gap: 10px;
}

.transaction-row + .transaction-row {
  border-top: 1px solid var(--tg-theme-section-separator-color, #edf0f4);
}

.transaction-row strong,
.transaction-row small {
  display: block;
}

.transaction-row small {
  margin-top: 4px;
  color: var(--tg-theme-hint-color, #7b838e);
  font-size: 12px;
}

.transaction-row > span:last-child { text-align: right; }
.transaction-icon { color: #08a85d; font-size: 24px; }
.is-positive { color: #079653; }
.address-info dl { margin: 0; }
.address-info dd { margin: 0; text-align: right; }

.detail-actions {
  display: grid;
  margin-top: 4px;
  gap: 10px;
}

.secondary-card-action,
.danger-card-action {
  min-height: 48px;
  border: 1px solid var(--tg-theme-section-separator-color, #dfe3e8);
  border-radius: 12px;
  background: var(--tg-theme-section-bg-color, #fff);
  color: var(--guard-primary);
}

.danger-card-action {
  color: var(--tg-theme-destructive-text-color, #f04438);
}

.detail-feedback {
  color: var(--tg-theme-hint-color, #69717c);
  text-align: center;
}

.dialog-body select {
  width: 100%;
  min-height: 44px;
  margin: 12px 0 18px;
}

.dialog-confirm.is-danger {
  background: var(--tg-theme-destructive-text-color, #f04438);
}

.labels-page,
.label-settings-page {
  min-height: 100%;
  background: var(--tg-theme-bg-color, Canvas);
}

.labels-hero {
  padding: 22px 20px 24px;
  background: var(--tg-theme-secondary-bg-color, #f5f8ff);
}

.guard-wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  color: var(--tg-theme-text-color, #071a45);
  font-size: 22px;
  font-weight: 750;
}

.guard-mark {
  display: grid;
  width: 34px;
  height: 40px;
  place-items: center;
  border: 4px solid var(--guard-primary);
  border-radius: 12px 12px 16px 16px;
  color: var(--guard-primary);
}

.labels-hero h1 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

.labels-hero p,
.empty-state {
  margin: 0;
  color: var(--tg-theme-hint-color, #7180a3);
}

.labels-hero p {
  font-size: 15px;
  line-height: 1.45;
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state strong {
  margin-bottom: 6px;
  color: var(--tg-theme-text-color, #071a45);
}

.labels-body {
  padding: 20px 18px 24px;
}

.labels-body h2 {
  margin: 0 0 16px;
  font-size: 22px;
}

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

.label-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 78px;
  padding: 14px;
  gap: 12px;
  border: 1px solid var(--tg-theme-section-separator-color, #dce3ef);
  border-radius: 8px;
  background: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #fff));
  color: var(--tg-theme-text-color, #071a45);
  text-align: left;
}

.label-status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--tg-theme-hint-color, #9aa9c4);
}

.label-status-dot.is-on {
  background: #00ad61;
}

.label-copy {
  min-width: 0;
}

.label-copy strong,
.label-copy small {
  display: block;
}

.label-copy strong {
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.label-copy small {
  margin-top: 5px;
  color: var(--tg-theme-hint-color, #7180a3);
}

.kyt-badge {
  padding: 8px 9px;
  border-radius: 6px;
  background: var(--tg-theme-secondary-bg-color, #edf1f6);
  color: var(--tg-theme-hint-color, #60708f);
  font-size: 12px;
  white-space: nowrap;
}

.kyt-badge.is-on {
  background: color-mix(in srgb, #00ad61 12%, var(--tg-theme-bg-color, white));
  color: #008c4e;
}

.primary-action {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  background: var(--guard-primary);
  color: var(--guard-primary-text);
  font-weight: 650;
}

.new-label-action {
  margin-top: 18px;
}

.settings-toolbar {
  display: grid;
  position: sticky;
  z-index: 5;
  top: 0;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  align-items: center;
  min-height: 48px;
  padding: 2px 16px;
  background: var(--tg-theme-bg-color, Canvas);
}

.settings-toolbar h1 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
  text-align: center;
}

.text-button {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--guard-primary);
  font-size: 17px;
  font-weight: 400;
}

.cancel-button { text-align: left; }
.save-top { text-align: right; }

.label-form {
  display: flex;
  min-height: calc(100dvh - 190px);
  padding: 24px 20px;
  flex-direction: column;
}

.label-form > label:not(.toggle-row) {
  margin-bottom: 8px;
  color: var(--tg-theme-hint-color, #60708f);
  font-size: 14px;
  font-weight: 600;
}

.label-form input[type="text"],
.label-form input[name="name"] {
  width: 100%;
  min-height: 54px;
  padding: 0 14px;
  border: 1px solid var(--tg-theme-section-separator-color, #dce3ef);
  border-radius: 8px;
  outline: none;
  background: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, white));
  color: var(--tg-theme-text-color, #071a45);
  font: inherit;
}

.label-form input[name="name"]:focus {
  border-color: var(--guard-primary);
}

.character-count {
  margin-top: 8px;
  color: var(--tg-theme-hint-color, #7180a3);
  font-size: 13px;
  text-align: right;
}

.form-divider {
  height: 1px;
  margin: 22px 0;
  background: var(--tg-theme-section-separator-color, #dce3ef);
}

.toggle-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  position: relative;
  gap: 14px;
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row small {
  margin-top: 14px;
  color: var(--tg-theme-hint-color, #7180a3);
  line-height: 1.7;
}

.toggle-row input {
  position: absolute;
  opacity: 0;
}

.toggle-control {
  width: 50px;
  height: 30px;
  padding: 3px;
  border-radius: 16px;
  background: var(--tg-theme-hint-color, #9aa9c4);
}

.toggle-control::after {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  content: "";
  transition: transform 160ms ease;
}

.toggle-row input:checked + .toggle-control {
  background: var(--guard-primary);
}

.toggle-row input:checked + .toggle-control::after {
  transform: translateX(20px);
}

.info-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  margin-top: 28px;
  padding: 16px;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--guard-primary) 25%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--guard-primary) 5%, transparent);
  color: var(--tg-theme-hint-color, #60708f);
}

.info-panel p { margin: 0; line-height: 1.5; }
.info-panel > span { color: var(--guard-primary); }

.form-feedback { margin-top: 16px; }
.label-form .save-action { margin-top: auto; }

.delete-action {
  min-height: 46px;
  border: 0;
  background: transparent;
  color: var(--tg-theme-destructive-text-color, #e53935);
}

.confirm-overlay {
  display: grid;
  position: fixed;
  z-index: 20;
  inset: 0;
  padding: 20px;
  place-items: center;
  background: rgb(0 0 0 / 42%);
}

.confirm-dialog {
  width: min(100%, 360px);
  padding: 20px;
  border-radius: 8px;
  background: var(--tg-theme-bg-color, white);
  color: var(--tg-theme-text-color, #071a45);
}

.confirm-dialog h2 { margin: 0 0 10px; font-size: 19px; }
.confirm-dialog p { color: var(--tg-theme-hint-color, #7180a3); }
.confirm-dialog > div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.secondary-action,
.danger-action { min-height: 44px; border: 0; border-radius: 6px; }
.danger-action { background: var(--tg-theme-destructive-text-color, #e53935); color: white; }

@media (max-width: 340px) {
  .labels-hero h1 { font-size: 26px; }
  .label-row { grid-template-columns: 14px minmax(0, 1fr); }
  .kyt-badge { grid-column: 2; justify-self: start; }
  .label-form { padding-inline: 16px; }
}
