html.instance-check,
html.instance-check body {
  background: #fafafa;
}

html.instance-check body {
  visibility: hidden;
}

.instance-chip {
  display: inline-block;
  min-width: 0;
  max-width: min(40vw, 16rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  color: var(--topbar-text);
  background: color-mix(in srgb, var(--topbar-text) 16%, transparent);
}

.settings-menu-btn {
  background: transparent;
  border: none;
  color: var(--topbar-text);
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.settings-menu-btn:hover,
.settings-menu-btn:focus-visible {
  background: color-mix(in srgb, var(--topbar-text) 14%, transparent);
  outline: none;
}

#settings-menu-dropdown {
  min-width: 270px;
}

.btn.teal,
.btn-small.teal,
.btn-large.teal,
.btn-floating.teal {
  background-color: var(--primary) !important;
}

.btn.teal:hover,
.btn-small.teal:hover,
.btn-large.teal:hover,
.btn-floating.teal:hover,
.btn.teal:focus,
.btn-small.teal:focus,
.btn-large.teal:focus {
  background-color: var(--primary-dark) !important;
}

.teal-text {
  color: var(--primary) !important;
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  padding: 1.25rem 0.75rem 2rem;
  background: rgba(0, 0, 0, 0.45);
}

.settings-modal__card {
  width: min(680px, 100%);
  background: #fff;
  color: #212121;
  border-radius: 10px;
  padding: 1.25rem 1.25rem 1.4rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.settings-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.settings-modal__header h4 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1.25rem;
}

.settings-modal__lead,
.settings-note {
  margin: 0 0 1rem;
  color: #546e7a;
  font-size: 0.9rem;
}

.settings-field {
  margin-bottom: 0.9rem;
}

.settings-field label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #37474f;
}

.settings-field input[type="text"] {
  width: 100%;
  height: 42px;
  margin: 0;
  padding: 0 0.7rem;
  border: 1px solid #cfd8dc;
  border-radius: 6px;
  box-sizing: border-box;
  background: #fff;
  color: #212121;
}

.settings-host {
  margin: 0;
  font-size: 0.95rem;
  word-break: break-all;
}

.settings-presets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 0.5rem;
}

.settings-preset {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  border: 2px solid #e0e0e0;
  background: #fff;
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  cursor: pointer;
  text-align: left;
  color: #212121;
  min-height: 44px;
}

.settings-preset.is-active {
  border-color: #263238;
}

.settings-swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.settings-swatch span {
  flex: 1;
}

.settings-colors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.settings-colors input[type="color"] {
  width: 100%;
  height: 42px;
  padding: 0.15rem;
  border: 1px solid #cfd8dc;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.settings-preview {
  display: flex;
  height: 74px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
  margin: 0.35rem 0 1rem;
}

.settings-preview__side {
  width: 34%;
  display: flex;
  align-items: flex-end;
  padding: 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.settings-preview__main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.settings-preview__bar {
  height: 28px;
  display: flex;
  align-items: center;
  padding: 0 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.settings-preview__body {
  flex: 1;
  background: #fafafa;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.instance-duplicate {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: #eceff1;
  color: #263238;
  font-family: Roboto, 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.instance-duplicate__card {
  width: min(460px, 100%);
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem 1.25rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  text-align: center;
}

.instance-duplicate__card h1 {
  margin: 0.4rem 0 0.6rem;
  font-size: 1.35rem;
}

.instance-duplicate__card p {
  margin: 0 0 0.8rem;
  line-height: 1.45;
}

.settings-inline {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.settings-inline input {
  flex: 1;
}

.settings-check {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin: 0.85rem 0;
  line-height: 1.4;
}

.settings-token-reveal,
.settings-code {
  background: #f4f7f7;
  border-radius: 8px;
  padding: 0.75rem;
  margin: 0.4rem 0 0.8rem;
}

.settings-code {
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 0.82rem;
}

.settings-token-reveal textarea {
  width: 100%;
  min-height: 4.2rem;
  margin: 0.4rem 0;
  font-family: ui-monospace, monospace;
}

.settings-token-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid #eceff1;
}

.settings-token-row span {
  display: block;
  color: #607d8b;
  font-size: 0.82rem;
}

.banco-acesso-rapido {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: stretch;
  margin: 0.2rem 0 0.8rem;
}

.banco-acesso-rotulo {
  align-self: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #607d8b;
  margin-right: 0.2rem;
}

.banco-acesso-chip {
  border: 1px solid #cfd8dc;
  background: #fff;
  border-radius: 10px;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
  text-align: left;
  line-height: 1.2;
}

.banco-acesso-chip strong,
.banco-acesso-chip small {
  display: block;
}

.banco-acesso-chip small {
  color: #607d8b;
  font-size: 0.75rem;
}

.banco-acesso-chip.is-active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, #fff);
}

.banco-previa {
  margin-top: 8px;
  max-height: 220px;
  overflow: auto;
  border: 1px solid #eceff1;
  border-radius: 6px;
}

.banco-previa table {
  font-size: 0.85rem;
}

.settings-modal__card.settings-modal__card--wide {
  width: min(920px, 100%);
}
