:root {
  --bg: #08080b;
  --panel: rgba(17, 18, 24, 0.86);
  --panel-strong: rgba(22, 24, 31, 0.96);
  --fg: #f5f2ea;
  --muted: rgba(245, 242, 234, 0.55);
  --line: rgba(255, 255, 255, 0.1);
  --accent: #e7d7b8;
  --danger: #d49aa5;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(1100px 720px at 8% -10%, rgba(91, 129, 166, 0.2), transparent 62%),
    radial-gradient(900px 650px at 102% 8%, rgba(175, 105, 126, 0.14), transparent 58%),
    linear-gradient(180deg, #0a0b10 0%, #08080b 55%, #050507 100%);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
a {
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

.admin-app {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
}

/* ---------- topbar ---------- */

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 8, 12, 0.82);
  backdrop-filter: blur(16px);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.back:hover {
  color: var(--fg);
}

.back-arrow {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 0.9rem;
}

.titles {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.22rem;
}

.eyebrow {
  margin: 0;
  color: rgba(231, 215, 184, 0.72);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  overflow: hidden;
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
}

.save-state {
  color: var(--muted);
  font-size: 0.7rem;
  white-space: nowrap;
}

.save-state.is-dirty {
  color: var(--accent);
}

.save-btn,
.logout-btn,
.primary-btn,
.add-btn,
.small-btn,
.danger-btn {
  border-radius: 9px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.save-btn {
  padding: 0.55rem 1.1rem;
  border: 1px solid rgba(231, 215, 184, 0.45);
  background: rgba(231, 215, 184, 0.14);
  color: var(--fg);
  font-size: 0.78rem;
}

.save-btn:hover:not(:disabled) {
  border-color: rgba(231, 215, 184, 0.8);
  background: rgba(231, 215, 184, 0.22);
}

.save-btn:disabled {
  cursor: default;
  opacity: 0.4;
}

.logout-btn {
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
}

.password-btn {
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
}

.logout-btn:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--fg);
}

.password-btn:hover {
  border-color: rgba(231, 215, 184, 0.4);
  color: var(--accent);
}

/* ---------- login ---------- */

.admin-main {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.login-panel {
  display: grid;
  flex: 1;
  padding: 2rem 1rem 5rem;
  place-items: center;
}

.login-card {
  width: min(380px, 100%);
  padding: 1.8rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.login-eyebrow {
  margin: 0 0 0.5rem;
  color: rgba(231, 215, 184, 0.7);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

.login-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.login-desc {
  margin: 0 0 1.3rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.redirect-notice {
  margin: 0 0 1.1rem;
  padding: 0.8rem;
  border: 1px solid rgba(231, 215, 184, 0.28);
  border-radius: 12px;
  background: rgba(231, 215, 184, 0.07);
  text-align: left;
}

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

.redirect-title {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.redirect-desc {
  margin: 0;
  color: rgba(245, 242, 234, 0.62);
  font-size: 0.7rem;
  line-height: 1.55;
  word-break: keep-all;
}

.redirect-desc strong {
  color: var(--fg);
  font-size: 0.92rem;
}

.redirect-hint {
  margin: 0.4rem 0 0;
  color: rgba(245, 242, 234, 0.36);
  font-size: 0.62rem;
  line-height: 1.5;
}

.redirect-now {
  margin-top: 0.65rem;
  padding: 0.38rem 0.6rem;
  border: 1px solid rgba(231, 215, 184, 0.32);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.64rem;
  font-weight: 600;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.redirect-now:hover {
  border-color: rgba(231, 215, 184, 0.6);
  background: rgba(231, 215, 184, 0.1);
}

.redirect-progress {
  height: 3px;
  margin-top: 0.7rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.redirect-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform-origin: left center;
  animation: redirectCountdown 5s linear forwards;
}

@keyframes redirectCountdown {
  from {
    transform: scaleX(1);
  }

  to {
    transform: scaleX(0);
  }
}

.primary-btn {
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.72rem 1rem;
  border: 1px solid rgba(231, 215, 184, 0.5);
  background: rgba(231, 215, 184, 0.16);
  color: var(--fg);
  font-size: 0.84rem;
}

.primary-btn:hover {
  background: rgba(231, 215, 184, 0.24);
}

.form-error {
  margin: 0.2rem 0 0.6rem;
  color: #f0bcc4;
  font-size: 0.74rem;
  line-height: 1.5;
}

/* ---------- editor layout ---------- */

.editor {
  display: grid;
  flex: 1;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem clamp(1rem, 2.5vw, 1.6rem) 2rem;
}

.member-pane,
.detail-pane {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.member-pane {
  align-self: start;
  padding: 1rem;
}

.detail-pane {
  padding: 1.2rem;
}

.pane-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.pane-head h2 {
  margin: 0;
  font-size: 0.9rem;
  letter-spacing: -0.02em;
}

.pane-head h2 span {
  color: var(--accent);
}

.pane-actions {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
}

.add-btn {
  padding: 0.4rem 0.7rem;
  border: 1px solid rgba(231, 215, 184, 0.38);
  background: rgba(231, 215, 184, 0.08);
  color: var(--fg);
  font-size: 0.7rem;
}

.add-btn:hover {
  background: rgba(231, 215, 184, 0.16);
}

.dup-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line);
  background: transparent;
  color: rgba(245, 242, 234, 0.5);
  font-family: inherit;
  font-size: 0.66rem;
  font-weight: 600;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.dup-btn:hover {
  border-color: rgba(231, 215, 184, 0.4);
  background: rgba(231, 215, 184, 0.07);
  color: var(--accent);
}

.dup-btn span {
  display: inline-grid;
  min-width: 17px;
  height: 17px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(245, 242, 234, 0.55);
  font-size: 0.58rem;
}

.dup-btn.has-items {
  border-color: rgba(231, 215, 184, 0.35);
  color: var(--accent);
}

.dup-btn.has-items span {
  background: rgba(231, 215, 184, 0.18);
  color: var(--accent);
}

.search-input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.78rem;
  outline: none;
}

.search-input:focus,
.field input:focus,
.field select:focus {
  border-color: rgba(231, 215, 184, 0.5);
}

.search-input::placeholder {
  color: rgba(245, 242, 234, 0.32);
}

.member-summary {
  margin: 0.6rem 0 0.4rem;
  color: rgba(245, 242, 234, 0.4);
  font-size: 0.66rem;
}

.member-list {
  display: flex;
  max-height: calc(100dvh - 240px);
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.member-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.member-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.member-item.is-selected {
  border-color: rgba(231, 215, 184, 0.34);
  background: rgba(231, 215, 184, 0.08);
}

.member-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(145deg, #343846, #22242d);
  color: rgba(245, 242, 234, 0.8);
  font-size: 0.74rem;
  font-weight: 800;
}

.member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.member-avatar.male {
  background: linear-gradient(145deg, #c6dcea, #7fa6c2);
  color: #0b0b0f;
}

.member-avatar.female {
  background: linear-gradient(145deg, #f2d0d5, #d49aa5);
  color: #0b0b0f;
}

.member-text {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 0.12rem;
}

.member-name {
  overflow: hidden;
  font-size: 0.8rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-role {
  overflow: hidden;
  color: rgba(245, 242, 234, 0.42);
  font-size: 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-badge {
  flex: 0 0 auto;
  padding: 0.18rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: rgba(245, 242, 234, 0.45);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.side-badge.both {
  border-color: rgba(231, 215, 184, 0.3);
  color: rgba(231, 215, 184, 0.75);
}

/* ---------- detail ---------- */

.empty-state {
  display: grid;
  min-height: 320px;
  place-items: center;
  color: rgba(245, 242, 234, 0.35);
  font-size: 0.8rem;
  line-height: 1.7;
  text-align: center;
}

.form-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.photo-editor {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.photo-preview {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: linear-gradient(145deg, #2b2e38, #1a1c23);
  color: rgba(245, 242, 234, 0.75);
  font-size: 1.4rem;
  font-weight: 800;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
}

.small-btn {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.62rem;
}

.small-btn:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--fg);
}

.small-btn:disabled {
  cursor: default;
  opacity: 0.35;
}

.danger-text:hover:not(:disabled) {
  border-color: rgba(212, 154, 165, 0.5);
  color: #f0bcc4;
}

.photo-note {
  max-width: 130px;
  margin: 0;
  color: rgba(245, 242, 234, 0.35);
  font-size: 0.58rem;
  line-height: 1.4;
  text-align: center;
}

.form-title {
  min-width: 0;
}

.form-eyebrow {
  margin: 0 0 0.25rem;
  color: rgba(231, 215, 184, 0.6);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.form-title h2 {
  margin: 0;
  overflow: hidden;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-back-btn {
  margin-left: auto;
  align-self: flex-start;
  flex: 0 0 auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  padding: 1rem 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-label {
  color: rgba(245, 242, 234, 0.5);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.field-label b {
  color: var(--accent);
}

.field input,
.field select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.8rem;
  outline: none;
}

.field select option {
  background: #16181f;
  color: var(--fg);
}

.spouse-field {
  margin: 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.spouse-field legend {
  padding: 0 0.35rem;
  color: rgba(245, 242, 234, 0.5);
  font-size: 0.66rem;
  font-weight: 600;
}

.spouse-list {
  display: grid;
  max-height: 132px;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.2rem 0.6rem;
  overflow-y: auto;
}

.spouse-option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.24rem 0.3rem;
  border-radius: 7px;
  color: rgba(245, 242, 234, 0.72);
  cursor: pointer;
  font-size: 0.72rem;
}

.spouse-option:hover {
  background: rgba(255, 255, 255, 0.05);
}

.spouse-option input {
  accent-color: #d8bf8f;
}

.field-hint {
  margin: 0.45rem 0 0;
  color: rgba(245, 242, 234, 0.32);
  font-size: 0.6rem;
}

/* ---------- relation steps ---------- */

.relation-section {
  margin-top: 0.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.relation-head h3 {
  margin: 0 0 0.25rem;
  font-size: 0.86rem;
  letter-spacing: -0.02em;
}

.relation-head p {
  margin: 0 0 0.8rem;
  color: rgba(245, 242, 234, 0.42);
  font-size: 0.68rem;
  line-height: 1.55;
}

.relation-head strong {
  color: rgba(231, 215, 184, 0.8);
}

.relation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.relation-slot {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.relation-slot.is-empty {
  border-style: dashed;
}

.relation-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.relation-label {
  color: rgba(245, 242, 234, 0.55);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.relation-add {
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: rgba(245, 242, 234, 0.45);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.6rem;
  white-space: nowrap;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.relation-add:hover:not(:disabled) {
  border-color: rgba(231, 215, 184, 0.4);
  background: rgba(231, 215, 184, 0.08);
  color: var(--accent);
}

.relation-add:disabled {
  cursor: default;
  opacity: 0.3;
}

.relation-people {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.relation-chip {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.7rem;
  text-align: left;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.relation-chip:hover {
  border-color: rgba(231, 215, 184, 0.38);
  background: rgba(231, 215, 184, 0.08);
}

.relation-chip .chip-role {
  color: rgba(245, 242, 234, 0.4);
  font-size: 0.58rem;
}

.relation-empty {
  color: rgba(245, 242, 234, 0.28);
  font-size: 0.66rem;
}

.relation-note {
  grid-column: 1 / -1;
  margin: 0;
  color: rgba(245, 242, 234, 0.3);
  font-size: 0.6rem;
  line-height: 1.5;
}

.relation-warning {
  color: rgba(231, 215, 184, 0.55);
  font-size: 0.58rem;
  line-height: 1.4;
}

.form-footer {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.danger-btn {
  padding: 0.5rem 0.8rem;
  border: 1px solid rgba(212, 154, 165, 0.32);
  background: rgba(212, 154, 165, 0.08);
  color: #e7acb6;
  font-size: 0.7rem;
}

.danger-btn:hover {
  background: rgba(212, 154, 165, 0.16);
}

.form-hint {
  margin: 0;
  color: rgba(245, 242, 234, 0.35);
  font-size: 0.66rem;
}

.form-hint strong {
  color: rgba(231, 215, 184, 0.8);
}

/* ---------- password dialog ---------- */

.password-dialog,
.quick-dialog {
  width: min(420px, calc(100% - 2rem));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-strong);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.6);
  color: var(--fg);
}

.password-dialog::backdrop,
.quick-dialog::backdrop {
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(3px);
}

.password-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.4rem;
}

.password-form h2 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
}

.dialog-desc {
  margin: 0 0 0.3rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.6;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.dialog-actions .primary-btn {
  width: auto;
  min-width: 84px;
  margin-top: 0;
}

.access-current {
  margin: 0 0 0.4rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.72rem;
}

.access-current.is-set {
  border-color: rgba(231, 215, 184, 0.3);
  color: var(--accent);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.quick-check {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  color: rgba(245, 242, 234, 0.52);
  cursor: pointer;
  font-size: 0.68rem;
  line-height: 1.5;
}

.quick-check input {
  margin-top: 0.15rem;
  accent-color: #d8bf8f;
}

.quick-existing {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.6rem;
  border: 1px dashed rgba(231, 215, 184, 0.3);
  border-radius: 10px;
  background: rgba(231, 215, 184, 0.05);
}

.quick-existing .field-hint {
  margin: 0;
  color: rgba(231, 215, 184, 0.55);
}

/* ---------- duplicate dialog ---------- */

.duplicate-dialog {
  width: min(760px, calc(100% - 2rem));
  max-height: min(86dvh, 900px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.65);
  color: var(--fg);
}

.duplicate-dialog::backdrop {
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(3px);
}

.duplicate-panel {
  display: flex;
  max-height: min(86dvh, 900px);
  flex-direction: column;
}

.duplicate-head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--line);
}

.duplicate-head h2 {
  margin: 0 0 0.3rem;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
}

.duplicate-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.6;
}

.duplicate-head .logout-btn {
  flex: 0 0 auto;
  margin-left: auto;
}

.duplicate-list {
  padding: 1rem 1.4rem 1.4rem;
  overflow-y: auto;
}

.dup-group {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

.dup-group + .dup-group {
  margin-top: 0.7rem;
}

.dup-group h3 {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  letter-spacing: -0.02em;
}

.dup-group h3 span {
  color: var(--accent);
  font-size: 0.68rem;
}

.dup-group > p {
  margin: 0;
  color: rgba(245, 242, 234, 0.42);
  font-size: 0.66rem;
  line-height: 1.55;
}

.dup-people {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.dup-person {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.018);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.dup-person:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.dup-person:has(input:checked) {
  border-color: rgba(231, 215, 184, 0.45);
  background: rgba(231, 215, 184, 0.07);
}

.dup-person input {
  margin-top: 0.45rem;
  accent-color: #d8bf8f;
}

.dup-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(145deg, #343846, #22242d);
  color: rgba(245, 242, 234, 0.8);
  font-size: 0.72rem;
  font-weight: 800;
}

.dup-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dup-info {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.15rem;
}

.dup-info strong {
  font-size: 0.8rem;
}

.dup-info > span {
  color: rgba(245, 242, 234, 0.5);
  font-size: 0.64rem;
  line-height: 1.45;
}

.dup-info .dup-links {
  color: rgba(245, 242, 234, 0.36);
  font-size: 0.6rem;
  line-height: 1.5;
  word-break: keep-all;
}

.dup-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.7rem;
}

.dup-actions > span {
  margin-right: auto;
  color: rgba(245, 242, 234, 0.35);
  font-size: 0.62rem;
}

.dup-merge {
  padding: 0.45rem 0.8rem;
  border: 1px solid rgba(231, 215, 184, 0.45);
  border-radius: 9px;
  background: rgba(231, 215, 184, 0.12);
  color: var(--fg);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.dup-merge:hover:not(:disabled) {
  border-color: rgba(231, 215, 184, 0.8);
  background: rgba(231, 215, 184, 0.2);
}

.dup-merge:disabled {
  cursor: default;
  opacity: 0.4;
}

.dup-empty {
  padding: 2rem 1rem;
  color: rgba(245, 242, 234, 0.4);
  font-size: 0.78rem;
  line-height: 1.7;
  text-align: center;
}

.dup-error {
  margin: 0.8rem 1.4rem 0;
  padding: 0.6rem 0.7rem;
  border: 1px solid rgba(212, 154, 165, 0.35);
  border-radius: 9px;
  background: rgba(212, 154, 165, 0.08);
  color: #f0bcc4;
  font-size: 0.68rem;
  line-height: 1.5;
}

/* ---------- side settings ---------- */

.pane-desc {
  margin: 0 0 0.9rem;
  color: rgba(245, 242, 234, 0.42);
  font-size: 0.7rem;
  line-height: 1.55;
}

.side-row {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
}

.side-row + .side-row {
  margin-top: 0.55rem;
}

.side-row .field + .field {
  margin-top: 0.55rem;
}

.side-note {
  margin-top: 1rem;
  color: rgba(245, 242, 234, 0.32);
  font-size: 0.64rem;
  line-height: 1.6;
}

.side-note p {
  margin: 0 0 0.4rem;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: 1.6rem;
  left: 50%;
  z-index: 60;
  padding: 0.7rem 1.1rem;
  border: 1px solid rgba(231, 215, 184, 0.34);
  border-radius: 999px;
  background: rgba(20, 22, 28, 0.96);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  color: var(--fg);
  font-size: 0.78rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  visibility: hidden;
  white-space: nowrap;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
  visibility: visible;
}

.toast.is-error {
  border-color: rgba(212, 154, 165, 0.6);
  color: #f2d0d5;
}

body.photo-busy .photo-actions,
body.photo-busy .photo-preview {
  opacity: 0.45;
  pointer-events: none;
}

/* ---------- responsive ---------- */

@media (max-width: 1040px) {
  .editor {
    grid-template-columns: 260px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .admin-topbar {
    flex-wrap: wrap;
    gap: 0.6rem 0.8rem;
    padding: 0.75rem 1rem;
  }

  .back-label {
    display: none;
  }

  .titles {
    flex: 1;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
    margin-left: 0;
  }

  .save-state {
    margin-right: auto;
  }

  .editor {
    display: flex;
    flex-direction: column;
    padding: 0.8rem 0.8rem 2rem;
  }

  .member-pane {
    width: 100%;
  }

  .member-list {
    max-height: 240px;
  }

  .form-head {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .relation-grid {
    grid-template-columns: 1fr;
  }

  .quick-grid {
    grid-template-columns: 1fr;
  }

  .duplicate-dialog {
    width: calc(100% - 1rem);
    max-height: 90dvh;
  }

  .duplicate-panel {
    max-height: 90dvh;
  }

  .duplicate-head {
    flex-wrap: wrap;
    padding: 1rem;
  }

  .duplicate-head .logout-btn {
    margin-left: 0;
  }

  .duplicate-list {
    padding: 0.8rem 0.8rem 1rem;
  }

  .dup-actions {
    flex-wrap: wrap;
  }

  .dup-actions > span {
    width: 100%;
  }

  .dup-merge {
    width: 100%;
  }

  .form-footer {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
