.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(36, 48, 89, 0.6);
  background: rgba(7, 11, 23, 0.8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1120px, 100% - 2.5rem);
  min-height: 60px;
  margin-inline: auto;
}

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

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.account-name {
  max-width: 14ch;
  overflow: hidden;
  color: var(--soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-button {
  padding: 0.4rem 0.2rem;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.shell {
  width: min(1120px, 100% - 2.5rem);
  margin: 0 auto;
  padding-block: 2.25rem 4rem;
}

.loading {
  color: var(--soft);
}

.page h1,
.gate h1 {
  margin: 0 0 0.5rem;
  font: 800 clamp(1.7rem, 3vw, 2.2rem)/1.1 var(--display);
  font-stretch: 125%;
}

.lede {
  margin: 0 0 1.75rem;
  color: var(--soft);
}

.gate {
  max-width: 34rem;
  padding-block: 3rem;
}

.gate p {
  color: var(--soft);
}

.owner-note {
  margin-top: 1.75rem;
  color: var(--soft);
  font-size: 0.925rem;
}

.owner-note summary {
  cursor: pointer;
}

.notice {
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--cold);
  border-radius: 8px;
  background: var(--surface);
}

.notice.error {
  border-left-color: var(--hot);
  color: var(--hot-text);
}

.empty {
  padding: 1.5rem;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: rgba(16, 26, 54, 0.6);
}

.empty p {
  margin-top: 0;
  color: var(--soft);
}

/* Server list */
.servers {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.server {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(23, 35, 77, 0.6), rgba(16, 26, 54, 0.6));
  transition: border-color 0.15s;
}

.server:hover {
  border-color: var(--line-strong);
}

.server-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.icon.placeholder {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font: 800 1rem/1 var(--display);
}

/* Settings workspace */
.workspace {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

@media (max-width: 800px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }
}

.back {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--soft);
}

.guild-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.guild-head h1 {
  margin: 0;
  font: 700 1.1rem/1.25 var(--display);
  font-stretch: 112%;
  overflow-wrap: anywhere;
}

.tabs {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

@media (max-width: 800px) {
  .tabs {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.tabs a {
  padding: 0.6rem 0.85rem;
  border-radius: 10px;
  color: var(--soft);
  font-weight: 500;
  text-decoration: none;
}

.tabs a:hover {
  background: rgba(23, 35, 77, 0.7);
  color: var(--text);
}

.tabs a[aria-current="page"] {
  background: var(--surface-2);
  box-shadow: inset 3px 0 0 var(--amber);
  color: var(--text);
}

.panel {
  min-width: 0;
}

.block {
  margin-bottom: 1.25rem;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(23, 35, 77, 0.55), rgba(16, 26, 54, 0.55));
}

.block h2 {
  margin: 0 0 0.35rem;
  font: 700 1.2rem/1.3 var(--display);
  font-stretch: 112%;
}

.hint {
  margin: 0;
  color: var(--soft);
  font-size: 0.925rem;
}

.block > .hint {
  margin-bottom: 1rem;
}

.list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.row-title {
  display: block;
  font-weight: 600;
}

.empty-row {
  padding-block: 0.85rem;
  border-bottom: 1px solid var(--line);
  color: var(--soft);
}

/* Forms */
.form {
  display: grid;
  gap: 1rem;
  max-width: 34rem;
}

.form.wide {
  max-width: none;
}

.field {
  display: grid;
  gap: 0.3rem;
}

.field-label {
  font-weight: 600;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--line-strong);
  border-radius: 8px;
  background: #0a1022;
  color: var(--text);
  font: inherit;
}

input[type="text"]:hover,
input[type="number"]:hover,
select:hover {
  border-color: var(--soft);
}

.form .button {
  justify-self: start;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

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

/* Switch */
.switch {
  position: relative;
  display: inline-block;
  flex: none;
  width: 46px;
  height: 28px;
}

.switch input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #2a3560;
  transition: background 0.15s;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.switch input:checked + .switch-track {
  background: var(--amber);
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
  outline: 3px solid var(--cold);
  outline-offset: 2px;
}

.switch input:disabled {
  cursor: progress;
}

/* Preview table */
.table-scroll {
  overflow-x: auto;
}

table.preview {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

table.preview caption {
  margin-bottom: 0.5rem;
  color: var(--soft);
  text-align: left;
}

table.preview th,
table.preview td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

table.preview thead th {
  color: var(--soft);
  font-weight: 600;
}

table.preview tbody th {
  font-weight: 500;
}

/* Toast */
.toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  max-width: min(26rem, 100% - 2.5rem);
  padding: 0.8rem 1.1rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

.toast.error {
  border-color: var(--hot);
  color: var(--hot-text);
}

.toast[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .switch-track,
  .switch-track::after,
  .server {
    transition: none;
  }
}
