:root {
  --bg: var(--tg-theme-secondary-bg-color, #efeff4);
  --section-bg: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #fff));
  --text: var(--tg-theme-text-color, #000);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --subtitle: var(--tg-theme-subtitle-text-color, var(--hint));
  --header: var(--tg-theme-section-header-text-color, var(--hint));
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-text: var(--tg-theme-button-text-color, #fff);
  --link: var(--tg-theme-link-color, var(--accent));
  --danger: var(--tg-theme-destructive-text-color, #e53935);
  --separator: var(--tg-theme-section-separator-color, rgba(128, 128, 128, 0.2));
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

main { padding: 16px 0 32px; }

.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 0 32px;
  text-align: center;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--separator);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.emoji { font-size: 56px; margin-bottom: 12px; }
.title { font-size: 20px; font-weight: 600; margin: 0 0 8px; }
.hint { color: var(--hint); font-size: 14px; margin: 0 0 20px; }

.button {
  border: 0;
  border-radius: 10px;
  padding: 12px 20px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.section-header {
  margin: 20px 16px 6px;
  color: var(--header);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.section-footer {
  margin: 6px 16px 0;
  color: var(--hint);
  font-size: 13px;
}

.list {
  margin: 0 12px;
  background: var(--section-bg);
  border-radius: 12px;
  overflow: hidden;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  position: relative;
}

button.row { cursor: pointer; }
button.row:active { background: var(--separator); }

.row + .row::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 16px;
  border-top: 0.5px solid var(--separator);
}

.row-body { flex: 1; min-width: 0; }
.row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-subtitle { color: var(--subtitle); font-size: 14px; margin-top: 2px; }
.row-subtitle.warn { color: var(--danger); }
.chevron { color: var(--hint); font-size: 20px; }

.avatar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  font-weight: 600;
}

.add-row { color: var(--link); }

.banner {
  margin: 0 12px 4px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--section-bg);
  color: var(--danger);
  font-size: 14px;
}

.switch {
  flex: none;
  position: relative;
  width: 51px;
  height: 31px;
}

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

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 31px;
  background: var(--separator);
  transition: background 0.2s;
  pointer-events: none;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:disabled + span { opacity: 0.5; }
