/* Shared login bar + modal (used on every page) */
.page-home-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
  color: var(--ink-soft, #57604F);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease;
}
.page-home-back:hover { color: var(--accent-ink, #0E5E36); }
.page-home-back--inline {
  margin-bottom: 0;
  font-size: 13.5px;
  font-weight: 600;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.auth-top-bar,
.top-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 0 0;
  font-size: 13px;
}

.auth-top-bar--inline {
  padding: 0;
  margin-left: auto;
}

.auth-top-bar--fixed {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 120;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface, #fff);
  border: 1px solid var(--line, rgba(27, 33, 29, 0.12));
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.auth-user { color: var(--ink-soft, #57604F); }

.auth-action {
  border: 1px solid var(--line, rgba(27, 33, 29, 0.12));
  background: var(--surface, #fff);
  color: var(--ink, #1B211D);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
}

.auth-action:hover { background: var(--surface-soft, #FBFAF6); }

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(20, 23, 19, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

body.auth-open { overflow: hidden; }

.auth-panel {
  width: min(420px, 100%);
  background: var(--surface, #fff);
  border: 1px solid var(--line, rgba(27, 33, 29, 0.12));
  border-radius: 16px;
  box-shadow: 0 24px 60px var(--shadow, rgba(27, 33, 29, 0.1));
  padding: 24px;
}

.auth-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.auth-head h2 {
  margin: 0;
  font-size: 20px;
  font-family: Georgia, "Songti SC", "STSong", "Noto Serif SC", serif;
}

.auth-close {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-faint, #8B927F);
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-tab {
  flex: 1;
  border: 1px solid var(--line, rgba(27, 33, 29, 0.12));
  background: var(--surface-soft, #FBFAF6);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  font: inherit;
  color: inherit;
}

.auth-tab.active {
  border-color: var(--accent, #16874C);
  background: var(--accent-tint, #DCEEE1);
  color: var(--accent-ink, #0E5E36);
}

.auth-field { margin-bottom: 14px; }

.auth-field label {
  display: block;
  font-size: 12px;
  color: var(--ink-soft, #57604F);
  margin-bottom: 6px;
}

.auth-field input {
  width: 100%;
  border: 1px solid var(--line, rgba(27, 33, 29, 0.12));
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg, #F5F4EF);
  color: var(--ink, #1B211D);
  font: inherit;
}

.auth-code-row {
  display: flex;
  gap: 8px;
}

.auth-code-row input { flex: 1; }

.auth-send {
  flex-shrink: 0;
  border: 1px solid var(--line, rgba(27, 33, 29, 0.12));
  background: var(--surface-soft, #FBFAF6);
  border-radius: 10px;
  padding: 0 12px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
  font: inherit;
  color: inherit;
}

.auth-send:disabled { opacity: 0.55; cursor: not-allowed; }

.auth-submit {
  width: 100%;
  margin-top: 6px;
  border: none;
  border-radius: 10px;
  padding: 12px;
  background: var(--accent, #16874C);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  font: inherit;
}

.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }

.auth-message {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-soft, #57604F);
}

.auth-message[data-type="error"] { color: #b42318; }
.auth-message[data-type="success"] { color: var(--accent-ink, #0E5E36); }

.auth-hint {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--ink-faint, #8B927F);
  line-height: 1.5;
}

[hidden] { display: none !important; }

/* index shell: sidebar + mobile topbar mounts */
.sidebar-auth .auth-top-bar,
.topbar-auth .auth-top-bar {
  justify-content: flex-start;
}
