:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #152033;
  --muted: #5f6b7a;
  --line: #d9e2ef;
  --primary: #1d4ed8;
  --primary-dark: #1e40af;
  --ok-bg: #ecfdf3;
  --ok-text: #166534;
  --err-bg: #fef2f2;
  --err-text: #991b1b;
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.page-login {
  min-height: 100vh;
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.name {
  font-weight: 700;
  font-size: 20px;
}

.sub {
  font-size: 13px;
  color: var(--muted);
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 600;
}

.main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.card-inner {
  padding: 24px;
}

.card-head {
  margin-bottom: 18px;
}

.title {
  margin: 0 0 6px;
  font-size: 28px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.form {
  display: grid;
  gap: 14px;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}

.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  background: #fff;
}

.input:focus {
  outline: 2px solid rgba(29, 78, 216, 0.15);
  border-color: var(--primary);
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.primary:hover {
  background: var(--primary-dark);
}

.notice {
  display: none;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
}

.notice.show {
  display: block;
}

.notice.ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.notice.error {
  background: var(--err-bg);
  color: var(--err-text);
}

.links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.links a {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
}

.footer {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 640px) {
  .topbar-inner,
  .card-inner {
    padding: 18px;
  }

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

  .title {
    font-size: 24px;
  }
}

.attempt-result {
  font-weight: 700;
}

.attempt-result.accepted {
  color: #1f7a3d;
}

.attempt-result.bad {
  color: #b42318;
}

.family-contact-list-shell {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
}

.family-contact-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
}

.family-contact-list-row:first-child {
  border-top: 0;
}

.family-contact-list-left {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
  flex: 1;
}

.family-contact-rank {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  min-width: 54px;
  color: var(--text);
}

.family-contact-copy {
  min-width: 0;
}

.family-contact-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  word-break: break-word;
}

.family-contact-phone {
  margin-top: 6px;
  font-size: 16px;
  color: var(--muted);
  word-break: break-word;
}

.family-contact-list-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.family-contact-action-btn,
.family-contact-icon-btn {
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 700;
}

.family-contact-action-btn {
  min-width: 96px;
  padding: 0 18px;
}

.family-contact-icon-btn {
  min-width: 46px;
  padding: 0 14px;
  font-size: 22px;
  line-height: 1;
}

.family-contact-delete-btn {
  color: #c2414c;
}

.family-contact-move-group {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.family-contact-move-group .family-contact-icon-btn {
  border: 0;
  border-radius: 0;
  min-width: 46px;
}

.family-contact-move-group .family-contact-icon-btn + .family-contact-icon-btn {
  border-left: 1px solid var(--line);
}

.family-contact-icon-btn[disabled],
.family-contact-action-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 760px) {
  .family-contact-list-row {
    flex-direction: column;
    align-items: stretch;
  }

  .family-contact-list-left {
    width: 100%;
  }

  .family-contact-list-actions {
    width: 100%;
    justify-content: stretch;
  }

  .family-contact-action-btn {
    flex: 1 1 140px;
  }

  .family-contact-delete-btn {
    flex: 0 0 auto;
  }

  .family-contact-move-group {
    margin-left: auto;
  }
}

.family-contact-list-shell {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
}

.family-contact-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
}

.family-contact-list-row:first-child {
  border-top: 0;
}

.family-contact-list-left {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
  flex: 1;
}

.family-contact-rank {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  min-width: 54px;
  color: var(--text);
}

.family-contact-copy {
  min-width: 0;
}

.family-contact-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  word-break: break-word;
}

.family-contact-phone {
  margin-top: 6px;
  font-size: 16px;
  color: var(--muted);
  word-break: break-word;
}

.family-contact-list-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.family-contact-action-btn,
.family-contact-icon-btn {
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 700;
}

.family-contact-action-btn {
  min-width: 96px;
  padding: 0 18px;
}

.family-contact-icon-btn {
  min-width: 46px;
  padding: 0 14px;
  font-size: 22px;
  line-height: 1;
}

.family-contact-delete-btn {
  color: #c2414c;
}

.family-contact-move-group {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.family-contact-move-group .family-contact-icon-btn {
  border: 0;
  border-radius: 0;
  min-width: 46px;
}

.family-contact-move-group .family-contact-icon-btn + .family-contact-icon-btn {
  border-left: 1px solid var(--line);
}

.family-contact-icon-btn[disabled],
.family-contact-action-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 760px) {
  .family-contact-list-row {
    flex-direction: column;
    align-items: stretch;
  }

  .family-contact-list-left {
    width: 100%;
  }

  .family-contact-list-actions {
    width: 100%;
    justify-content: stretch;
  }

  .family-contact-action-btn {
    flex: 1 1 140px;
  }

  .family-contact-delete-btn {
    flex: 0 0 auto;
  }

  .family-contact-move-group {
    margin-left: auto;
  }
}
